Finding out whether process model instance is completed from java code

Hello All,
I am writing a java plugin and this plugins starts a process instance but I am unable to get information on whether this process instance is completed or not. I am using Process controller concludeProcess() method but this is throwing exception and not reliable to get that information. Any help on pointers would be appreciated

OriginalPostID-234691

  Discussion posts and replies are publicly visible

Parents
  • No. Plug-ins can use injected services in their constructor that are automatically injected by Appian by simply having them as arguments in your constructor. Check the examples under Shared Components. They have the source code, they will be good training.

    For example: "Process Management Services" has ResumeProcesses.java which in its constructor states that Appian should inject ProcessExecutionService automatically, so all the creator needed was to put that in the constructor and store that reference in a variable.

    The author designed a slightly more complex architecture than what you normally need but what she did basically translates into this (see how she can use the "pes" variable in her run method just because she declared it as a variable that'll be populated automatically by Appian in the constructor)

    @ProcessManagement
    public class ResumeProcesses extends extends AppianSmartService{

    private ProcessExecutionService pes;

              public ResumeProcesses(ProcessExecutionService pes) {
    this.pes = pes
              }

              @Override
              public void run() throws SmartServiceException {
                        Integer[] resultCodeIds;

                        if (dryRun) {
                                  resultCodeIds = new ProcessManagerDryRun(pes).resumeProcesses(processIds);
                        } else {
                                  resultCodeIds = pes.resumeProcesses(processIds);
                        }

                        setResultCodeList(resultCodeIds);
              }

Reply
  • No. Plug-ins can use injected services in their constructor that are automatically injected by Appian by simply having them as arguments in your constructor. Check the examples under Shared Components. They have the source code, they will be good training.

    For example: "Process Management Services" has ResumeProcesses.java which in its constructor states that Appian should inject ProcessExecutionService automatically, so all the creator needed was to put that in the constructor and store that reference in a variable.

    The author designed a slightly more complex architecture than what you normally need but what she did basically translates into this (see how she can use the "pes" variable in her run method just because she declared it as a variable that'll be populated automatically by Appian in the constructor)

    @ProcessManagement
    public class ResumeProcesses extends extends AppianSmartService{

    private ProcessExecutionService pes;

              public ResumeProcesses(ProcessExecutionService pes) {
    this.pes = pes
              }

              @Override
              public void run() throws SmartServiceException {
                        Integer[] resultCodeIds;

                        if (dryRun) {
                                  resultCodeIds = new ProcessManagerDryRun(pes).resumeProcesses(processIds);
                        } else {
                                  resultCodeIds = pes.resumeProcesses(processIds);
                        }

                        setResultCodeList(resultCodeIds);
              }

Children
No Data