- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2022 11:19 PM
I wrote Script include and called this in Reference qualifier of Leve2, Level3 fields.
I have used Ppm reference choice table to give parent values for Leve2, and Level3 Values.
while I removing Values after selection from Level1, Level2, Level3, those values only removing itself.
But not removing dependencies.
If I removed "Hire to Retire", the dependencies Payroll and "Perform customer Risk Analysis" should clear.
I have given Parent values in "Ppm reference choice table"
I will be Thankful to you for your help and patience.
var BusinessProcessLevel = Class.create();
BusinessProcessLevel.prototype = Object.extendsObject(AbstractAjaxProcessor, {
ProcessLevel1Values: function(processLevel1) {
var arrchoices1 = [];
var choices1 = new GlideRecord('u_ppm_reference_choices');
choices1.addEncodedQuery('u_parent.sys_idIN' + processLevel1);
choices1.addEncodedQuery('u_active=true');
choices1.query();
while (choices1.next()) {
arrchoices1.push(choices1.getUniqueValue());
}
return "sys_idIN" + arrchoices1.join(",");
},
ProcessLevel2Values: function(processLevel2) {
var arrchoices2 = [];
var choices2 = new GlideRecord('u_ppm_reference_choices');
choices2.addEncodedQuery('u_parent.sys_idIN' + processLevel2);
choices2.addEncodedQuery('u_active=true');
choices2.query();
while (choices2.next()) {
arrchoices2.push(choices2.getUniqueValue());
}
return "sys_idIN" + arrchoices2.join(",");
},
type: 'BusinessProcessLevel'
});
u_business_process_level_2 field Reference Qualifier:
javascript:if(current.getValue("u_business_process_level_1"))new BusinessProcessLevel().ProcessLevel1Values(current.getValue("u_business_process_level_1"));
u_business_process_level_3 field Reference Qualifier:
javascript:if(current.getValue("u_business_process_level_2"))new BusinessProcessLevel().ProcessLevel2Values(current.getValue("u_business_process_level_2"));
Solved! Go to Solution.
- Labels:
-
Multiple Versions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2022 01:54 AM
Hello Venkat,
The reference qualifier will not clear the values selected on the fields. The reference qualifier will show the required values when someone clicks on magnify glass icon on reference field or when someone search the value in reference field.
To remove the values from these list collector field you need to write onChange client script on Level1 and Level2 fields as shown below:
Level1 field Client script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
g_form.clearValue('u_business_process_level_2');
return;
}
var processLevel2 = g_form.getValue("u_business_process_level_2").toString();
if (newValue && processLevel2) {
var getAvaCnt = new GlideAjax('BusinessProcessLevel');
getAvaCnt.addParam('sysparm_name', 'getProcessLevel2Values');
getAvaCnt.addParam('sysparm_process_level1', newValue);
getAvaCnt.addParam('sysparm_process_level2', processLevel2);
getAvaCnt.getXMLAnswer(parseReceivedData);
} else {
g_form.clearValue('u_business_process_level_2');
}
function parseReceivedData(response) {
var answer = response.split(",");
if (answer.length) {
g_form.setValue("u_business_process_level_2", answer.join(","));
}
}
}
Level2 Client script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
g_form.clearValue('u_business_process_level_3');
return;
}
var processLevel3 = g_form.getValue("u_business_process_level_3").toString();
if (newValue && processLevel3) {
var getAvaCnt = new GlideAjax('BusinessProcessLevel');
getAvaCnt.addParam('sysparm_name', 'getProcessLevel3Values');
getAvaCnt.addParam('sysparm_process_level2', newValue.toString());
getAvaCnt.addParam('sysparm_process_level3', processLevel3);
getAvaCnt.getXMLAnswer(parseReceivedData);
} else {
g_form.clearValue('u_business_process_level_3');
}
function parseReceivedData(response) {
var answer = response.split(",");
if (answer.length) {
g_form.setValue("u_business_process_level_3", answer.join(","));
}
}
}
Updated Script include: Client Callable should be checked on your Script include
var BusinessProcessLevel = Class.create();
BusinessProcessLevel.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getProcessLevel2Values: function () {
var level2Process = [];
var processLevel1 = this.getParameter("sysparm_process_level1");
var processLevel2 = this.getParameter("sysparm_process_level2");
var choices1 = new GlideRecord('u_ppm_reference_choices');
choices1.addEncodedQuery('u_active=true^u_parent.sys_idIN' + processLevel1 + "^sys_idIN" + processLevel2);
choices1.query();
while (choices1.next()) {
level2Process.push(choices1.getUniqueValue());
}
return level2Process.join(",");
},
getProcessLevel3Values: function () {
var level3Process = [];
var processLevel2 = this.getParameter("sysparm_process_level2");
var processLevel3 = this.getParameter("sysparm_process_level3");
var choices1 = new GlideRecord('u_ppm_reference_choices');
choices1.addEncodedQuery('u_active=true^u_parent.sys_idIN' + processLevel2 + "^sys_idIN" + processLevel3);
choices1.query();
while (choices1.next()) {
level3Process.push(choices1.getUniqueValue());
}
return level3Process.join(",");
},
ProcessLevel1Values: function(processLevel1) {
var arrchoices1 = [];
var choices1 = new GlideRecord('u_ppm_reference_choices');
choices1.addEncodedQuery('u_parent.sys_idIN' + processLevel1);
choices1.addEncodedQuery('u_active=true');
choices1.query();
while (choices1.next()) {
arrchoices1.push(choices1.getUniqueValue());
}
return "sys_idIN" + arrchoices1.join(",");
},
ProcessLevel2Values: function(processLevel2) {
var arrchoices2 = [];
var choices2 = new GlideRecord('u_ppm_reference_choices');
choices2.addEncodedQuery('u_parent.sys_idIN' + processLevel2);
choices2.addEncodedQuery('u_active=true');
choices2.query();
while (choices2.next()) {
arrchoices2.push(choices2.getUniqueValue());
}
return "sys_idIN" + arrchoices2.join(",");
},
type: 'BusinessProcessLevel'
});
Please mark my respsone as helpful/correct, if it answer your question.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2022 01:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2022 01:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2022 01:05 AM
Add u_business_process_level_1 in u_business_process_level_2 Variable Attributes
Add u_business_process_level_2 in u_business_process_level_3 Variable Attributes
like ref_qual_elements=u_business_process_level_2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2022 01:54 AM
Hello Venkat,
The reference qualifier will not clear the values selected on the fields. The reference qualifier will show the required values when someone clicks on magnify glass icon on reference field or when someone search the value in reference field.
To remove the values from these list collector field you need to write onChange client script on Level1 and Level2 fields as shown below:
Level1 field Client script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
g_form.clearValue('u_business_process_level_2');
return;
}
var processLevel2 = g_form.getValue("u_business_process_level_2").toString();
if (newValue && processLevel2) {
var getAvaCnt = new GlideAjax('BusinessProcessLevel');
getAvaCnt.addParam('sysparm_name', 'getProcessLevel2Values');
getAvaCnt.addParam('sysparm_process_level1', newValue);
getAvaCnt.addParam('sysparm_process_level2', processLevel2);
getAvaCnt.getXMLAnswer(parseReceivedData);
} else {
g_form.clearValue('u_business_process_level_2');
}
function parseReceivedData(response) {
var answer = response.split(",");
if (answer.length) {
g_form.setValue("u_business_process_level_2", answer.join(","));
}
}
}
Level2 Client script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
g_form.clearValue('u_business_process_level_3');
return;
}
var processLevel3 = g_form.getValue("u_business_process_level_3").toString();
if (newValue && processLevel3) {
var getAvaCnt = new GlideAjax('BusinessProcessLevel');
getAvaCnt.addParam('sysparm_name', 'getProcessLevel3Values');
getAvaCnt.addParam('sysparm_process_level2', newValue.toString());
getAvaCnt.addParam('sysparm_process_level3', processLevel3);
getAvaCnt.getXMLAnswer(parseReceivedData);
} else {
g_form.clearValue('u_business_process_level_3');
}
function parseReceivedData(response) {
var answer = response.split(",");
if (answer.length) {
g_form.setValue("u_business_process_level_3", answer.join(","));
}
}
}
Updated Script include: Client Callable should be checked on your Script include
var BusinessProcessLevel = Class.create();
BusinessProcessLevel.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getProcessLevel2Values: function () {
var level2Process = [];
var processLevel1 = this.getParameter("sysparm_process_level1");
var processLevel2 = this.getParameter("sysparm_process_level2");
var choices1 = new GlideRecord('u_ppm_reference_choices');
choices1.addEncodedQuery('u_active=true^u_parent.sys_idIN' + processLevel1 + "^sys_idIN" + processLevel2);
choices1.query();
while (choices1.next()) {
level2Process.push(choices1.getUniqueValue());
}
return level2Process.join(",");
},
getProcessLevel3Values: function () {
var level3Process = [];
var processLevel2 = this.getParameter("sysparm_process_level2");
var processLevel3 = this.getParameter("sysparm_process_level3");
var choices1 = new GlideRecord('u_ppm_reference_choices');
choices1.addEncodedQuery('u_active=true^u_parent.sys_idIN' + processLevel2 + "^sys_idIN" + processLevel3);
choices1.query();
while (choices1.next()) {
level3Process.push(choices1.getUniqueValue());
}
return level3Process.join(",");
},
ProcessLevel1Values: function(processLevel1) {
var arrchoices1 = [];
var choices1 = new GlideRecord('u_ppm_reference_choices');
choices1.addEncodedQuery('u_parent.sys_idIN' + processLevel1);
choices1.addEncodedQuery('u_active=true');
choices1.query();
while (choices1.next()) {
arrchoices1.push(choices1.getUniqueValue());
}
return "sys_idIN" + arrchoices1.join(",");
},
ProcessLevel2Values: function(processLevel2) {
var arrchoices2 = [];
var choices2 = new GlideRecord('u_ppm_reference_choices');
choices2.addEncodedQuery('u_parent.sys_idIN' + processLevel2);
choices2.addEncodedQuery('u_active=true');
choices2.query();
while (choices2.next()) {
arrchoices2.push(choices2.getUniqueValue());
}
return "sys_idIN" + arrchoices2.join(",");
},
type: 'BusinessProcessLevel'
});
Please mark my respsone as helpful/correct, if it answer your question.
Thanks