Passing value from ui page to ui action

R9
Tera Contributor

Hello,

I have a UI page with a dialog box. The dialog box takes in two values that I want to pass on to the UI action and then redirect from the UI action page to use these values to create an incident form. I tried calling the function in the UI action from the UI page but it does not work. 

 

UI PAGE

HTML- 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<j:set var="jvar_pref" value="${sysparm_incID}"/>
 <!-- <input type="hidden" id="rec" name="rec" value="${jvar_pref}"/>  -->
    <style>
        #jelly-div{
            width: 300px;
        }
    </style>
    <div id="jelly-div">

      <!-- Creation of Incident -->
 <g:ui_form id="incident">
    <input type="hidden" id="incID" name="incID" value="${sysparm_incID}"/>
  <h5>Assignment Group:</h5> <g:ui_reference id="assignment_group" name="assignment_group" table="sys_user_group" query="active=true" completer="AJAXTableCompleter" onchange="setUserFilter()"/><br/>
  <!-- <h5>Assigned To:</h5> <g:ui_reference id="assigned_to" name="assigned_to" table="sys_user" query="active=true" completer="AJAXTableCompleter"/><br/> -->
  <h5>Short Description:</h5> <input type="text" id="short_description" name="short_description" /><br/>
  <g:dialog_buttons_ok_cancel ok="return continueOk()" cancel="return continueCancel()" />

 </g:ui_form>
<!--End Incident-->
    </div>
</j:jelly>
 
 
Client Script-
function continueOk() {
     GlideDialogWindow.get().destroy();
    alert('continue ok');
    var assgn_group = gel(assignment_group).value;
    alert(assgn_group);
    var s_description = gel(short_description).value;
    alert(s_description);
  // updateTask();
   
    return gsftSubmit(null, g_form.getFormElement(), 'ws_create_incident_int');
}




function continueCancel() {
    alert("inside cancel");
    GlideDialogWindow.get().destroy();
    return false;
}
 
UI action
 
function showDialogimsInc() {
    var dialogClass = GlideDialogWindow;
  //  var gDialogInc = new dialogClass('sn_itsm_workspace_InteractionClosure_Popup');
    var gDialogInc = new dialogClass('sn_itsm_workspace_sow_native_incident_button');

    gDialogInc.setTitle('Interaction: ' + g_form.getValue('number'));
    gDialogInc.setPreference('sysparm_sys_ID', g_form.getUniqueValue());
    gDialogInc.setPreference('sysparm_type', 'inc');
    //gDialogInc.setPreference('dialogTrap', true);//
    gDialogInc.render();
}
if (typeof window == 'undefined')
    updateTask();

function updateTask() {
    current.state = 'closed_complete';
    if (current.update()) {
    var inc = new GlideRecord("incident");
    inc.initialize();
    inc.caller_id = current.opened_for;
    inc.short_description = current.short_description;
    inc.u_on_behalf_of = inc.caller_id; // point of contact autopopulated from impacted user

    if (current.type == 'chat') {
            inc.contact_type = 'Chat';
        } else if (current.type == 'messaging') {
            inc.contact_type = 'Chat';
        } else if (current.type == 'phone') {
            inc.contact_type = 'Phone';
        } else if (current.type == 'video') {
            inc.contact_type = '';
        } else if (current.type == 'walkup') {
            inc.contact_type = 'Walk-In';
        } else if (current.type == 'Email') {
            inc.contact_type = 'Email';
        }
//add an entry in the interaction_related_records table
    var incSysId = inc.insert();
    var interactionRelatedGR = new GlideRecord("interaction_related_record");
    interactionRelatedGR.initialize();
    interactionRelatedGR.interaction = current.sys_id;
    interactionRelatedGR.document_table = 'incident';
    interactionRelatedGR.document_id = incSysId;
    interactionRelatedGR.insert();

    action.openGlideRecord(inc);
}
}
0 REPLIES 0