VA - how to retrieve ticket information from an inaccessible ticket

Nathan63
Tera Contributor

I'm trying to create a flow to automatically produce a new incident based on an existing one that the customer has no access to.  When we have an outage-like ticket (but not using the outage module), we want to display some basic info to the customer in VA, which is fine, then if selected the customer can choose a ticket presented to them and automatically have a new ticket created with the required fields filled in based on the existing ticket.  e.g. the configuration item.

 

I have tried using the Lookup node and then pulling fields from that into a create incident node, and doing the entire thing by script.  In this case it looks up the old ticket, grabs the variables into vaVars and passes those into the new ticket.  Problem is that when you run the flow as the customer the script doesn't populate the vaVars.  Works fine as a ServiceNow analyst.  here is my code, does anyone know how to retrieve info from a ticket the user can't see?

 

 

// lookup outage ticket that was identified earlier in the flow
    var selected_outage = new GlideRecord('incident');
    selected_outage.addQuery('sys_id', vaInputs.lookup_selected_outage.getUniqueValue());
    selected_outage.query();
    gs.debug('>>>> The selected outage is: ' + selected_outage);

    //assign fields from outage ticket to VA Variables
    vaVars.new_service = vaInputs.lookup_selected_outage.business_service;
    gs.debug('>>>> the VA Variable for new service is: ' + vaVars.new_service);
    gs.debug('>>>> the Service was: ' + vaInputs.lookup_selected_outage.business_service);
    vaVars.new_service_offering = vaInputs.lookup_selected_outage.service_offering;
    vaVars.new_category = vaInputs.lookup_selected_outage.category;
    vaVars.new_subcategory = vaInputs.lookup_selected_outage.subcategory;
    vaVars.new_assignment_group = vaInputs.lookup_selected_outage.assignment_group;
    vaVars.new_short_description = vaInputs.lookup_selected_outage.short_description;
    vaVars.new_description = vaInputs.lookup_selected_outage.description;

    //create new ticket based on the variables provided
    var gr = new GlideRecord('incident');
    gr.initialize();
    gr.business_service = vaVars.new_service;
    gr.service_offering = vaVars.new_service_offering;
    gr.category = vaVars.new_category;
    gr.subcategory = vaVars.new_subcategory;
    gr.assignment_group = vaVars.new_assignment_group;
    gr.short_description = "Child - " + vaVars.new_short_description;
    gr.description = vaVars.new_description;
    gr.caller_id = vaInputs.user;
    gr.u_alternate_contact_no = vaInputs.contact_number;
    gr.u_wfh = vaInputs.wfh;
    gr.parent_incident = vaInputs.lookup_selected_outage.getUniqueValue();
    gr.contact_type = "Virtual Agent";
    gr.impact = 3;
    gr.urgency = 3;

    gr.insert();

 

 

 

0 REPLIES 0