Updating nested objects using freemarker script

499 views
Skip to first unread message

lto...@gmail.com

unread,
Aug 22, 2018, 5:58:53 PM8/22/18
to Fujitsu RunMyProcess Developer Community
Hello,
I am trying to run the script to update a nested object inside a collection

My object looks like this:

{
"project_code":"VC-2222",
"project_product":"ENGINE WATER PUMP",
"phaseList":[
{
"phase":"DR20",
"phase_progress":"0",
"phase_target_date":"30/09/2018",
"phaseId":1,
"taskList":[
{
"task":"Kick-Off Meeting",
"responsible":"Sales",
"task_target_date":"",
},
{
"task":"Rank Setting",
"responsible":"Sales",
"task_target_date":"",
}
]
}
]
}


I need to update, for example, the fields "responsible" that are inside each taskList nested array.

I tried to use something like

${update_field( project_pattern, {"phaseList[0].taskList[0].responsible":{"responsible":"Luiz Tomaz"}}, "projects", "false" )}

But it created a new array at the end of the object instead of update the responsible field from first "taskList"

What Am I doing wrong?
Could you provide some examples?

Thanks in advance
Luiz Tomaz


Prachi Chandak

unread,
Aug 23, 2018, 2:16:03 AM8/23/18
to Fujitsu RunMyProcess Developer Community, lto...@gmail.com
Hi Luiz,

I have found out a support ticket request with Case id: 3929 (https://eu7.salesforce.com/5000J00001NnVee) on Salesforce Support portal with same issue report.
Thus, I am closing this thread from the Support forum (Case id : [supportforum:13217] ) and our team will continue to assist you on Salesforce Portal (https://login.salesforce.com/).

We are happy to assist at any time. Please feel free to ask any query.

Thanks & Regards,
Prachi Chandak
Fujitsu RunMyProcess Support



--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "Fujitsu RunMyProcess Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum+unsubscribe@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.
To view this discussion on the web visit https://groups.google.com/a/runmyprocess.com/d/msgid/supportforum/ba526144-999b-4e4a-9382-14f138e16956%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/d/optout.

lto...@gmail.com

unread,
Aug 23, 2018, 5:01:45 PM8/23/18
to Fujitsu RunMyProcess Developer Community, lto...@gmail.com

-----------------------

Dear Pranchi

I think there is a misunderstand. I never opened a thread on Sales Force because I don't have an account on Sales Force. I received an invite to join today but there is no password and the recovery e-mail never arrived. So, I kindly ask you to please, keep the topic opened everywhere. I understand your concern to avoid duplicated questions on different platforms but the issue itself is more important at this moment.
In case support team confirm there is a limitation to retrieve/update data when using nested arrays on a collection, with no workaround using Freemarker, we are in trouble because most of our system's functions were designed to work this way and there will be not time to change it without cause an impact on delivery date to customer.

Best Regards,
Luiz Tomaz

stor...@gmail.com

unread,
Aug 24, 2018, 2:32:45 AM8/24/18
to Fujitsu RunMyProcess Developer Community, lto...@gmail.com
Hi there.

I've done some work with jsons and freemarker, there's a method available for it:
https://docs.runmyprocess.com/API_Reference/FM/Utilities.html#P_json_put

Since phaseList and taskList are arrays, you may need to enter them specifically, but if all of them should have the same value then it gets a little easier:

<#list phaseList as phase>
<#list phase.taskList as task>
<#assign task = P_json_put(task, "responsible", "Luiz Tomaz") >
</#list>
</#list>


I have not tested the above, but I hope you can understand how it should work from it.

Good Luck!
Svensson, Peter

Pankaj Kumar

unread,
Aug 24, 2018, 12:19:08 PM8/24/18
to Fujitsu RunMyProcess Developer Community
Hi Luiz,

We are keeping this thread open and we will update you soon on this.

Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support


--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "Fujitsu RunMyProcess Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.

To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.

lto...@gmail.com

unread,
Aug 27, 2018, 5:05:46 PM8/27/18
to Fujitsu RunMyProcess Developer Community, lto...@gmail.com
Hello,

I could solve this issue working with Array index + positional $ operator.
It worked fine and now I can updated an specific field in a collection even if the field is inside a nested array (2nd or 3rd level)
You can close the topic.

Regards,
Luiz Tomaz

Reply all
Reply to author
Forward
0 new messages