I need to set the Priority of Tasks which would be same as RITM priority

rajojunaresh
Tera Contributor

When a catalog item is raised, based on some criteria, the priority of RITM gets changed. Now the Tasks are getting generated with default p4. I need to set te Priority of these Tasks to be same as RITM Priority.

 

This is code which i tried using BR.

 function onBefore(current, previous) {
  var gr = new GlideRecord('sc_task');
    gr.addActiveQuery();
    gr.addQuery('request_item',current.sys_id);
    gr.query();
    if(gr.next()){
    gr.priority= 3;
    gr.update();
    }
 

5 REPLIES 5

Dubz
Mega Sage

Hi,

 

Just to clarify, this is a before insert/update rule on the sc_task table yes? If you need the task priority to be the same as the RITM priority when it's raised then you should be able to just dot-walk to the value.

 

current.priority = current.request_item.priority

rajojunaresh
Tera Contributor

Hi yes, it was Before BR.
I tried using the above but still the Tasks Priorities are not getting changed

I just configured this on my dev instance and it works as expected. When you hit the new button it will raise the form with the default value but as long as you enter the RITM before you hit save it should amend the priority. If you have changed the priority choice options on either the request item or catalog task form you may need to ensure the values are consistent.

 

find_real_file.png

Richard P
Mega Guru

If the task is generated from workflow, can you not put David's suggestion into the "create task" item in the workflow?