Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

About setting additional comments for record producers

shibasou
Kilo Sage

Hi.

 

In the past, I created a script that automatically added the value of a variable as an additional comment when a case was filed.

I tried to create a script with the same requirements after a long time, but I forgot it...

 

Can someone please help me create a script?

Thank you.

1 ACCEPTED SOLUTION

Nick Parsons
Mega Sage

Your record producer script is quite close, you just have a typo, you have written curent when it should actually be current. There is also no need for the line var comments; as this variable is not being used. 

 

On a side note, your newline characters should written using \n not /n.

View solution in original post

4 REPLIES 4

Deepak Shaerma
Kilo Sage
Kilo Sage

Hi @shibasou 

Use insert business rule,  simple script for copying variable value into additional comment--->

var theVariableValue = current.your_variable_name.toString(); 
    
    // Check if the variable has value
    if (theVariableValue) {
        // Adding the variable’s value as an additional comment
        current.comments = "Additional Comment: " + theVariableValue;
    }

Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning ‌‌
Thanks & Regards 
Deepak Sharma 


Community Alums
Not applicable

Hi @shibasou ,

You can refer below script for reference 

var additionalCommentRP = workflow.scratchpad.<variable_name>.toString();
current.comments = additionalCommentRP;

 

Please mark my answer correct and helpful if this works for you

 

Thanks and Regards 

Sarthak

Nick Parsons
Mega Sage

Your record producer script is quite close, you just have a typo, you have written curent when it should actually be current. There is also no need for the line var comments; as this variable is not being used. 

 

On a side note, your newline characters should written using \n not /n.

Thank you! It went well!