Assigning group when creating a ticket by VirtualAgent

MaciejPletnia
Tera Contributor

Hi,

 

I'm trying to make sure that all tickets opened by Virtual Agent will go to a Service Desk group. 

I'm using create incident topic block and I can't get it to work. 

Here is my script:

 

(function execute() {
var caller = vaInputs.caller;
var short_desc = vaInputs.short_description;
var urgency = vaInputs.urgency;
var desc = vaInputs.description;

if (!gs.nil(caller) && !gs.nil(short_desc)) {
var incDetails = new sn_itsm_va.VACreateINCUtil().createIncident(caller, short_desc, urgency, desc);
vaVars.inc_sysid = incDetails.sysid;
current.assignment_group.setDisplayValue('Service Desk')
}
})()
 
Thanks for the help!
5 REPLIES 5

Medi C
Giga Sage

@MaciejPletnia 

Could you please use the following script instead: (Please add sys_id of service desk team)

 

   var incident = new GlideRecord('incident');
    incident.initialize();
    incident.caller_id = vaInputs.caller;
    incident.sys_created_by = vaInputs.caller;
    incident.short_description = vaInputs.short_description;
    incident.description = vaInputs.description;
    incident.assignment_group = "SYS_ID_OF_SERVICE_DESK_ASSIGNMENT_GROUP";
    incident.urgency = vaInputs.urgency;
    incident.contact_type = 'virtual_agent';
    incident.comments = vaInputs.comments;

    //Keep track of this incident as a variable to use to display it
    vaVars.inc_sysid = incident.insert();

    //Link this incident to the Interaction
    vaSystem.attachRecordToConversation('incident',vaVars.inc_sysid);

 

It should be placed within (function execute(){...})()


If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.

Thank you, but unfortunately it keep crashing (I'm having technical issues and won't be able to continue this conversation). Any other ideas?

 

MaciejPletnia
Tera Contributor

I have a script that almost works:

 

(function execute() {
var incGr = new GlideRecord('incident');
incGr.get(vaVars.inc_sysid);
incGr.assignment_group = "4546996d87a889102fb9400d0ebb35ab"; // Group sys_id
incGr.update(); // Update the record
})();

 

I use it as a topic block, and sometime it works as intended, and some time it crashes the main topic with "technical difficulties" error message. Any idea?

Hello @MaciejPletnia,

 

Please try:

(function execute() {
var incGr = new GlideRecord('incident');
if(incGr.get(vaVars.inc_sysid)){
   incGr.assignment_group = "4546996d87a889102fb9400d0ebb35ab"; // Group sys_id
   incGr.update(); // Update the record
}
})();

 Since it is a record update, why not to use the Virtual Agent Utility Record Action:

MediC_0-1743099777004.png

MediC_1-1743099798084.png

 

 


If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.