- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2018 12:36 AM
Dear all,
I have initially a REST API Post operation to Jira Service Desk which is running on Incident record Insert operation.
That works actually correctly.
Now the question I have is does the REST APi call can be executed from a UI Action ?
regarsd
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2018 12:46 AM
Yes, you can call it from UI action
Rest/Soap APIs can be called from any server side [Business rule, UI Action etc]
Ex:
We have configured an integration using SOAP message and used an third part "Oracle" Endpoint
Our requirement was whenever you hit on "UI Action button - Submit to Oracle" the integration should trigger
so we have called the soap message where you could ready script from soap message Related link [Preview script usage]
Mark the answer as correct and helpful if it helped you..!!!
Regards,
Chalan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2018 01:31 AM
You will need to add a flag field on the form and set it as false or No by default.
Once REST API code is executed set this flag to true or Yes whichever value suits you.
current.u_flag = 'true'; //Last line of UI action.
On your UI action add this as condition so the button is only displayed when the flag is false
current.u_flag == 'false'
This will ensure that once the button is clicked and form is refreshed, the UI action would get hidden.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2018 01:48 AM
Thanks,
I still have strange issue.
Once I click on my UI Action button which send the incident to JIra, I am able to get back the created jira record Id.
Then I need to update a read only field with that Id on teh current record I was sending
for that I have run following code snipet
var rec = new GlideRecord('incident'); rec.addQuery('sys_id','==',curid);
rec.query();
while (rec.next()) {
gs.info('CAL INCIDENT NUMBER: ' + rec.number);
rec.u_jira_key=JiraIssueKey;
rec.update();
}
I try to get from incident table the sys_id field corresponding to my current.sys_id but seems it does not return anything because my second gs.info log is not present in log table
Did I miss something on getting that update done correctly ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2018 02:15 AM
rec.addQuery('sys_id','==',curid);
rec.addQuery('sys_id',curid); this line compare the sys_id of incident with curid
Could you please keep a log and check what are you getting in "curid"
Mark the answer as correct and helpful if it helped ..!!
Regards,
Chalan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2018 02:18 AM
in log I get teh current sys id from curid

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-12-2018 02:20 AM
rec.addQuery('sys_id',curid)
After adding the above line ..didn't work ??