When the user is changing the priority of the incident the priority should be appended at the start of the description with previous description value? Ex : Previous description is : "The Priority Value is : 5 " then user changed the urgency to 2 the

BlackCoder16
Tera Contributor

When the user is changing the priority of the incident the priority should be appended at the start of the description with the previous description value? Ex: The previous description is: "The Priority Value is: 5 " then the user changed the urgency to anything and then save the form. after saving it the description should be "The Priority Value is 3";

1 ACCEPTED SOLUTION

Can you try adding below script in your onSubmit client script

var desc = g_form.getValue('description');
    var start, end, new_desc;
    if (desc.includes("The priority value changed to ")) {
        start = desc.indexOf("The priority value changed to ");
        end = start + 30;
        new_desc = setCharAt(desc, end, g_form.getValue('priority'));
        g_form.setValue('description', new_desc);
    } else {
        new_desc = desc + " The priority value changed to " + g_form.getValue('priority');
        g_form.setValue('description', new_desc);
    }


    function setCharAt(str, index, chr) {
        if (index > str.length - 1) return str;
        return str.substring(0, index) + chr + str.substring(index + 1);
    }

Start from a new incident and test it.

 

Mark as correct and helpful if it solved your query.

Regards,
Sumanth

View solution in original post

15 REPLIES 15

D_vid Novotn_
Tera Contributor

Use before Busine Rule

- with condition priority changes

- with script like this:

var currentDescription = current.getValue('description');
//use UI message to store message -> eg: "The priority value is {0}
//and then you can use gs.getMessage(<<messageName>>, currentPriority);
var currentPriority = "The priority value is :" + current.getValue('priority');
current.description = currentPriority + ' ; ' + currentDescription;

Hiii David

The String Value should be the same but the Priority value should be changed when the user changes the impact/urgency. Value changing but when I'm changing the priority it's updating the desc like this.

 

find_real_file.png

  1. Is description filled by user creating incident? 
  2. When incident is inserted, do you want to add The Priority value is 4 ?
  3. If incident priority is updated, in that case you want to add to description: The Priority value changes to 2

If you want only 3, than just update before BR to when to run: Update

If something else, please give me some more examples as it is not clear what it is you want to achieve 

SumanthDosapati
Mega Sage
Mega Sage

Hi Subhash,

What should happen if there is something else in description other than "The Priority value is X" ?

 

Regards,
Sumanth