I want to be able to update properties in a case via an activity (or data transform). But the property being updated could be different each time, so I want this activity to be reuseable.
Is there a way to pass the name of the property to be updated AS A PARAMETER and have this property updated with a value (also passed as a parameter) using either an activity or data transform?
@RobertH9685
Send the Property name as a param to a DataTransfrom and use when conditions to determine and set corresponding property value under when condition. you can write multiple when conditions for different params values.
@RobertH9685 Hi, if the list of properties to update is too long for the above approach to make sense - you can use the setPropertyValue function from RuleManagement library.
Hello @RobertH9685 - I have tried this approach, however it didn’t work. I’m getting the output for RuleManagement • setPropertyValue function as False. Below snippet from the activity, any suggestions would be really helpful.
That RUF uses the method getIfPresent(java.lang.String aReference). That method checks if your property is in the clipboard, if not it doesn’t instantiate it. You need to either make sure that property is in the clibpoard by initializing it before to an empty value or create your own RUF which should use getProperty() to fetch the property. Pega has an OOTB RUF to set the value called Property • setPropertyValue but that expects a ClipboardProperty object which you can’t provide from a regular Property-Set. So your options from my perspective are the following:
Pre load the property in the clipboard somehow or,
Create your own RUF (this has been my preference whenever I encounter this type of use cases)
Hello @AvikG - our use case for making this work was for Production data fixes. So the property will need to exist on the clipboard. If you can instantiate the property, it will work just fine.
@andresm , @RobertH9685 - Thank you for sharing your responses. I was able to get this working, the trick was passing the property context without the pyWorkPage(CaseDetails in my case) during execution, like .Unit instead of CaseDetails.Unit as the property is already initiated via the open-by-handle operation.