Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

List class available methods

Community Alums
Not applicable

Hi!

If someone has it, could someone share code that I can use in a background script that will list all the available methods for a given class? I know this existed but I can't seem to find it.

I really appreciate it.

Thanks!.

1 ACCEPTED SOLUTION

It works for me i just ran a quick background script.

Try this:

/*

Get properties of classes:
GlideSchedule

GlideScheduleDateTime

GlideScheduleDateTimeSpan

GlideScheduleTimeMap

*/

var s = new GlideScheduleDateTime();

_list("GlideSchedule", new GlideSchedule());

_list("GlideScheduleDateTime", new GlideScheduleDateTime());

_list("GlideScheduleDateTimeSpan",new GlideScheduleDateTimeSpan(s,s));

_list("GlideScheduleTimeMap", new GlideScheduleTimeMap());

function _list(c,g) {

var a = [];

for (p in g) {

a.push(p);
}

gs.print("\n\nSORTED PROPERTIES OF CLASS: "+c+"\n");

a.sort();

for (i=0; i<a.length; i++) {

gs.print(a[i]);

}

}


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

View solution in original post

3 REPLIES 3

Prateek kumar
Mega Sage

Check this out, may this could give you some lead

https://community.servicenow.com/community?id=community_question&sys_id=cf4d8fa9db9cdbc01dcaf3231f9619f9


Please mark my response as correct and helpful if it helped solved your question.
-Thanks

Community Alums
Not applicable

Hi Prateek,

 

Thank you for the quick reply.  I did check out the article you provided.  Unfortunately, the code listed towards the bottom of the discussion did not work for me.  

 

Thanks,

Mike

 

It works for me i just ran a quick background script.

Try this:

/*

Get properties of classes:
GlideSchedule

GlideScheduleDateTime

GlideScheduleDateTimeSpan

GlideScheduleTimeMap

*/

var s = new GlideScheduleDateTime();

_list("GlideSchedule", new GlideSchedule());

_list("GlideScheduleDateTime", new GlideScheduleDateTime());

_list("GlideScheduleDateTimeSpan",new GlideScheduleDateTimeSpan(s,s));

_list("GlideScheduleTimeMap", new GlideScheduleTimeMap());

function _list(c,g) {

var a = [];

for (p in g) {

a.push(p);
}

gs.print("\n\nSORTED PROPERTIES OF CLASS: "+c+"\n");

a.sort();

for (i=0; i<a.length; i++) {

gs.print(a[i]);

}

}


Please mark my response as correct and helpful if it helped solved your question.
-Thanks