Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

For life cycle event case Need to create the new task

nikhitha24
Tera Guru

Can anyone please help me on the below query.

For life cycle event case Need to create the new task , below is the task

Will you require a mobile phone 

Yes

No

nikhitha24_0-1693327448576.png

 

Once the task is created and its assigned to preboarding specialist, preboarding specialist will open the task from employee service portal(esp) and if they want candidate to mobile click yes and submit the task, if they dont want candidate to mobile click No and submit the task

 

Will you require a mobile phone 

Yes-

No

If the preboarding specialist click on Yes(Task  state will closed complete and another dependent task needs to create)

If the preboarding specialist click on No(Task state will closed incomplete and dependent task will not create)

below is the screenshot once preboarding specialist submit it will update the state on native instance

Please help me on this.

nikhitha24_1-1693328218781.png

 

nikhitha24_2-1693328254272.png

 

 

 

 

2 REPLIES 2

Susan Britt
Mega Sage
Mega Sage

The easiest way to accomplish this would be with a Flow. Your flow can trigger based of that specific child HR Task being completed.  You can pull in the variable to see if yes or not was selected.  If yes, then create the necessary child task for the other team.  If no, the flow ends. This would not interfere with the existing lifecycle event activities.

Sandeep Rajput
Tera Patron
Tera Patron

@nikhitha24 Is Order Mobile Phone task a Record Producer or a Catalog item? If it is a record producer, I am assuming it generates an HR Task when the form is submitted. If the aforementioned assumption is correct then inside the record producer script you can check 

if(producer.will_require_phone=='yes'){
current.state='10'; //Set the newly created task to ready
current.assigned_to='';//Set sys_id of assgined_to here
}
else{
current.state='7'; //set the newly created task to cancelled.
}

 

In order to set the status of the HR task presenting the record producer, you can create an onSubmit script, inside the onSubmit script you can fetch the sys_id of the current task as follows.

 

var hrTaskID = document.getElementsByClassName('task-content')[1].id.split('_')[0];//fetches the task sys_id;
if(g_form.getValue('will_require_mobile_phone')=='yes'){
//Call a script include method and provide the task sys_id and update the task state to closed complete
}
else{
//Call a script include method and provide the task sys_id and update the task state to closed incomplete
}

Hope this helps.