How to use JSON object in Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 06:50 AM - edited 02-16-2024 06:56 AM
Hi,
There is a Record Producer, after submitting it a record will be created in Case table and there is a field called "JSON Output" which stores data of submitted RP
JSON body looks as below
{
“field1”:{
“original_value”:””,
“changed_value:””,
“field_display_value:””
},
“field2”:{
“original_value”:””,
“changed_value:””,
“field_display_value:””
},
…
}
Now, I wanted to use the data stored in this "JSON Output" field on Workflow. The condition looks like below
Now I wanted to know how to do below 2 things
1. Get JSON data from "JSON Output" field into JSON Object[Action in flow]
2.Here JSON object stores 2fields, so field1 should considered in first if block and I need to write field1!=empty, same for 2nd field.
How can I achieve this.
Guidance is appreciated.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 12:01 AM - edited 02-20-2024 12:02 AM
Hi @Shubham26 ,
I tried it, but that's not working. I hope the run script is not returning anything. We should fix it on run script. Please correct me if I'm wrong.
If we see the below snip, there is no output from run script and that is reflecting on If block.
Runscript:
If condition:
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 01:07 AM
You can print logs from Run Script for each line and check values what you are getting from record, and then what it is assigning in scratch pad variable, and debug it.
To print JSON object value, you can use JSON.stringify() function to check complete JSON object what it is assigning to WF scratchpad variable.
What data type are your using for field u_json_output ?
Thank You.
Regards,
Shubham Gupta