How to trigger scheduled job of get api from ui action in list view

Kumar147
Tera Contributor

Hi,

I am getting records from another instance and storing in custom table using GET Api in scheduled job and set it to run in every 60mins. I want a ui action to be created in list view of custom table so user can click on the button to get the updated records. How can i do that.

 

Thanks in advance

1 ACCEPTED SOLUTION

Medi C
Giga Sage

@Kumar147 

Another possible solution would be to directly have your REST Call on a function on your script include, then you can simply call your function from the UI Action and update the records based on the returned response.


If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.

View solution in original post

13 REPLIES 13

Hi @Kumar147 ,

 

Please update the records on the function on your script include. The function on your script include should do:

  1. Rest CALL
  2. Update Records on your table
  3. Return true if update was successful / false otherwise

 

Then on your UI Action, you could simply check if the returned value is true or false. If it is true, then reload the page, otherwise, display an error message that something went wrong.


If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.

@Kumar147 

you are mixing up the code.

Please do as per suggestion from @Medi C 

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

Hi @Kumar147 

Could you please share the logs? Was the REST Call executed successfully?


If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.

Kumar147
Tera Contributor

Hello @Medi C 

Yes, Call executed and I am getting response.