Add Resolution Code to comments

BuriB
Tera Expert

Hi all, 

how can we add the resolution code in to the comments, so that the creater can the the resolution code inforation in the comments? 

 

Thank you

2 ACCEPTED SOLUTIONS

Hi @BuriB ,

 

can you try as below

(function executeRule(current, previous /*null when async*/) {

    current.comments = "Resolution code is: " + current.getDisplayValue('resolution_code') + "---->"+ "Resolution Notes is: "+current.getDisplayValue('close_notes');


})(current, previous);

View solution in original post

Hello @BuriB 

Since the resolution code is a choice field, therefore number you see is the backend value. To get the display value use getDisplayValue() method.

Here is the updated script:

(function executeRule(current, previous /*null when async*/) {

    var resolutionCodeLabel = current.resolution_code.getDisplayValue(); // Get the label of resolution_code
    current.comments = "Resolution code is: " + resolutionCodeLabel + " ----> " + "Resolution Notes is: " + current.close_notes;

})(current, previous);

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

 

Thank You
Juhi Poddar

View solution in original post

9 REPLIES 9

hi @Gaurav Shirsat 

 

it looks almost good. I triesd the following:

 

(function executeRule(current, previous /*null when async*/) {

    current.comments = "Resolution code is: " + current.resolution_code + "---->""Resolution Notes is: "+current.close_notes;})(current, previous);
 
But by Resolution code it shows the Number not the label. See below 

 

Resolution code is: 31---->Resolution Notes is: Test 7

 

How i can change to label?

 

Thank you

Please try current.field_name.getValue()

Sorry I am not expert. Where exactly to but current.field_name.getValue()? Could you please put it in the script? Please 🙂

Hi @BuriB ,

 

can you try this

(function executeRule(current, previous /*null when async*/) {

    current.comments = "Resolution code is: " + current.getDisplayValue('resolution_code') + "---->"+ "Resolution Notes is: "+current.getDisplayValue('close_notes');


})(current, previous);

 

Hello @BuriB 

Since the resolution code is a choice field, therefore number you see is the backend value. To get the display value use getDisplayValue() method.

Here is the updated script:

(function executeRule(current, previous /*null when async*/) {

    var resolutionCodeLabel = current.resolution_code.getDisplayValue(); // Get the label of resolution_code
    current.comments = "Resolution code is: " + resolutionCodeLabel + " ----> " + "Resolution Notes is: " + current.close_notes;

})(current, previous);

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

 

Thank You
Juhi Poddar