I have multiple text value constant (e.g. cons!Country) where i have 4 values (e.g. India, America, China, Italy), similarly i have the same details in a Database Table. when ever an update is happening in the database table on the Country name, then the same changes should be updated in the constant as well. But the order of the list in constant can't be changed, because it is hard coded in many interface for some validation using the Constant value Index.
I know how to find a particular value in a Constant(Multiple Text Value), but not sure how to update a particular value in a constant.
Please help me with some suggestions for this problem.
My initial thoughts are that you may well be past the point where I would recommend that you NOT use a constant as an array of values, as you are now hitting the very issues I would highlight if I were reviewing the code. Use of constants as arrays has two main issues:
A better implementation would be for each element to be its own single-value constant: cons!COUNTRY_INDIA, cons!COUNTRY_AMERICA etc.
Then where you need a list you simply write an expression:
As I said, this may well be too late for your application, but it's worth bearing in mind for future implementations.
Having said all that, if you need to solve the problem to hand you'll have to effectively update the entire contents of the constant. You can extract the value to a process variable so that it now exists as a list of text, then you can update the element in that list and then write the entire list back to the constant. It's not pretty, and another good reason not to implement the constant-as-an-array pattern.
For time being we can't touch the constant , as it is used in multiple interface validations.
I have used Update constant smart service to achieve it, but facing one issue with it. Would be great if you can help with the issue am facing. In a process model there is a User Lane and System Lane, in the System Lane the update constant smart service is placed. When i run the process model for the first time then the update is happening in the Constant, when i try to re-update in the same session, then the Update Constant smart service is showing an exception "The user does not have sufficient privileges to update the constant. Constant ID"
When i use a Tech Admin ID then it is working though i update multiple times, if i use a User from the User Group then the privileges issues raised, but that even when i re-update the constant and not in the first time.
Hi Sunil - Appian objects have security applied, so it depends on what security settings are applied to your constant and also what account you're using to update it with. What is the Assignment setting for the nodes in the 'System' lane? (note: just because the lane is labelled 'System' doesn't mean you're using System privileges for nodes in that lane!)
Discussion posts and replies are publicly visible
© 2020 Appian. All rights reserved.