Posted: 15 Feb 2018 5:04 EST Last activity: 12 Mar 2018 9:56 EDT
Need to set the value of a property to another property's value
I need to set the value of a property to another property's value. for example, In the UI user will enter XYZ in one field and 123 in another field. then we have to assign 123 to XYZ and it need to be stored in work table. When workitem is loaded it has to show, XYZ=123 in the clipboard.
If i understand your requirement correctly, you have two fields in UI(field1, field2) and you entered field1="EmpName" and field2="Mahesh". Now on click of button it should create property called .EmpName with value "Mahesh" in the current work object where you entered the field values in UI.
Note: If creation of the property is your requirement based on the user provided values from the UI, then it is not possible as the creation of new property is totally responsible by Engine specific API.
Hi Mahesh, Thank you. Last two steps in Java (provided by you) helped me, I was also writing Java. Thanks Lot again. :) .Instead of last two steps , I have given myStepPage.putString(PropertyToBeSet,PropertyValue);...even this is also working
Hi Mahesh, Is there a way that we check if EmpName exists on the clipboard page (WorkPage)? If it exists, then only we need to set the value of EmpName.
I want to update EmpName for existing work item, so I have done Obj-open-by-handle and open the workitem and saved the workitem details on step page-workpage. So I have to check on WorkPage if the EmpName exists or not.
cbProperty.setValue(propValueHi Mahesh, My exact requirement is mentioned below . You have provided me the code below .
In this example, value of propName is "EmpName". In java code, I am trying to use like getpropertyifexists. I cannot use- Empcode directly , since it is the value of propName. Why I am doing this , Instead of entering EmpName, there is a chance where users can enter like empname or EMPNAME or EMpNAME1 in the field1. it is setting as like EMpName1 = Mahesh. But it should always set EmpName = Mahesh. In our case, in the clipboard page EmpName property exists on the Page, we have to compare the value entered by user in field1 with the clipboard property name. ProperrtyExistsandhasvalue or propertyhas value are not working.
I am bit confused with your requirement could you elaborate it with a sample example so that i can help you further on this issue. By the way empname or EMPNAME can be the same property names but EMpNAME1 is not equal to empname or EMPNAME property name.
Hi Mahesh, here I am providing the example- in user portal, I am providing 3 fields to the users. All fields are text inputs.I have created 3 properties under data-Portal class. first property is - WorkitemID and second property is PropertyName third property is PropertyValue. I have referred these three properties to 3 textinput fields.
Here, when user enter values in the fields, then these values will be under the context of Data-Portal class.
Now first User enters case Id in WorkItem field. By passing WorkItemID value as parameter to Obj-by-Handle method, I have loaded pyWorkPage of that workitem in activity.
User then enters value in PropertyName field, for example EmpName. So for the Property- PropertyName contains value as EmpName.
Then User enter, PropertyValue field, for example Mahesh. So for the Property -PropertyValue contains value as Mahesh.
pyLanding is the default page provided by PEGA for Data-Portal class in this context. So when we open the pyLanding Page, we have properties and their values are like below.
PropertyName = EmpName
PropertyValue = Mahesh
Now , we have to set EmpName = Mahesh on the pyWorkPage of Workitem (not on pyLanding page) and this has been achieved. But, before setting this, we have to check whether EmpName exists as property or not on the pyWorkpage. Here, we may thought to use functions like-Propertyexists or Propertyexistsandhasvalue. If we use this functions, then to this functions I have pass input as "PropertyName " but not "EmpName" since actual property is -PropertyName and its value is EmpName. But in My case, I have to check VALUE of PropertyName exists as a Property on the pyWorkpage but not pyLanding Page. Please let me know if any confusion exists, Thank you.
You don't need to copy the PropertyName value to Parameter and pass that parameter to the function PropertyExists(String), you can directly pass the @PropertyExists(.PropertyName) with step page as pyWorkPage. In this case it will check for the existence of .EmpName property in pyWorkPage as the function will take the value of .PropertyName i.e. EmpName which has been shown in my activity WHEN condition.