…thoughts on ServiceNow and digital transformation

Post

ServiceNow Record Producer Client Scripts Populate Variables from URL parameters


Client script for record producers displayed in the backend

function onLoad() {
   
	var recordSysId = getParmVal('sysparm_recordsysid');
  	g_form.setValue('parent',recordSysId);

}
function getParmVal(name){
    var url = document.URL.parseQuery();
    if(url[name]){
        return decodeURI(url[name]);
    }
    else{
        return;
    }
}

UI action to call the record producer

action.setRedirectURL('/com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=[sys_id of record producer]&sysparm_recordsysid=' + current.getUniqueValue());

Client script for record producers displayed in the portal

function onLoad() {
    //get the record sys_id from the URL parameter
    var url = new URLSearchParams(this.location.href);
    var recordSysId = url.get('sysparm_recordsysid');
    g_form.setValue('parent', recordSysId);


   
    }