getproperty for catalog client script

Shiva40
Kilo Expert

I have some catalog client scripts that use Hard coded sys ids of groups to compare Assignment Groups on Tasks .

How do I replace them with system properties.

1 ACCEPTED SOLUTION

Pranesh072
Mega Sage
Mega Sage

you can use getproperty in the script include and use call glideajax from catalog client script 

View solution in original post

4 REPLIES 4

Pranesh072
Mega Sage
Mega Sage

you can use getproperty in the script include and use call glideajax from catalog client script 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Shiva,

you will have to use GlideAjax and call script include function and return the property value from it

Script Include: It should be client callable

var checkRecords = Class.create();
checkRecords.prototype = Object.extendsObject(AbstractAjaxProcessor, {

	checkRecordPresent: function(){
		return gs.getProperty('property_name'); // name of property here
	},

	type: 'checkRecords'
});

Client Script:

var ga = new GlideAjax('checkRecords');
ga.addParam('sysparm_name', "checkRecordPresent");
ga.getXMLAnswer(function(answer){
	if(answer != ''){
		var groupSysId = answer;
		// now use this to compare
	}
});

Regards
Ankur

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

@Shiva 

Hope you are doing good.

Did my reply answer your question?

If so, please mark appropriate response as correct & helpful so that the question will appear as resolved for others who may have a similar question in the future.

If not, please let us know if you need some more assistance.

Thanks!
Ankur

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

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,

I always use getMessage in client script. 


Thanks,
Ashutosh