How can I set the short_description field from the value of a single line text variable?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
9 hours ago
I am attempting to set the value of the short_description of a sc_req_item from the user input when the RITM is submitted. The value I want to use from the RITM is a single variable and will be used in an email notification.
I have tried to use a BR to set the short_description and have tried a client script as well. I'm still pretty new to ServiceNow and am not familiar with all of the intricacies yet.
Any guidance or pointers would be appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi @MC2006 ,
You can do it using Flow Designer....
// Example inside a Flow Designer script field for short_description:
return current.variables.your_variable_name.toString();
Replace your_variable_name with the actual variable name.....This approach directly places the user input into the short_description.
or Using a Asynchronous Business Rule on sc_req_item
Define a Business Rule (triggered after insert, asynchronous) with:
(function executeRule(current, previous) {
current.short_description = current.variables.your_variable_name.toString();
})(current, previous);
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
If you are using Flow Designer to create task, you can map during create record action in field mapping and use transform functions
You can also use script inside the field mapping to set short description,
If this helped to answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Here are the best approaches to set the short_description of a Request Item from catalog variables:
Business Rule Configuration:
Table: Requested Item [sc_req_item]
When: Before Insert
Advanced: True
Script:
javascript(function executeRule(current, previous) {
// Get the variable value from the RITM
var variableValue = current.variables.your_variable_name; // Replace with your variable name
// Set the short_description
if (variableValue) {
current.short_description = variableValue.toString();
} else {
// Fallback if variable is empty
current.short_description = current.cat_item.name + ' - Request';
}
})(current, previous);
[ Architect | Certified Professional]
Was this response helpful? If so, please mark it as ✅ Helpful and ✅ Accept as Solution to help others find answers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Glad I could help! If this solved your issue, please mark it as ✅ Helpful and ✅ Accept as Solution so others can benefit too.
Chavan A.P. Technical Architect | Certified Professional
[ Architect | Certified Professional]
Was this response helpful? If so, please mark it as ✅ Helpful and ✅ Accept as Solution to help others find answers.