- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2017 07:21 AM
Hello Gurus,
I have form on which we have a 'send SMS' button, when clicked will bring up a UI page, which has a code something like this ..
<g:ui_form>
<input type="hidden" id="cancelled" name="cancelled" value="false"/>
<input type="hidden" id="incidentSysID" name="incidentSysID" value="${sysparm_sysID}"/>
<table>
<tr>
<td id="label.location" class="label" nowrap="true" height="23px" type="string" choice="0"><span id="status." class="mandatory label_description" mandatory="true" oclass="mandatory">$[SP]</span><label for="location" onclick="" dir="">Users:</label></td>
<td nowrap="true"><g:ui_reference name="location" id="location" table="sys_user" onchange="user_data()"/></td></tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr><td nowrap="true"><g:ui_input_field label="First Name" name="first_name" id="first_name" mandatory="true" size="50" /></td></tr>
<tr><td nowrap="true"><g:ui_input_field label="Last Name" name="last_name" id="last_name" mandatory="true" size="50" /></td></tr>
<tr><td nowrap="true"><g:ui_input_field label="Email" name="email" id="email" mandatory="true" size="100"/></td></tr>
<tr><td nowrap="true"><g:ui_input_field label="Business Phone" name="phone" id="phone" mandatory="true" size="40" /></td></tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr><td nowrap="true"><g:ui_input_field label="SMS Text" name="sms_text" id="sms_text" mandatory="true" size="50" /></td></tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr><td align="left" nowrap="true"><br /><g:dialog_buttons_ok_cancel ok="return validateForm()" ok_type="submit" cancel="return onCancel();"/></td></tr>
</table>
</g:ui_form>
I want to do a gs.addInfoMessage() on the sys_id of the calling form [aka the form where the 'send sms' button was there]. how do i get it in the Processing script?
There is more functionality I can implement once I get the sys_id.
Any help?
Thanks in Advance
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2017 08:48 AM
Here are the changes. I have tested and it is working
UI action:
function smsDialog() {
var sysId = typeof rowSysId == 'undefined' ? gel('sys_uniqueValue').value : rowSysId;
//var sysId = typeof rowSysId == 'undefined' ? gel('sys_uniqueValue').value : rowSysId;
var gDialog = new GlideDialogWindow("Send_sms"); ////Render the dialog containing the UI Page
gDialog.setTitle("Send SMS");
//gDialog.setPreference("incidentSysID", g_form.getUniqueValue());
gDialog.setPreference('sysparm_sysID', sysId);
//gDialog.setPreference('sysparm_table', "incident_alert");
gDialog.render();
}
UI page:
<g:ui_form>
<input type="hidden" id="cancelled" name="cancelled" value="false"/>
<input type="hidden" id="incidentSysID" name="incidentSysID" value="${sysparm_sysID}"/>
<!--<g:evaluate var="jvar_incidentSysId" expression="RP.getWindowProperties().get('incidentSysId')" />-->
<!--<input type="hidden" id="incidentSysID" value="${jvar_incidentSysId}" /> -->
<input type="hidden" id="incidentSysID" name="incidentSysID" value="${sysparm_sysID}"/>
<table>
<tr>
<td id="label.location" class="label" nowrap="true" height="23px" type="string" choice="0"><span id="status." class="mandatory label_description" mandatory="true" oclass="mandatory">$[SP]</span><label for="location" onclick="" dir="">Users:</label></td>
<td nowrap="true"><g:ui_reference name="location" id="location" table="sys_user" onchange="user_data()"/></td></tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr><td nowrap="true"><g:ui_input_field label="First Name" name="first_name" id="first_name" mandatory="true" size="50" /></td></tr>
<tr><td nowrap="true"><g:ui_input_field label="Last Name" name="last_name" id="last_name" mandatory="true" size="50" /></td></tr>
<tr><td nowrap="true"><g:ui_input_field label="Email" name="email" id="email" mandatory="true" size="100"/></td></tr>
<tr><td nowrap="true"><g:ui_input_field label="Business Phone" name="phone" id="phone" mandatory="true" size="40" /></td></tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr><td nowrap="true"><g:ui_input_field label="SMS Text" name="sms_text" id="sms_text" mandatory="true" size="50" /></td></tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr><td align="left" nowrap="true"><br /><g:dialog_buttons_ok_cancel ok="return validateForm()" ok_type="submit" cancel="return onCancel();"/></td></tr>
</table>
</g:ui_form>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2017 07:37 AM
Javascript:
var sysID = g_form.getUniqueValue();
$j('#incidentSysID').val(sysID);
I hope I understand the question...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2017 07:49 AM
Thanks Gaetano, I wll try what you said and will report back. Thanks for the reply!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2017 07:56 AM
That did not work either Gaetano, this is what I have in my processing scripr:
var strMessage =request.getParameter("sms_text");
var userPhone=request.getParameter("phone");
gs.addInfoMessage("SMS message send to the user");
response.sendRedirect("incident_alert.do?sys_id=" + incidentSysID);
gs.addInfoMessage(request.getParameter("sms_text"));
var sysID = g_form.getUniqueValue();
gs.addInfoMessage('The incSysId is :'+ $j('#incidentSysID').val(sysID));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2017 07:39 AM
Hi Andy,
In the html section if you are storing the value in input type hidden then you can access the value directly in the processing script using the id of the html tag.
Processing Script:
if(incidentSysID != ''){
gs.addInfoMessage('Sys id is:'+incidentSysID);
}
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader