- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 04:28 AM
Hello all,
Using a scripted REST API, a catalog item request will be created.
The customer enters a URL along with some parameters in a variable.
So, I have configured a rest outbound message and calling that from business rule before task closure.
Now, the customer is saying that he will change the Base URL every time he creates a request in service-now and we need to hit that URL.
So, we cannot use rest outbound message here.
So, can someone tell me how to hit the dynamic URL every time we receive it in a catalog item variable??
What script we need to write?
Regards,
Lucky
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2025 09:03 PM
you can set the endpoint using RESTMessageV2 this function setEndpoint(), don't configure endpoint there in REST Message or whatever you give it will pick based on what you pass in this method in script
RESTMessageV2 - Scoped, Global
OR Best Way
1) Don't use REST Message and don't create REST Message, you can still consume the endpoint and send request without creating a REST Message in system using Recordless REST Message
2) check this link
Recordless RESTMessageV2 example
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 11:29 PM
Hello @Lucky1
See this is the endpoint , since you said your URL is dynamic.
This is Query Parameters - (Just click on Auto Generate variables in related link to generate this)
This is the "Preview Script usage" where I said you can pass the value of URL which you get from the catalog item.
I hope now everything is clear. Kindly mark my solution as helpful and accept solution if that helped you. This will help me be recognized for my efforts put on this platform and also benefit future readers.
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 11:35 PM
haha.
Yes, everything is clear now.
I was confused because previously you said something like, "sn_ws.setParameter('endpoint',.....) and
In the endpoint just pass this https://<sitename.com> (if there is something common) and append it with
${endpoint}
I thought what is this site name and how dollar endpoint map the value to sitename dynamically.
Thanks a lot Shivalika for your time.
I will mark this correct answer once I tried in my official instance.
Thank you once again.
Regards,
Lucky
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2025 12:52 AM
Hello @Lucky1
Did you check this one still ?
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2025 08:52 PM
Hello @Lucky1
Please confirm if you checked my answer. Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for my efforts and also it can move from unsolved bucket to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2025 09:03 PM
you can set the endpoint using RESTMessageV2 this function setEndpoint(), don't configure endpoint there in REST Message or whatever you give it will pick based on what you pass in this method in script
RESTMessageV2 - Scoped, Global
OR Best Way
1) Don't use REST Message and don't create REST Message, you can still consume the endpoint and send request without creating a REST Message in system using Recordless REST Message
2) check this link
Recordless RESTMessageV2 example
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader