How to call getPropertyField function to dynamically pick a value
Based on a business rule I am trying to pick a property from customer data class. In order to do so, I am calling getPropertyField function to get the related property's value. It's signature is getPropertyField--(String,String,String,PublicAPI)
and called like this @Utilities.getPropertyField(strClassName,strPropertyName,fieldname,tools).
And this is how I call it; @Utilities.getPropertyField("NBAFW-Data-Customer","SegmentKodu","SegmentKodu",tools), it always returns null. As per documentation function "Returns the value of the named property (fieldname) in the Rule-Obj-Property instance that defines the specified property (strPropertyName) in the named class (strClassName).".
Usage of strPropertyName and fieldname is not clear to me. They sound to be the same thing. I appreciate if somebody can show me the right usage of the funciton or a different way of accesing a property's value.
p.s. Pega 7.2 & Pega Marketing 7.13
***Updated by Moderator: Marissa to update categories***
Do you need the value of the property or the field value??
If you just want to get the value of a property then you can select it from "properties" option on the left like shown in the above figure. Or you can access them with a dot prefix like .propertyName .
If I understand correctly, you will only come to know the property name/field that is holding the acutal value during run time. Now this property name will be part of another property and that has to be resolved to get the value. Is this what you need to accompolish ?
Property name is derived from Proposition Identifier and incoming channel value from REST API, all run-time parameters. I can construct the property name such as "iPhoneSpecialOffer_Internet". I know the name of the class in design time anyway. Thus, all I need is to get the value of e.g. iPhoneSpecialOffer_WEB or Prop1_Branch.
It sounds simple and you might have already tried it but a simple java step does it rt if not an OOTB utility.
In a java step you can get the value of the property using PublicAPI methods like tools.getProperty(<<property_identifier>>).getStringValue(); or if it is inside a page you can get it using page functions like tools.getStepPage() or tools.getPage("<<>>") or getParentPage() etc.
Assign it to a local variable and use it in when condition in next step
I am in Pega Marketing strategy canvas, java steps cannot be applied. I will try to write a function or activity and try to apply the steps you mentioned in there and call it accordingly. Let's see if it is going to work out.
p.s. It is really weird that there is no API available for that in the expression builder...