sys_id error in GlideRecord

Mike Pottorf
Tera Contributor

Hello,

I am working on a script to pass information from a catalog item to CI.   I have written a script and am in the process of rebuilding it to log values at various steps to see where it is not working.   In the following script I am logging the values of two variables that were assigned value from the first GlideRecord and then I am trying to display the sys_id, or any value within the record, only to get null as the return for the entry.   I know both GlideRecords are working as the values for tempName and tempQuestion are displaying correctly and there is the expected number of logs for the returned values of grCI, they are just returning null as the value.   Here is the script that I have written:

find_real_file.png

I have tried dot-walking, grCI.sys_id or grCI.name, with the same results.   If anyone could point me in the right direction it would be greatly appreciated.

Thanks,

Mike

1 ACCEPTED SOLUTION

coryseering
ServiceNow Employee
ServiceNow Employee

Hi Michael,



Your grCI query has a typo.



var grCI = new GlideRecord('cmdb_ci_group');


grCI.addQuery('u_catalog_cariable_name', tempName);


grCI.addQuery('u_catalog_variable_question', tempQuestion);


grCI.query();




You never issue the query. You need to add parenthesis to the call.


View solution in original post

3 REPLIES 3

cwilkerbb
Giga Expert

You can always try just doing   gs.log(grCI.sys_id + ' Glide');   On a side note, you can also set the "Source" of the log by doing gs.log("gr sysid: " + grCI.sys_id, 'Glide');



-Chris


coryseering
ServiceNow Employee
ServiceNow Employee

Hi Michael,



Your grCI query has a typo.



var grCI = new GlideRecord('cmdb_ci_group');


grCI.addQuery('u_catalog_cariable_name', tempName);


grCI.addQuery('u_catalog_variable_question', tempQuestion);


grCI.query();




You never issue the query. You need to add parenthesis to the call.


Hi Cory,



That would be it.   Thanks for your help, I appreciate it.



Mike