How to set the Task state to Pending assgnment from Draft by default???

naveenmyana
Giga Expert

Hi,

This is related to facilities module..

When I submit the request from facilities request form a task is generating for that request. But the problem is the task state is in "Draft" and I need to change this to "Pending Assignment" by default. Like whenever i submit a request it should generate a task with state as "Pending assignment".

Please suggest me how can i do this.. I have written a BR, but it's not working..

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

            // Add your code here

                  var fcts = new GlideRecord('facilities_request');

                  if(fcts.get(current.getValue('facilities_request'))){

                  fcts.state = 10;

                  fcts.update();

                  }

        })(current, previous);

1 ACCEPTED SOLUTION

Hi Guys,



I got it fixed...I have just set the action in Br as Set state to Pending assignment and it's working fine..



Thank you so much guys for your response anyway...


br.PNG


View solution in original post

14 REPLIES 14

anurag92
Kilo Sage

Create a before Insert BR, and increase the order to 1000 on Facilities Task, set state directly as draft.


Hi Anurag,



Actually when ever a task generated here the state should be "Pending assignment" not "Draft", right now it is "Draft".. How can i change the state, Please suggest??


Before insert business rule as i said.


-Anurag

Anurag Tripathi
Mega Patron
Mega Patron

I am not familiar with facilities module :



But generally speaking what you need is a Before Insert Business rule on the task (sc_task/facility task i think) table and in that you can add conndition that if request.sys_class_name == <facilities>


Script:


current.state=<value of Pending Assignment>


-Anurag