Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

How to avoid "Accept Assignment"?

Sirko
Tera Expert

Hi,

 

I'm creating a new case and assign it to an Agent using

var newCase = new GlideRecord('sn_customerservice_case');
newCase.initialize();
newCase.assigned_to = gs.getUserID(); 
newCase.insert()

but the Agent must click "Accept Assignment".

How can I avoid that?
The Case should directly be assigned to the agent.

Best Regards
Sirko Fresia

1 ACCEPTED SOLUTION

Sirko
Tera Expert

Ok, I found the solution:
The state must be set to "open", then the assignment is accepted.

 

var newCase = new GlideRecord('sn_customerservice_case');
newCase.initialize();
newCase.assigned_to = gs.getUserID(); 
newCase.state = 10;
newCase.insert();

 Regards
Sirko

View solution in original post

6 REPLIES 6

@Sirko 

what happens currently when they click Accept Assignment?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Sirko
Tera Expert

Ok, I found the solution:
The state must be set to "open", then the assignment is accepted.

 

var newCase = new GlideRecord('sn_customerservice_case');
newCase.initialize();
newCase.assigned_to = gs.getUserID(); 
newCase.state = 10;
newCase.insert();

 Regards
Sirko