- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2022 02:43 AM
Hello!
I have a requirement to add a clone/copy an existing RITM record functionality in the Catalog Item View. The requirement is to add a Copy RITM checkbox. When this is selected, a dropdown variable will show all of the RITM records for the item. Selecting a record will populate all of the variables from the old RITM. Has this been done before?
Please help!
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2022 04:50 AM
Yes, its poosible.
function getRITMdata(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
var SkipFieldValue = '|requested_by|on_behalf_of'; //here map your variable names which you dont want to copy
var jData = JSON.parse(answer);
for (var key in jData) {
if (SkipFieldValue.indexOf('|' + key + '|') == -1) {
g_form.setValue(key, jData[key], jData['dv_' + key]);
}
}
}
Thanks
Murthy
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2022 04:50 AM
Yes, its poosible.
function getRITMdata(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
alert(answer);
var SkipFieldValue = '|requested_by|on_behalf_of'; //here map your variable names which you dont want to copy
var jData = JSON.parse(answer);
for (var key in jData) {
if (SkipFieldValue.indexOf('|' + key + '|') == -1) {
g_form.setValue(key, jData[key], jData['dv_' + key]);
}
}
}
Thanks
Murthy
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2022 05:04 AM
This works!
Thank you so much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 09:57 AM
I have these same requirements , using this same script on an onChange catalog script, with the variable name ritm as the refence for the ritm to look up, and having no luck,
Can you take a look to see if I'm missing something?
Any help is greatly apprciated.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 10:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2023 10:15 AM
Thanks!
function onChange(control, oldValue, newValue, isLoading) {
var ritm = g_form.getValue("ritm");
var ajax = new GlideAjax('Newglidingabc');
ajax.addParam('sysparm_name', 'getRITMDetails');
ajax.addParam('sysparm_ritm', ritm);
ajax.getXML(getRITMdata);
}
function getRITMdata(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
//alert(answer);
var jData = JSON.parse(answer);
for (var key in jData) {
g_form.setValue(key, jData[key], jData['dv_' + key]);
}
}
function getdata() {
var ritm_number = this.getParameter('sysparm_ritm');
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(ritm_number);
set.load();
var vs = set.getFlatQuestions();
var object = {};
for (var i = 0; i < vs.size(); i++) {
if (vs.get(i).getLabel() != '' && vs.get(i).getValue() != '') {
object[vs.get(i).getName()] = vs.get(i).getValue();
object['dv_' + vs.get(i).getName()] = vs.get(i).getDisplayValue();
}
}
var data = JSON.stringify(object);
return data;
}