How can I set the short_description field from the value of a single line text variable?

MC2006
Kilo Explorer

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.

5 REPLIES 5

kaushal_snow
Mega Sage

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.

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/

Bhuvan
Tera Sage

@MC2006 

 

If you are using Flow Designer to create task, you can map during create record action in field mapping and use transform functions

Bhuvan_0-1757037518942.png

You can also use script inside the field mapping to set short description,

Bhuvan_1-1757037666624.png

If this helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

Chavan AP
Tera Guru
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);
Chavan AP
[ Architect | Certified Professional]

Was this response helpful? If so, please mark it as Helpful and Accept as Solution to help others find answers.

@MC2006 

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

Chavan AP
[ Architect | Certified Professional]

Was this response helpful? If so, please mark it as Helpful and Accept as Solution to help others find answers.