Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

how to assign a user to default assigned_to in SC-Task

tGhadage
Tera Contributor

Hi Guys,

 

How to default assign a particular user as default assigned to in SC_TASK.

 

Thank!! 

8 REPLIES 8

Hi @tGhadage  use this code 

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

    if (current.short_description.indexOf("Testing please ignore") > -1 && current.state == 3) {
        current.assignment_group = "8a5055c9c61122780043563ef53438e3";
        current.assigned_to = "sys_is of assigned to user";
    }

})(current, previous);

 

Please mark my reply Correct/Helpful

Regards,

Sid

Yashsvi
Kilo Sage

Hi @tGhadage

Please check below link:

https://www.servicenow.com/community/now-platform-forum/setting-assigned-to-on-task-from-a-reference...

Thank you, please make helpful if you accept the solution.

Anand Kumar P
Tera Patron

Hi @tGhadage  ,

Create after insert business rule on sc_task table and use below script
current.assigned_to = current.parent.assigned_to;
If you want to compare from other table and populate assigned to use below script

(function executeRule(current, previous /*null when async*/) {
	var chGr = new GlideRecord('change_request');
	chGr.addQuery('sys_id',current.request_item.u_related_change);  // use field as per your configuration which stores related change ID
	chGr.query();
	if(chGr.next()){
		chGr.assigned_to = current.assigned_to.toString();
		chGr.update();
	}
})(current, previous);

Mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand

Ankur Bawiskar
Tera Patron

@tGhadage  

first question to you -> are you using flow or workflow here?

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader