Check formatter field values in servicenow. I have Ritm with variables section
- User
Check formatter field values in servicenow. I have Ritm with variables section
- Assistant
Check formatter field values in servicenow. I have Ritm with variables section
To check formatter field values in ServiceNow, especially for a Requested Item (RITM) with associated variables (which are commonly part of a Catalog Item in the Service Catalog), you can take several approaches depending on what you are trying to achieve: viewing these details in the platform UI or querying them via script for automation, reporting, or integration purposes. Here's a basic guide to get you started:
Navigating to the RITM: In the ServiceNow platform, navigate to the Service Catalog > Requests module. Find and open the specific Request (REQ) record that contains your RITM.
Accessing the RITM: Within the Request, there's a section or related list for Requested Items (RITMs). Click to open the RITM that you're interested in.
Viewing Variables: There are a couple of ways variables might be displayed in a RITM record:
If you're working on a script, such as in a Business Rule, Script Include, or a client script, and you want to programmatically access variable values for a RITM, you can use the Service Catalog Variable API.
// Assuming 'current' is the GlideRecord of the RITM you're working with.
var ritmSysId = current.sys_id.toString();
// Get all the variables and their values for this RITM
var vars = new GlideRecord('sc_item_option_mtom');
vars.addQuery('request_item', ritmSysId);
vars.query();
while(vars.next()) {
// 'sc_item_option' holds the actual variable
var varRecord = vars.sc_item_option.getRefRecord();
// Log variable name and value - you might use or process these values differently depending on your needs
gs.info('Variable Name: ' + varRecord.variable_name + ' Value: ' + varRecord.value);
}
This script iterates over the variables associated with a particular RITM, accessing both the variable name and its value. Keep in mind that for choice variables like select boxes, dropdowns, or reference fields, the value property might store a sys_id or key value which you may need to translate to a display value depending on your use case.
This guide provides a starting point, but for more complex needs or specific implementations, refer to the ServiceNow documentation, which offers comprehensive guidance on working with Service Catalog variables and formatters.