- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2020 02:48 AM
Is it possible to substitute variable to endpoint for Rest Message? I need to pass sys_id of attachment into Delete HTTP method. I have something like this:
and in my script include and I have this:
deleteAttachment: function (helloAttachmentSysID) {
var request = new sn_ws.RESTMessageV2('hello eBonding', 'Delete Attachment');
request.setStringParameter("sys_id", helloAttachmentSysID);
var response = request.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
}
and of course in the business rule I am passing sys_id into deleteAttachment(helloAttachmentSysID);
but I cant seem to know how to pass it into that endpoint that current sys_id? what am I doing wrong?
I know I can do something like
var endpoint = 'attachment/sys_id/endpoint/' + current.sys_id;
request.setEnpoint(enpoint); but I do not want to overwrite that...and would like to use the feature of substituting.
How do I achieve this?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2020 03:46 AM
Hi John,
You're missing the $ which allows for substitution
Your actual script is fine, it's just the endpoint missing the $ which is meaning your variable isn't being correctly substituted.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2020 03:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2020 03:50 AM
Thanks, I must have missed it when I was copying...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2020 03:51 AM
ha not a problem! just needed a fresh pair of eyes to see it 😉
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-02-2020 03:52 AM
Exactly!