- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2025 11:47 PM
I’m working with ServiceBridge in ServiceNow and need to pass catalog item variables from the RITM (Requested Item) down to the generated Provider Task.
Has anyone implemented this before? Specifically:
- What’s the best approach to automatically transfer RITM variables into Provider Task fields?
- Can this be achieved via flow designer/business rule, or does ServiceBridge have an OOTB mapping for this?
- Any sample script or configuration guidance would be really helpful.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2025 07:28 AM
Hi @AsenAliG ,
Can you please try this below script. This is from a similar scenario I faced on one of my project.
If the script worked, you can create a custom Action/Business rule out of it.
var current = new GlideRecord("sc_req_item");
current.addQuery("sys_id", "<<SYSID>>");
current.query();
if (current.next()) {
var getRITMVars = new GlideRecord('sc_item_option_mtom');
getRITMVars.addQuery('request_item', current.getUniqueValue());
getRITMVars.query();
while (getRITMVars.next()) {
var getProTask = new GlideRecord('sn_sb_con_provider_task');
getProTask.addQuery('parent', current.getUniqueValue());
getProTask.query();
if (getProTask.next()) {
setVar = new GlideRecord('question_answer');
setVar.initialize();
setVar.table_name = getProTask.getTableName();
setVar.table_sys_id = getProTask.getUniqueValue();
setVar.question = getRITMVars.sc_item_option.item_option_new;
setVar.order = getRITMVars.sc_item_option.order;
setVar.value = getRITMVars.sc_item_option.value;
setVar.insert();
}
}
}
Please Mark my answer as Helpful so that others from the community can benefit from this.
Thanks,
Afrith
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2025 07:28 AM
Hi @AsenAliG ,
Can you please try this below script. This is from a similar scenario I faced on one of my project.
If the script worked, you can create a custom Action/Business rule out of it.
var current = new GlideRecord("sc_req_item");
current.addQuery("sys_id", "<<SYSID>>");
current.query();
if (current.next()) {
var getRITMVars = new GlideRecord('sc_item_option_mtom');
getRITMVars.addQuery('request_item', current.getUniqueValue());
getRITMVars.query();
while (getRITMVars.next()) {
var getProTask = new GlideRecord('sn_sb_con_provider_task');
getProTask.addQuery('parent', current.getUniqueValue());
getProTask.query();
if (getProTask.next()) {
setVar = new GlideRecord('question_answer');
setVar.initialize();
setVar.table_name = getProTask.getTableName();
setVar.table_sys_id = getProTask.getUniqueValue();
setVar.question = getRITMVars.sc_item_option.item_option_new;
setVar.order = getRITMVars.sc_item_option.order;
setVar.value = getRITMVars.sc_item_option.value;
setVar.insert();
}
}
}
Please Mark my answer as Helpful so that others from the community can benefit from this.
Thanks,
Afrith
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2025 05:38 PM
Hi @AsenAliG ,
The best approach is to use ServiceNow Workflows or Flow Designer to create an automated process that reads RITM variables and writes their values to the corresponding fields in the Provider Task. This typically involves configuring an activity in the workflow or a step in Flow Designer that maps variables from the RITM to the fields on the task record, ensuring data consistency and reducing manual effort.
Using Workflows
1. Create a Workflow: Go to the workflow editor and find or create the workflow associated with the catalog item that generates the Provider Tasks.
2. Add a Run Script or Activity:
- Run Script: Within the workflow, add a "Run Script" activity where you can write a small piece of code (often using GlideRecord) to copy variable values.
- Use an Activity: For certain scenarios, there might be specific workflow activities designed for variable manipulation or copying.
3. Map Variables:
- Use the current.variables.<variable_name> syntax to access the value of a RITM variable.
- Use task.field_name = current.variables.<variable_name> to set the value of a field on the Provider Task.
- Make sure the Provider Task is the current record within the script's context or that you have a reference to it.
4. Ensure Variable Availability: Use the "Set Active" or "Set Parameters" features for your script activity to make the desired RITM variables available for use within your script.
Using Flow Designer:
- Trigger the Flow: Set up a trigger for your flow, such as when a RITM is created or updated.
- Add a Data Action: Insert a "Create Record" or "Update Record" action to create or modify the Provider Task.
- Map RITM Variables to Task Fields: Within the action, use the "Drag and drop" functionality to map the variables directly from the RITM to the corresponding fields on the Provider Task.
Key Considerations:
- Context is Crucial: Ensure your script or flow correctly identifies the RITM and the associated Provider Task(s) to avoid data transfer errors.
- Variable Naming: Pay close attention to the exact names of your RITM variables and the target fields on the Provider Task, as these must match precisely.
- Automation: The goal is to automate this process, so review the RITM and Provider Task workflows to integrate this data transfer seamlessly.
- ServiceNow Best Practices: Always check the ServiceNow documentation for the most up-to-date and efficient methods for variable manipulation and workflow automation.
If you found my response helpful, could you please mark it as ‘Accept as Solution’ and ‘Helpful’? This small action goes a long way in helping other community members find the right answers more easily and supports the community.
