I’m using a data transform that receives a property name as parameter. I just need to use a property-set and set a value to this property that I received as parameter. Example:
I received the property “pyWorkpage.pyNote” as parameter and I want to set the value “Test 1” to this property and see it in clipboard.
Yes this can be achieved in a data transform by using a utility function. I am not aware of any OOTB function which sets the value dynamically, but you can create your own. An indicative code snippet is provided below which you may use to set the value.
String pageName = pega_rules_string.whatComesBeforeLast(propertyPath,‘.’); //get the page name
String propertyName = pega_rules_string.whatComesAfterLast(propertyPath,‘.’); //get the property name
//now set the value
tools.findPage(pageName).getProperty(propertyName).setValue(value);
Where propertyPath and value are two string type parameters that can be defined in the function along with tools (PublicAPI) and return a boolean output parameter value as true if the property set is successful or false if it is unsuccessful. Then you can use this function is the data transform.
Please also have error handling in the function such as checking whether the parameter propertyPath is null or not, if not null then whether the page name is passed or not, it not passed where to set the value - primary or step page etc. Also always use try catch in your java code.
just fyi - There is a function RuleManagement • setPropertyValue, which you may consider using based on your requirements in case you dont want to write java code
@DanielN27 You can define the page (on which the property is present) under pages and classes tab in data transform, and use that page to set the value using the Set action.