how to use return value of function in another function in script include

Deep13
Tera Contributor

Hi,

I have created a script include which has 3 functions. Two functions return a list (array of sys_id).

I need to use the return value of the 2 functions in the 3rd one for gliding some record.

Can anyone tell me how to use the value of 2 function in 3rd one

Regards,

Deepshikha

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you need to call those 2 functions in 3rd function like this

the syntax of calling function within script include is

this.functionName()

Example below

var GetGroupMembers = Class.create();
GetGroupMembers.prototype = {
	initialize: function() {
	},

	getUsers: function(){

	},
	
	getMembers: function(){
		
	},

	thirdFunction: function(){
		
		var firstArr = this.getUsers();
		var secondArr = this.getMembers();
		// now use these 2 arrays
		
	},
	
	type: 'GetGroupMembers'
};

Regards
Ankur

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

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you need to call those 2 functions in 3rd function like this

the syntax of calling function within script include is

this.functionName()

Example below

var GetGroupMembers = Class.create();
GetGroupMembers.prototype = {
	initialize: function() {
	},

	getUsers: function(){

	},
	
	getMembers: function(){
		
	},

	thirdFunction: function(){
		
		var firstArr = this.getUsers();
		var secondArr = this.getMembers();
		// now use these 2 arrays
		
	},
	
	type: 'GetGroupMembers'
};

Regards
Ankur

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

Thanks!! its helped

Rameshwar Khile
Mega Expert

Hi @Deep 

Use this syntax to call function into script include.

this.functionname();

 

Please mark reply as Helpful/Correct, if applicable. Thanks!

 

regards,

Rameshwar Khile.

@Rameshwar Khile 

Again a repeat

Regards
Ankur

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