How can I cast a value to datatype "Process model"?
I want to dynamically start a process model using
a!startProcess(processModel, processParameters, onSuccess, onError). I know that I can create a constant of type process model and pass it to parameter processModel.
However I would like to make it more dynamic, so that I need not create a constant everytime I want to call a new process model in future. Instead, planning to store the process model ID number in database and type cast it to "process model" and pass it as a parameter to a!startProcess().
I learnt that casting to type "Process Model"is not available in https://docs.appian.com/suite/help/19.3/Casting.html#general-casting, and anything that is not the list cannot be cast or will throw an error. Could anyone please let me know if there is any way we can achieve this.
I also learnt that we can make the design dynamic by using decision tables to map Process models and then use Start Process Smart Service. However, if I want to call a new process in future, I will still need to make changes to the decision table and deploy a new version. So, I am checking for getting the database approach I mentioned and using a!startProcess().
Thanks in advance!
AFAIK there is no way to dynamically call a process by its ID from database and one more thing to add is when a process model is deployed to higher env the process model ID changes only thing that remains constant is the UUID
a!startProcess() only needs the process model ID, and it doesn't need to be type cast. The additional hurdle is that the process model ID is environment-specific (as already mentioned by Chanakya) - so if you're writing anything to the DB, it should be the UUID, and then you can use either the Process Model Details plugin or the Content Tools plugin to get the process model ID per the UUID.
Thanks for the response. I used a decision table for mapping process model with the application name, as it is equally configurable and faster when compared to retrieving from database.
Hi Chanakya, thanks for the response.
Just an observation - I've seen this sort of pattern implemented in other languages/platforms and whist it is clever and flexible it can be really hard to debug when it goes wrong. Given that you can't dynamically create a process model at run time (which would be a frightening prospect!) then I'm not sure why living with a static model isn't palatable? You have the option of using a Appian Decision to dynamically return references to Process Models based upon rules (although you can only execute the using the Start Process smart service and therefore asynchronously by default).
Discussion posts and replies are publicly visible
© 2020 Appian. All rights reserved.