Pass the JSON payload as inputs to a flow

Lucky1
Tera Guru

Hello all,

 

I have created a scripted REST API, and in it, I have written a code like this,

var reqbody = request.body.dataString();

var parsedData = JSON.parse(reqbody);

 

try{

var inputs = {

"start_date" : parsedData.start_date.toString(),

"end_date" : parsedData.end_date.toString(),

"short_description" : parsedData.short_description.toString()

};

}

 

So, here now, I need to create these below steps: 

1. I need a create a flow using flow designer, where I need to create a change request from the inputs of the above scripted REST API, Hence, I need to call the flow from the Scripted REST API itself and pass the inputs to create the CR.

 

2. After a CR has been created, then I need to validate change conflicts where the conflicts are currently returning from a script include, 

If the script include returns like conflict detected, then I need to return the conflict type to the customer.

 

3 rd point I will try once I got to know how to achieve the above two points.

 

So, can someone please help me step by step how to do this?

 

 

Thanks a lot

 

 

 

Regards,

Lucky

 

10 REPLIES 10

@Lucky1 

if you are getting the change sysId in script then are you using correct table to query and correct field?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader