REST Message via Flow Designer Action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 02:23 AM
Hello Developers,
I'm trying OUTBOUND integration from Flow Designer.
I have created a custom action.
I want to fetch the partner ticket from the response received & store on correlation ID on my Instance.
Below is my script, But unsuccessful.
Please suggest
outputs.correlation_id = responseBody.result.u_partner_ticket_id;
(function execute(inputs, outputs) {
if(inputs.status_code == '201'){
var group = inputs.u_shr_assignment_group.getDisplayValue() + ',' + inputs.u_shr_priority + ',' + inputs.u_shr_company;
var responseBody = JSON.parse(inputs.response_body);
outputs.correlation_id = responseBody.result.u_partner_ticket_id;
outputs.description = group;
}
})(inputs, outputs);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 02:39 AM
Hi @Naveen87,
From the screenshot, it seems like the value of the key 'u_partner_ticket_id' is empty. Have you tried an input that has a value of the same key?
If it still not working, what is the data type of the 'response_body' input?
Can you also share the actual text (not a screenshot) of the object you shared above?
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 03:15 AM
Thank you. That makes sense.
I tried with u_number & it is returning the value.
u_partner_ticket_id will hold the incident number of other instance.
It's not returning the value because assignment_group is passing the sys_id.
It should pass the display value.
I tried below but still the same. Can you please suggest where to use getDisplayValue();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 03:23 AM
It worked.
I dot-walked till Name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-25-2024 03:12 AM
Hi @Naveen87 ,
Your code almost seems fine try the below code :
(function execute(inputs, outputs) {
try {
if (inputs.status_code == '201') {
var responseBody = JSON.parse(inputs.response_body);
if (responseBody.result && responseBody.result.u_partner_ticket_id) {
outputs.correlation_id = responseBody.result.u_partner_ticket_id;
outputs.description = inputs.u_shr_assignment_group.getDisplayValue() + ',' + inputs.u_shr_priority + ',' + inputs.u_shr_company;
} else {
gs.error("Response body does not contain the expected structure or field");
}
} else {
gs.error("Unexpected status code received: " + inputs.status_code);
}
} catch (e) {
gs.error("An error occurred: " + e);
}
})(inputs, outputs);
I hope it works...
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....