- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2017 05:59 AM
I have created a UI action to fetch a field in RITM catalog variables and show in Glidedialogwindow and when user enters value it needs to be updated in the field.
Using below steps:
Ui Action of client type:
function updateInput(){
var dialogClass = window.GlideModal ? GlideModal : GlideDialogWindow;
var dialog = new dialogClass("change_value_popup");
//dialog.setWidth("800");
dialog.setTitle(getMessage("Change the value with appropriate"));
dialog.setPreference('sysparm_sys_id', g_form.getUniqueValue());
dialog.render(); //Open the dialog.
}
===========================================================================================================
UI Page XML:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="group_mailbox"
expression="RP.getWindowProperties().get('current.variables.mailbox')" />
<tr>
<td class="label">
${gs.getMessage('Please provide appropriate value:')}
</td>
<td>
<g:ui_input_field name="mailbox_name" id="mailbox_name" label="Group Mailbox Name" value="${group_mailbox}"
/>
</td>
</tr>
<tr>
<td>
<g:dialog_button id="submit_button" type="submit"
onclick="entervalue('${sysparm_id}', this)">${gs.getMessage('Submit')}</g:dialog_button>
<g:dialog_button id="cancel_button" type="submit"
onclick="closevalueWindow(this)">${gs.getMessage('Cancel')}</g:dialog_button>
</td>
</tr>
</j:jelly>
Ui Page Client Script:
function closevalueWindow() {
GlideDialogWindow.get().destroy();
}
function entervalue() {var groupmailbox = gel("mailbox_name").value;
alert(groupmailbox);
if (groupmailbox == "") {
alert("Please enter your value before submitting.");
return false;
}
var req_item = g_form.getUniqueValue();
alert(req_item);
var ga = new GlideAjax('AutomationUtils');
ga.addParam('sysparm_name', 'Changevalue');
ga.addParam('sysparm_sysid',req_item);
ga.addParam('sysparm_groupmailbox',groupmailbox);
ga.getXMLAnswer(getresponse);
function getresponse(answer){
closevalueWindow();
g_form.save();
}
}
==============================================
Script Include function:
Changevalue: function() {
var mailbox = this.getParameter('sysparm_groupmailbox');
var sysid = this.getParameter('sysparm_sysid');
var req = new GlideRecord('sc_req_item');
req.get('sysid');
req.variables.mailbox = mailbox;
req.update();
return true;
new Workflow().broadcastEventToCurrentsContexts(req, 'update', null);
},
This is failing on the update of catalog variable in RITM.
The need here is to allow the appropriate catalog variable to be shown on Glidedialogwindow for certain selection when Request was submitted(i have not yet gone to the part of querying based on selection bit) and the popup to accept the value and update the variable and workflow to be restarted from that point.
Appreciate your response.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2017 09:53 AM
I am using g_form.setValue('variable name', value) and this is working to set my solution.
Thanks for your time and help Kristen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2017 06:11 AM
If you check the history on the RITM, does it show that it updated and then saved the old value again? I ask because while your script include is doing the update, your UI Page Client Script is saving the form. I'm wondering if you're just writing it over with the displayed (old) value and if you should refresh the page instead. (I'm assuming that your alerts for the mailbox and ritm are coming back with the expected values?)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2017 06:18 AM
Hi Kristen,
Thanks for your response.
In history/Activity of RITM there is no changes at all. It appears like RITM table itself is not being touched at all.
I tried removing g_form.save() and ran again no changes .
And yes, alerts are showing right values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2017 06:26 AM
Two ideas:
- In your req.get('sysid') - remove the quotes, since you're referencing a variable
- If that doesn't resolve, try passing the mailbox sys_id as a string to see if that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2017 06:58 AM
Did try that no luck