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

Hi Anurag,


I am getting the below error while trying your script:



error.PNGbr.PNG


Hi Anurag,



Yes it was the same as you said...Thank you so much for your help..I am sorry, forgot to mark your answer as correct.


Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

I guess we are talking about Facilities request task here. This is using state flow in the default value and I'm not experienced here what it does deep down, but I would look into this before I start making BRs and so on.



//Göran


Sadasiva Reddy
Giga Guru

Hi Naveenmyana,



Try using dictionary override. give table name facilities_request_task(facilities request task)


find_real_file.png



REgards,


Sadasiva



Please mark helpful/ correct based on the impact


The table is already there..Can u pls suggest me any other way..