How to use JSON object in Workflow

Aruna Sree Yela
Tera Guru

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

 

ArunaSreeYela_0-1708092135472.png

 

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

 

11 REPLIES 11

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:

ArunaSreeYela_0-1708415946293.png

If condition:

ArunaSreeYela_1-1708415969001.png

 

Thanks

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