Introduction:
Time and again we have received the requirement to concatenate two or more strings fields value & store it in a string field in Resco Mobile CRM.
In this blog, will provide a quick walkthrough of the process to achieve this.
Suppose we need to store the Address1 street1, Address1 street2, Address1 street3, Address1 city, State/ Province, Postal code of the Work Order record into a custom field (For Example, ‘Full Address’).
Also, we would need to reflect the changes applied to the above fields (fields that are concatenated) to the ‘Full Address’ field.
Note: As the Work Order Entity doesn’t have Full Address field. We have created a custom field ‘Full Address’.
Steps to concatenate multiple string field values in Resco:
Step 1: In the Resco Woodford project, go to the Work Order entity > Expand it > Click on the Form. Once you click on the Form, the list form will open as shown in the below screenshot;
Step 2: Now select and open the Form and add the custom ‘Full Address’ field on the form as shown in the below screenshot;
Step 3: After adding the ‘Full Address’ field on the form, we need to write a Workflow on change of the address details (msdyn_address1, msdyn_address2, msdyn_address3, etc.) as shown in the below screenshot;
Here, we have highlighted two items that are important parts of concatenating the multiple field’s values in a single string field.
Item# 1: Variable
We added a variable ‘FullAdd’ of type StringList. (StringList type behaves like an array of string in Resco)
Once we have completed with the Variable declaration, the next step is to add the items in this variable as shown in the above screenshot.
In our case, we have added ‘msdyn_address1, msdyn_address2, msdyn_address3’ etc.
After adding all the required fields in the ‘FullAdd’ stringList, the final step is Assigning the value of variables to the field.
Item# 2: Assigning the value of variables to the field.
To assign the value of the variable to the field, we have to select the Entity field, and then click on the button next to the Entity field & select ‘Format’ option.
Now pass the Format string in the ‘format string’ text box as shown in the below screenshot;
Finally, click on ‘Chose Variable’ and select the variable. In our case, the variable is ‘FullAdd’ as shown in the below screenshot;
Note: The format string {0} {1} {2} {3} {4} {5} specify the index of the items added in the ‘FullAdd’ stringList Type variable.
Save and close the Rule and Publish the mobile project.
Now, log into the Resco Mobile App and sync.
Go to the Work Order form. Here you can see the result as the ‘Full Address’ have the value as per the above requirement.
Also, when the user makes any changes in the address fields, the same changes are reflected on the ‘Full Address’ field as shown in the below screenshot;
Conclusion:
By following the steps mentioned above, the user can easily concatenate multiple string field values in a single variable and can set it to any string field in the Resco Woodford mobile Project.