- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 11:50 AM
Hello ,
I am looking to call Rest Message (outbound api) from workflow,i want to use Run Script and pass user from catalog item to the rest message in query parameter.
Actually i am looking to use POST rest message api and pass parameter from workflow or if you have any any other simple solution would be welcome.
am using workflow because i have some condition like sending notification after success(200) message or update ritm if not successful.
i saw some suggestions like using only client script calling script include but i am not sure how it would work for other conditions like sending notification because i am good at coding if its possible let me know i am looking for urgent solution.
Thanks in advance.
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 12:05 PM
Hi Dashing,
The best practice is to use Run script activity to achieve this
Step 1: create a script include to initiate POST rest call and return the response
Step 2: create a run script activity in catalog item workflow, call the created script include
something like this by passing your current object, so that you can access and send variable values in the payload
var a = new scriptinclude().integration(current);
step 3: In the same run script activity, Write validations for returned value from script include stored in var a
something like
if (a == 200){
activity.result = 'success', //configure the output in conditions
current.work_notes = 'success';
}
if(a == 400){
activity.result = 'failure';
current.work_notes = 'failed';
}
Please mark helpful/correct if this helped
Thank you,
Vikram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-02-2020 02:43 PM
Yes, we can do that but its a best practice to call a script include
Using Script includes provides these benefits
1. Is powerful enough to handle huge load of JavaScript compared to Run script activity
2. Easy to debug and reconfigure instead of checking out the workflow every time
3. Single point of database, no need to anywhere in the instance to test and understand implemented process
4. Other than integration, you can include some more reusable methods to perform operations on Server side scripts
5. Can be called at multiple modules not just dedicated to one activity
Thank you,
Vikram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2020 10:20 AM
thank you soo much for your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2021 07:28 AM
I have this in a run script, what did your final If statements look like? I am trying to create an INC when it fails in the workflow.