- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2020 11:55 AM
Hi I have following requirements on service now Incident table
1.I need to get the records based on the caller field(I could able to get using created by filed but not with caller)
var gr=new GlideRecord('incident');
//gr.orderByDesc('sys_updated_on');
gr.addQuery('sys_created_by',name);
gr.query();
while(gr.next()){
var count= gr.getRowCount();
inc.push({
'Number':gr.number+'',
'state':gr.state.getDisplayValue()+'',
'short_description':gr.short_description+'',
'assignment_group':gr.assignment_group+'',
'priority':gr.priority.getDisplayValue()+'',
'created By':gr.sys_created_by
2.How can I updated the created by filed ,actually its always taking instance holder name for this filed(from my application I am trying to pass the different created by name in the payload of this api)
3. How can i return entire row from the incident table based on the passed incident number,
Regards,
Phalguna.
Solved! Go to Solution.
- Labels:
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2020 08:58 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2020 12:28 PM
Hello Phalguna,
1. Replace gr.addQuery('sys_created_by',name); with gr.addQuery('caller_id.user_name',name);
3. Sample CURL code
curl "https://YOURINSTANCENAME.service-now.com/api/now/table/incident?sysparm_query=number%3DINC0009005&sysparm_limit=1" \ --request GET \ --header "Accept:application/json" \ --user 'admin':'admin'
https://developer.servicenow.com/dev.do#!/learn/learning-plans/orlando/technology_partner_program/ap...
- Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2020 08:58 AM
Thanks a lot,its working .

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2020 09:33 AM
You are very welcome Phalguna.