How to get Process Model Name and Application Name From Process Instance ID

Hi All, Is there any way to capture Process Model Name and the Application Name based on process Instance ID?

OriginalPostID-228313

OriginalPostID-228313

  Discussion posts and replies are publicly visible

  • @mohanp Hi, to get the Process Model Name from Process Id you may do as follows and this is possible only when the Process exists in Appian(In case if it's an archived process, I think you may need to store the desired information in database):

    Build a Process Report (may be of Process Details Per Process Model category) and add a column in the Report with value as pm!name. Query this report by making use of a!queryProcessAnalytics() and the desired Process Id as the contextProcessIds, and this way you will obtain the Process Model Name.


    I am not aware of a way to get the Application Name based on the Process Instance Id, so I would leave it with the other practitioners here. I guess the only way is to associate the desired details such as process instance id, application details etc to the case in the database/process.
  • Not sure how you can handle this in the existing instances but for the New Instances, we can do it like....when creating a process model create 2 pvs of App_PmName, and App_ApplicationName, which you can save the values of pm!name in one pv and other is the include all the Application Names which you want to and then give the constant in respective models, Create a Process Report, and then call these PVs based on instance ID.... Hope this would help!!!
  • I would suggest the same approach as given by Sikhivahan for finding the process model name from process Id.

    Coming to the other point - that is finding the Application name from the process instance Id, there is no direct and clear solution.
    Note that a process instance can belong to only process model ID. So, there is one-to-one mapping between process instance ID and process model name(or process model ID).

    But, a process model can be included in multiple applications. So, indirectly a process instance can belong to one or more applications (if the process model for that process instance is a part of multiple applications). This is possible because developers can reuse same process model in multiple applications.

    Hence the mapping between process instance ID and application is not one-to-one. So, it is not straightforward to find the application name from process instance ID. First you need to find the process model from process ID. Then find the applications which contain that process model.
  • Thank you all for the Inputs. @Sikhivahan/Harsha, I'm more concern about getting Application Name. @Harsha, My requirement is not specific to a process model. it's generic to all process models (i.e., all existing as well as new models). Having such PV's in all the models is not a good Idea.
  • Hi Mohan, getting an application name uniquely may not be possible as
    1. The same process model can be part of multiple applications and exposed as actions - this may resolve in multiple
    2. If a process is started through related action - in this case it may not at all associated with any app.

    So if we need consistency I believe as other practitioners mentioned it's better to have Pv variables and determine.
  • @mohanp I don't think it's possible to do what you have been trying to achieve. The application you are trying to store is part of business data, so I would suggest maintaining this as a context in your process models and store it in the database later. That is, let's say you have a process model and it's origination point might be different applications. While you initiate the process, pass the desired application as the context and store it in the database. When it comes to PV, yes, this has to be stored in a PV(which can be a Primitive or CDT), as long as you want your process to be differentiated.

    Another option might be to differentiate based on the entityId. Maintain a centralised table of identifiers(i.e. a case id or an application id) and when you store a value in it, attach the desired application name with it. And when you query this table later, you may know the application name associated with the given processes.

    One more option could be to save the 'source'(i.e. application context) of a Record when a Record is being persisted in Database.

    There are various ways actually and I believe it depends on how your existing system is designed.
  • Thanks Sikhivahans/Narasimhaadityac/Harsha. I'll give a try.