Update template value of standard change model

kmickael
Tera Guru

Hi, 

 

Following a reorganization, we need to update the template values ​​for standard change templates. This is the group value. The problem is how to identify the templates of the model concerned: I can't get the information with a report. because it is a value in a template_value

 

Capture d’écran_5-6-2024_113222_klesianp.service-now.com.jpeg

 

 

 

var versionGR = new GlideRecord('std_change_producer_version');
	versionGR.addEncodedQuery("std_change_producer=" + stdChgRP.sys_id);
	versionGR.setLimit(1);
	versionGR.orderByDesc('version');
	versionGR.query();

	if (versionGR.next()){

		var str = versionGR.std_change_proposal.template_value;
}

 

 

 

I don't know how I can filter in the string to retrieve only the records whose group matches a certain value.

str value exemple: "short_description=azazafaaddad"^assignment_group=azazafaaddad"^justification=sfdgdhgdgsgf"^EQ";

 

thank you 

 

 

1 REPLY 1

Mark Manders
Mega Patron

You can query them from the standard change proposal table (std_change_proposal) (the last proposal will probably be the current template). Since you will need to update the proposals to get the new templates, you will need to be there anyway.

The field you need to query is the 'template_value' field, where you can check on something like template_value CONTAINS 'assignment_group=azazafaaddad' (where this is the sys_id, of course).


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark