Update Sets should be named uniquely

Aakhiil
Tera Expert

Hi Experts,

I have one requirement like  "When I create a update set that name should be unique. Its not be same as existing update set. if existing and newly created update set is same  need to notify while saving with error popup " Update set name is already in our records so please change the name " 

And Duplicate update sets should be removed or renamed if being used for active development.

I am not sure how to be proceed. Need your assistance on it. Any help will be appreciated. 

Thanks in advance 

1 ACCEPTED SOLUTION

Hi,

you can also make Name field on "sys_update_set" as Unique at dictionary level

BR Script If required

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var gr = new GlideRecord("sys_update_set");
	gr.addQuery("name", current.getValue('name'));
	gr.setLimit(1);
	gr.query();
	if (gr.hasNext()) {
		gs.addErrorMessage("Please give unique update set name.");
		current.setAbortAction(true);
	}

})(current, previous);

regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

6 REPLIES 6

@Krissy 

Can you post a new question and tag me there as this is an old thread?

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Jasraj Reen
Tera Contributor

Hey Ankur Thanks for this script