- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 08:42 AM
Hello,
The blow business rule script currently trigger on RITM table and successfully creates a new task. However, I'm struggling to redirect it to the newly created record. Could someone please review the code and offer suggestions on how to make this work?
Your assistance would be greatly appreciated.
(function executeRule(current, previous /*null when async*/ ) {
if (current.description == 'software') {
var gr = new GlideRecord('sc_task');
gr.initialize();
gr.request_item = current.sys_id;
gr.short_description = 'New task for software request';
gr.description = 'test';
// Insert the new record and get the sys_id
var newRecordSysId = gr.insert();
if (newRecordSysId) {
gs.addInfoMessage('New task ' +gr.number);
// Redirect to the newly created record
action.setRedirectURL('/sc_task.do?sys_id=' + newRecordSysId);
} else {
gs.addErrorMessage('Failed to create the record.');
}
}
})(current, previous);
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 11:44 AM
@Meera_P Yes, you can create an info message and add the link of your record to it. Here is how you can do it https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0691931

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 11:44 AM
@Meera_P Yes, you can create an info message and add the link of your record to it. Here is how you can do it https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0691931
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 12:15 PM
Your suggestion has been extremely effective. Thanks to your help, we’ve successfully resolved this issue. We truly appreciate your support!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2024 01:00 PM
Your reference is to 'Server Scoped' API documentation, seems to work from server-side code.