how GLIDEURL will work

Madankumar N1
Tera Contributor

we have one ui action to create change request under standard template when we click on that one it redirecting to empty page

in ui action GLIDEURL used

3 REPLIES 3

Community Alums
Not applicable

Hi Madan Kumar,

 

Please refer to this community link. It has a proper description with example:

https://community.servicenow.com/community?id=community_question&sys_id=889ecb21dbdcdbc01dcaf3231f96...

 

Please mark as correct and help close this thread if this solves your query.

Thanks

DR

Madankumar N1
Tera Contributor

var stdChangeRecordProd = new GlideURL('std_change_processor.do');
stdChangeRecordProd.set('sysparm_id', current.getUniqueValue());
stdChangeRecordProd.set('sysparm_action', 'execute_producer');
stdChangeRecordProd.set('sysparm_catalog',current.sc_catalogs);
action.setNoPop(true);
action.setRedirectURL(stdChangeRecordProd.toString());

above is my code how set function will work and processor

Community Alums
Not applicable

As you have just created the change request, is it fetching value for "current.getUniqueValue())"? Please use a log statement to print "stdChangeRecordProd.toString()" and check the outcome.

The OOB incident module uses this ui action to redirect after change creation:

https://YOUR_INSTANCE.service-now.com/sys_ui_action.do?sys_id=30c9566dc61122740030e173564c1c74&sysparm_record_target=sys_ui_action&sysparm...

This is the script used to get a redirect URL:

(function(current, previous, gs, action) {
	var changeRequest = ChangeRequest.newNormal();
	changeRequest.setValue("short_description", current.short_description);
	changeRequest.setValue("description", current.description);
	changeRequest.setValue("cmdb_ci", current.cmdb_ci);
	if (changeRequest.hasValidChoice('priority', current.priority))
		changeRequest.setValue("priority", current.priority);
	changeRequest.setValue("sys_domain", current.sys_domain);
	changeRequest.setValue("company", current.company);
	changeRequest.insert();

	current.rfc = changeRequest.getGlideRecord().getUniqueValue();
	current.update();
	var incUrl = "<a href='" + current.getLink(true) + "'>" + current.getDisplayValue() + "</a>";
	gs.addInfoMessage(gs.getMessage("Normal Change {0} created from {1}", [changeRequest.getValue("number"), incUrl]));
	action.setRedirectURL(changeRequest.getGlideRecord());
	action.setReturnURL(current);

})(current, previous, gs, action);