The CreatorCon Call for Content is officially open! Get started here.

How to populate the assignment group when creating an incident through VA?

Katherine12
Kilo Contributor

This is my create request/incident script:

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

     if (!gs.nil(caller) && !gs.nil(short_desc)) {
        var incDetails = new sn_itsm_va.VACreateINCUtil().createIncident(caller, short_desc, urgency, desc, cmdb_ci, assignment_group);
        vaVars.inc_sysid = incDetails.sysid;
     }
     
})()

However, upon testing, the assignment group isn't filled when an incident is created. Any recommendations?

1 ACCEPTED SOLUTION

i've never seen that script includes before and even peeking at it, not sure about it - particularly whatever a "Universal Request" (UR) is and how it's used.

I just have a single "Create Incident" topic block and the crux of the topic block is just a script action, close to what you have, but mainly missing the record initialization and insertion. You can do a lot more useful things in the topic block (like adding attachments) and in the script itself (i.e. dynamic routing based on the CI's support group), but this is the core of it:

    var incident = new GlideRecord('incident');
    incident.initialize();
    incident.caller_id = vaInputs.caller;
    incident.sys_created_by = vaInputs.user;
    incident.short_description = vaInputs.short_description;
    incident.assignment_group = vaInputs.assigment_group;
    incident.cmdb_ci = vaInputs.cmdb_ci;
    incident.urgency = vaInputs.urgency;
    incident.impact = vaInputs.impact;
    incident.contact_type = 'virtual_agent';
    incident.comments = vaInputs.comments;
    incident.incident_state = vaInputs.state;  
    //Save this incident as a variable to use to display it
    vaVars.incident = incident.insert();
    //Link this incident to the Interaction
    vaSystem.attachRecordToConversation('incident',vaVars.incident);

View solution in original post

6 REPLIES 6

Hi Val,

 

If you need a global variable that persists through the whole conversation then you need a live agent variable. You can read about it here:

Creating live agent variables

 

If you want to pass a value as a variable from a topic to a topic block (what seems to be the thing you need) then first you have to make sure that the variable is defined as an input parameter on the topic block.

 

Based on your images it seems that you want to use vaInput variables as input parameters, but they are two different things. vaInput variables are values set at Input nodes within the topic/topic block, input properties are variables transferred from topic to topic block. 

If you don’t have an assignment group input property on the create incident topic block you have to create one. Clone the topic block (if it is a read only OOB one) and click on the start node. That’s where you can define the input properties. After this go back to your topic where you use the topic block and on the input mapping the new input property can be used.

This page at section Procedure step 5 describes this:

Creating a topic block  

 

I hope this helps,

 

Richard

ReedL
Giga Contributor

I can't help, but wanted to add that I did EXACTLY the same thing in my create request/incident script yesterday (2.5 years later).  Have you found another way to make it populate the incident since then?