- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2025 04:26 AM - edited 05-02-2025 05:03 AM
I need to send the RITM number appended link to it as a parameter but before it I am just checking whether its coming as a output or not? I got no luck. What went wrong in ritm_url variable value??
(function execute(inputs, outputs) {
var ritm_url = '<a href=" ' + gs.getProperty('glide.servlet.uri') +inputs['ritmTableName']+'.do?sys_id=' + inputs['ritmSysId'] +'">' + inputs['requestNumber'] + '</a>';
outputs.url = ritm_url;
})(inputs, outputs);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2025 08:58 AM
try this, I could see you are getting the sysId and request number correct
you cannot get the value using this syntax inputs['ritmTableName']
there was an extra space before href
(function execute(inputs, outputs) {
var ritm_url = '<a href="https//' + gs.getProperty("glide.servlet.uri") + '/' + inputs.ritmTableName + '.do?sys_id=' + inputs.ritmSysId + '">' + inputs.requestNumber + '</a>';
outputs.url = ritm_url;
})(inputs, outputs);
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
05-02-2025 10:35 AM
Your anchor tag has two issues:
Extra space in the href
You wrote '<a href=" ' + … which outputs <a href=" https://…">. That leading space breaks the URL.Wrong input key
If inputs['ritmTableName'] isn’t defined, you end up with undefined.do?sys_id=…. Make sure the input name in your Flow Action exactly matches (e.g. inputs.ritmTableName vs inputs.ritm_table_name).
Fixed version (no stray space, correct inputs):
(function execute(inputs, outputs) { // ensure glide.servlet.uri ends with '/' var base = gs.getProperty('glide.servlet.uri'); var table = inputs.ritmTableName; // must match your defined input name var id = inputs.ritmSysId; var num = inputs.requestNumber; var ritm_url = '<a href="' + base + table + '.do?sys_id=' + id + '">' + num + '</a>'; outputs.url = ritm_url; })(inputs, outputs);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2025 05:21 AM
I could see sysId getting replaced correctly
Is the next part not getting reflected correct i.e. number?
share what input you are passing and what came in log for inputs?
try this
(function execute(inputs, outputs) {
var ritm_url = '<a href=" ' + gs.getProperty('glide.servlet.uri') +inputs['ritmTableName']+'.do?sys_id=' + inputs['ritmSysId'] +'">' + inputs.requestNumber + '</a>';
outputs.url = ritm_url;
})(inputs, outputs);
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
05-02-2025 07:18 AM - edited 05-02-2025 08:26 AM
Thanks for reply @Ankur Bawiskar
Please ignore extra inputs as I need them for further rest call to third party.
How it came as out put I have share the pic in main post itself and you can see the inputs and log as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2025 08:58 AM
try this, I could see you are getting the sysId and request number correct
you cannot get the value using this syntax inputs['ritmTableName']
there was an extra space before href
(function execute(inputs, outputs) {
var ritm_url = '<a href="https//' + gs.getProperty("glide.servlet.uri") + '/' + inputs.ritmTableName + '.do?sys_id=' + inputs.ritmSysId + '">' + inputs.requestNumber + '</a>';
outputs.url = ritm_url;
})(inputs, outputs);
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
05-02-2025 09:16 AM - edited 05-02-2025 09:48 AM
@Ankur Bawiskar this is what I am getting even after keeping as it is as you suggested?
When I click on it I am getting as below and when I went to Rendered HTML I am getting RITM number and if I click on it it is navigating to requested Item as expected.
However coming output as above is expected behaviour or we can do anything directly returning as Rendered HTML Content.
Please refer below image for more clarity.