Dropdown not showing value in MRVS popup when populated with on change of another field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2024 05:26 PM
I have a multi row variable set where there is a single text field (Mark) and a reference field (Grade).
The reference field "Grade" is populated based on the value in the "Mark" field.
Issue : When the mark is entered and if if directly go and hit the "Save" button in the Multi row variable set popup, the value is not displayed in the Grade reference field value and it is showing as empty in the multi row variable set even though the value is present in the Grade. I alerted the value of Grade during variable set submit and it is displaying the correct value, but not displaying in the field.
I did the same script written for onChange in the onSubmit of variable set as well, but it is not working. Looks like with out clicking outside somewhere in the popup, it is not displaying the value in the reference field.
Suggestions please.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 05:38 AM
Post your script using the insert code icon </>, and we'll get it sorted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2024 05:07 PM
This is what I have in the onchange client script of variable new_mark in the multi row variable set.
var mark = newValue.trim();
var gaUtil = new GlideAjax('ProjectUtils');
gaUtil.addParam('sysparm_name', 'getSysId');
gaUtil.addParam('sysparm_newMark', mark);
gaUtil.getXML(getGrade);
function getGrade(response) {
// Get the response
var sysId = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('new_grade', sysId);
g_form.setReadOnly('new_grade', true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2024 05:36 AM
During the onchange if you alert on sysId is it showing a valid sys_id for the table referenced in new_grade? This shouldn't matter, but is there a difference in behavior if you do not make the variable read only?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2024 04:26 PM
Yes Brad, The sys_id is coming correctly when I alert it on submit. There is no difference if we make the field editable also. I tried hiding the add button and display it on the onchange of the new mark field. In this case, its giving the grade is populated and displayed in the field and the users can hit the add button. Looks like if there is no option I have to go with this. Is there any other alternative?
