The CreatorCon Call for Content is officially open! Get started here.

Auto Populate two field values in short description field on sc_task

tsai25044
Tera Contributor

Hi Experts,

 

Can you help me with small requirement.

 

Need to auto populate two field values in short description field after the request is submitted. Field variables "field_name" "program_request".

When user fills his response against this two fields its should auto populate in the short description field.

I even tried current.short_description =("Field Name")+ current.variables.field_name+ "\n" + ("Program request")+current+variables.program_request ;

 

It's not working , Please can anyone help me its urgent/priority.

 

Thanks,

tsai.

6 REPLIES 6

Brad Bowman
Kilo Patron
Kilo Patron

The unnecessary parenthesis and errant + are throwing it off.  Try this:

current.short_description = "Field Name " + current.variables.field_name + "\nProgram request " + current.variables.program_request;

Are you using this in a workflow Run Script, or Business Rule?

 

Maddysunil
Kilo Sage

@tsai25044 

If you are doing it in Business rule:

 

(function executeRule(current, previous /*null when async*/) {
    var field_name = current.variables.field_name;
    var program_request = current.variables.program_request;
    
    var shortDescription = "Field Name: " + field_name + "\nProgram Request: " + program_request;
    
    current.short_description = shortDescription;
})(current, previous);

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks

Sandeep Rajput
Tera Patron
Tera Patron

@tsai25044 Update your script as follows.

 

current.short_description ="Field Name "+ current.variables.field_name+ "\n" + "Program request "+current.variables.program_request;

Hope this helps.

Hi @tsai25044 ,

 

If you need the code with braces try the below script,

 

current.short_description ="("+"Field Name "+")"+ current.variables.field_name+ "\n" +"("+"Program request "+")"+current.variables.program_request;

 

If it is helpful please make it correct/helpful.

 

Thanks and Regards,

Allu Gopal.