getDisplayValue()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2022 10:58 PM
Hi All,
I have written below script for incident creation through inbound integration. And I am using "getDisplayValue()" to insert the actual Display name from source instance.
But it is not working. Please correct me if I am wrong with this approach.
CRinc.initialize();
CRinc.correlation_id= reqeustJSONParser.id.getDisplayValue();
CRinc.state = reqeustJSONParser.state.getDisplayValue();
CRinc.hold_reason = reqeustJSONParser.hold_reason.getDisplayValue();
CRinc.description = reqeustJSONParser.description.getDisplayValue();
CRinc.short_description = reqeustJSONParser.short_description.getDisplayValue();
CRinc.sys_class_name = reqeustJSONParser.ticket_type.getDisplayValue();
CRinc.category = reqeustJSONParser.category.getDisplayValue();
CRinc.impact = reqeustJSONParser.impact.getDisplayValue();
CRinc.urgency = reqeustJSONParser.urgency.getDisplayValue();
CRinc.priority = reqeustJSONParser.priority.getDisplayValue();
CRinc.subcategory = reqeustJSONParser.subcategory.getDisplayValue();
CRinc.cmdb_ci = reqeustJSONParser.cmdb_ci.getDisplayValue();
CRinc.contact_type = reqeustJSONParser.contact_type.getDisplayValue();
CRinc.assignment_group = reqeustJSONParser.assignment_group.getDisplayValue();
CRinc.close_notes = reqeustJSONParser.close_notes.getDisplayValue();
CRinc.close_code = reqeustJSONParser.close_code.getDisplayValue();
CRinc.work_notes = reqeustJSONParser.work_notes.getDisplayValue();
CRinc.comments = reqeustJSONParser.comments.getDisplayValue();
CRinc.insert();
Please help.
Thanks,
Priya.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2022 02:39 AM
Hi Anurag,
Can you explain me briefly, how can I use this for state field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2022 03:44 AM
How are you processing the incoming request?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-11-2022 01:08 PM
If the display values in the payload are an exact match to your instance and other mandatory field requirements are met for the update (which they must be if setting the numerical value works) then you should be able to use setDisplayValue(‘fieldname’, theValue);
GlideRecord | ServiceNow Developers
Something like this
CRinc.setDisplayValue('state', yourPayLoadName.state);