Avoid Field Service to create default Work Order task with same name as work order if no template

RahulP030357301
Tera Contributor

Hi Community,

 

I am observing a situation with Field Service Management module. My scenario is pretty simple

  1. Creating a work order without any template.
  2. Changing state to Ready for Dispatch. (Note: I am not using Qualification)
  3. Test WO without template.png
  4. WO state changes to Ready for Dispatch and automatically a work order task is created with same name as workorder. (Note: Behavior is same with the Awaiting Qualification state)
  5. WO Task create automatically.png

I am looking for the approach to avoid the creation of that task, because I have a business rule running which will create the required tasks based on certain conditions.

 

BR/Rahul

 

4 REPLIES 4

Arun_Manoj
Mega Sage

Hi @RahulP030357301 ,

 plz update BR as 

 

(function executeRule(current, previous /*null when async*/) {
// Add a condition to check if no template is used
if (current.template_used.nil() || current.template_used == false) {
return; // Skip task creation
}

// Existing logic for task creation
var taskGr = new GlideRecord('sn_customerservice_work_order_task');
taskGr.initialize();
taskGr.short_description = current.short_description;
taskGr.work_order = current.sys_id;
taskGr.insert();
})(current, previous);

 

 

Thanks

Arun

Hi Arun,

 

Thank you for your response.

Will you please provide more detail, which BR are you mentioning?

 

Regards,

Rahul

RahulP030357301
Tera Contributor

Hi Gurus,

 

Can anyone else share some more view, how can we achieve this?

 

BR/Rahul

Joshua Chen FX
Mega Sage

thinking out loud.

why not change it to request-driven instead of task-driven? i believe it won't create a subtask when creating a work order. and for your work order tasks, you can run your BR on insert. could it work?