Blog

New Caller Window Dialog

Using a GlideDialog window, this is an example of creating a new caller and copy the caller to the incident form.

Screenshots

1. New Caller UI Action (Click to expand)

2. New Caller Dialog (Click to expand)

3. New Caller in Incident (Click to expand)

 

UI Action: New Caller

UI Action: New Caller

Table: Incident [incident]
Form Context Menu: true
List Context Menu: true
Client: true
Show insert: true
Show update: true
Condition: gs.hasRole("itil") && current.active == true
OnClick: popNewCaller()
Script:
function popNewCaller() {
 var sysId = typeof rowSysId == 'undefined' ? gel('sys_uniqueValue').value : rowSysId;
 var gDialog = new GlideDialogWindow('new_caller');
 gDialog.setPreference('sysparm_sysID', sysId);
 gDialog.setPreference('sysparm_table', "sys_user");
 gDialog.setTitle('New Caller');
 gDialog.render();
}

UI Page: New Caller

UI Page: New Caller (HTML)

<?xml version="1.0" encoding="utf-8"?>
<j:jelly xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null" trim="false">
    <form action="ui_page_process.do">
        <input type="hidden" name="name" value="new_caller"/>
        <input type="hidden" id="cancelled" name="cancelled" value="false"/>
        <g:evaluate>
            var source_incident = '$';
        </g:evaluate>        
        <table>
      <tr>
         <td id="my_label" class="label" nowrap="true" type="string" choice="0"><label>First Name:</label></td>
         <td nowrap="true">
            <input id="first_name" name="first_name" />
         </td>
      </tr> 
      <tr>
         <td id="my_label" class="label" nowrap="true" type="string" choice="0"><label>Last Name:</label></td>
         <td nowrap="true">
            <input id="last_name" name="last_name" />
         </td>
      </tr> 
      <tr>
         <td id="my_label" class="label" nowrap="true" type="string" choice="0"><label>Title:</label></td>
         <td nowrap="true">
            <input id="title" name="title" />
         </td>
      </tr> 
    <tr>
         <td id="my_label" class="label" nowrap="true" type="string" choice="0"><label>Business Number:</label></td>
         <td nowrap="true">
            <input id="phone" name="phone" />
         </td>
      </tr> 
    <tr>
         <td id="my_label" class="label" nowrap="true" type="string" choice="0"><label>Mobile Number:</label></td>
         <td nowrap="true">
            <input id="mobile_phone" name="mobile_phone" />
         </td>
      </tr> 
    <tr>
         <td id="my_label" class="label" nowrap="true" type="string" choice="0"><label>Email:</label></td>
         <td nowrap="true">
            <input id="email" name="email" />
         </td>
      </tr> 
  
            <tr />
            <tr>
                <td align="right" colspan="2">
                    <g:dialog_buttons_ok_cancel ok="return onSubmit();" cancel="return onCancel();"/>
                </td>
            </tr>
        </table>
        <input type="hidden" name="source_incident" id="source_incident" value="$"/>
    </form>
</j:jelly>

 

UI Page: New Caller (Client Script)

function onCancel() {
var c = gel('cancelled');
c.value = "true";
GlideDialogWindow.get().destroy();
return false;
}

function onSubmit() {
var grUser = new GlideRecord("sys_user");
grUser.last_name = gel('last_name').value;
grUser.first_name = gel('first_name').value;
grUser.title = gel('title').value;;
grUser.phone = gel('phone').value;;
grUser.mobile_phone = gel('mobile_phone').value;;
grUser.email = gel('email').value;;
var grUserSysID = grUser.insert();
g_form.setValue('caller_id',grUserSysID);
GlideDialogWindow.get().destroy();
return false;
}