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

Bhavya11
Kilo Patron

hi @BuriB ,

 

If you're wanting to post the resolution notes to the additional comments for the customer to see, you can add a BR to complete this.

When: Before

Filter: State changes to Resolved

Script:

 

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

	current.comments = "Resolution  code is" + current.close_code + "-->"+ "Resolution Notes "+current.close_notes;
})(current, previous);

 

 

 

Mark it as helpful, if it fulfills your requirement.

 

 

Thanks,

BK

 

Hi @Bhavya11 

 

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?

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);

Gaurav Shirsat
Mega Sage

Hello @Bhavya11 

The Possible way is by using Business Rule.

Trigger Condition will be :

when to run : 

After/Update

Resolution Code Changes

 

script 

current.comments=current.close_code;

current.setWorkflow(false);

current.update();

 

Thanks and Regards

Gaurav Shirsat