Amazing workaround!! It works perfectly to my requirement 

how to use client script on the reference fields under the change request values field?

Urgent help required:

RitikAnand_0-1741087537372.png
Is there a way to format these below two lines of script in such a way so that it can be added into the conditions field in Business Rule?
Thanks in advance.

var targetName = gs.action.getGlideURI().getMap().get('sysparm_target');
	if (targetName.indexOf('change_request.cmdb_ci') > -1) {

 

I'm not sure what you are asking makes sense, but functionally in JavaScript lines separated by the ; can be placed on a single line but would be interpreted as individual lines of code.  

 

 

var targetName = gs.action.getGlideURI().getMap().get('sysparm_target');
	if (targetName.indexOf('change_request.cmdb_ci') > -1) {

 

is functionally the same as 

 

var targetName = gs.action.getGlideURI().getMap().get('sysparm_target');if (targetName.indexOf('change_request.cmdb_ci') > -1) {

 

but the condition field is not the same field, but is in the same scope, of the script field so would need to use "complete" code in the condition.  However, the targetName variable would be available to the script field.

 

 

javascript:var targetName = gs.action.getGlideURI().getMap().get('sysparm_target');if (targetName.indexOf('change_request.cmdb_ci') > -1) { true }

 

replace the : with a :
it doesn't like the colon lol


if you then say put something like gs.addInfoMessage(targetName) in the script field you would get a message that contained the value of targetName.

I'd really question doing this IN the condition field... not sure the gain.

janlendl
Tera Contributor

It looks like this approach is no longer possible

Standard Change template proposals do not honor reference qualifiers on change_request table fields ...


especially if what you want to edit is part of std_chg_template_val_render