Need help to created dynamic URL in UI action
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2022 01:51 AM
Hi Everyone,
I am creating an URL in a server side UI action and it is working as expected I just need to provide a hyper link on ("click here ") so that when user click then only it should take to the record , as of now record is getting created and automatically redirecting to the created record. Below is the code
var _RCSARecord = new GlideRecord('sn_risk_advanced_rcsa');
_RCSARecord.initialize();
_RCSARecord.u_risk_id = current.sys_id;
_RCSARecord.u_risk_assessment_instance = instance_flag;
_RCSARecord.u_assessor = gs.getUserID();
_RCSARecord.u_state = 'assess';
if (_RCSARecord.insert()) {
var url = "sn_risk_advanced_rcsa.do?sys_id=" + _RCSARecord.sys_id;
action.setRedirectURL(url);
gs.addInfoMessage('RCSA Triggered');
}
Labels:
- Labels:
-
Scripting and Coding
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2022 02:06 AM
Hi Sunil,
Try this
var url = "sn_risk_advanced_rcsa.do?sys_id=" + _RCSARecord.sys_id;
// action.setRedirectURL(url);
var message = 'RCSA Triggered' + ' ' + url + ' ';
gs.addInfoMessage(message);
Thanks!
Sagar Pagar
The world works with ServiceNow
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2022 04:33 AM
Hi Sunil,
If my response helped please mark it as correct and close the thread. It will be helpful for future readers.
Thanks!
Sagar Pagar
The world works with ServiceNow