Need help to created dynamic URL in UI action

sunil7
Giga Expert

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');
       
    }

 

 

 

2 REPLIES 2

Sagar Pagar
Tera Patron

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

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