- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2025 03:40 AM
I am working on Catalog item form designing part of that Role type and Role name two variables are created. in Role type variables are having jar1, jar2 options are having , in Role Name variable having the options Mug1,mug2,mug3,mug4,mug5,mug6.
suppose if select the jar1 option in Role type filed then Role Name variable will shown mug1,mug2,mug3
suppose if i select the jar2 option in role type field then role name field will shown mug4,mug5,mug6
suppose if i select the jar1,jar2, at the same time in Role Type field then Role Name field will shown mug1,mug2,mug3,mug4,mug5,mug6
how to achieve this one?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2025 03:42 AM - edited ‎03-21-2025 03:52 AM
Hello @Murali Reddy
I have the solution to your question. Please follow the following process.
1. Role Type: List Collector
- Create two choices in Question Choice table
- Jar1 and Jar2
- Set the reference qualifier to the variable like below
- question=3b050ddb83d8a21038cfc7e0deaad309 //sys_id of your role type variable
2. Role Name: List Collector
- Create 6 choices in Question Choice table
- Mug1,mug2,mug3,mug4,mug5,mug6
- Set the reference qualifier to the variable like below
- question=cf95011f83d8a21038cfc7e0deaad3bc //sys_id of your role name variable
3. Create a custom field in Question Choice
- Type: Reference
- Reference Table: Question Choice
- Label: Dependant Value
4. Set the dependent value in the question choice table like below
5. Create a client callable script include
var ADAPICall = Class.create();
ADAPICall.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getRoles: function() {
var rolenames = [];
var roleType = this.getParameter('sysparm_type');
var gr = new GlideRecord('question_choice');
gr.addQuery("question", "place_your_question_sys_id"); // Role Name question sys_id
gr.addEncodedQuery("u_dependant_value.sys_idIN" + roleType);
gr.query();
while (gr.next()) {
rolenames.push(gr.sys_id.toString());
}
return rolenames.join(',');
},
type: 'ADAPICall'
});
6. Create OnChange Catalog Client script on Role Type variable
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
g_form.clearValue("role_name");
return;
}
var roleType = g_form.getValue('role_type');
var getRoleNames = new GlideAjax('ADAPICall');
getRoleNames.addParam('sysparm_name', 'getRoles');
getRoleNames.addParam('sysparm_type', roleType);
getRoleNames.getXML(callBack);
function callBack(response) {
var answer = response.responseXML.documentElement.getAttribute('answer');
alert(answer);
g_form.setValue('role_name', answer);
}
Output:
1.
2.
3.
Thank You!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2025 09:41 AM
Hello @Murali Reddy
Have you tried the solution mentioned above?
Thank You!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2025 08:24 AM
Hello @Murali Reddy
I will have the answer to your question tomorrow. As I worked on a similar requirement, basically there is no straightforward approach to meet this requirement. We need to do some customization to the OOB table that is Question Choice and then only we can achieve this.
Thank You!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2025 08:26 AM
thanks for responding Rushi. I will try my end also .Suppose if i got then i will let you kow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2025 03:42 AM - edited ‎03-21-2025 03:52 AM
Hello @Murali Reddy
I have the solution to your question. Please follow the following process.
1. Role Type: List Collector
- Create two choices in Question Choice table
- Jar1 and Jar2
- Set the reference qualifier to the variable like below
- question=3b050ddb83d8a21038cfc7e0deaad309 //sys_id of your role type variable
2. Role Name: List Collector
- Create 6 choices in Question Choice table
- Mug1,mug2,mug3,mug4,mug5,mug6
- Set the reference qualifier to the variable like below
- question=cf95011f83d8a21038cfc7e0deaad3bc //sys_id of your role name variable
3. Create a custom field in Question Choice
- Type: Reference
- Reference Table: Question Choice
- Label: Dependant Value
4. Set the dependent value in the question choice table like below
5. Create a client callable script include
var ADAPICall = Class.create();
ADAPICall.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getRoles: function() {
var rolenames = [];
var roleType = this.getParameter('sysparm_type');
var gr = new GlideRecord('question_choice');
gr.addQuery("question", "place_your_question_sys_id"); // Role Name question sys_id
gr.addEncodedQuery("u_dependant_value.sys_idIN" + roleType);
gr.query();
while (gr.next()) {
rolenames.push(gr.sys_id.toString());
}
return rolenames.join(',');
},
type: 'ADAPICall'
});
6. Create OnChange Catalog Client script on Role Type variable
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
g_form.clearValue("role_name");
return;
}
var roleType = g_form.getValue('role_type');
var getRoleNames = new GlideAjax('ADAPICall');
getRoleNames.addParam('sysparm_name', 'getRoles');
getRoleNames.addParam('sysparm_type', roleType);
getRoleNames.getXML(callBack);
function callBack(response) {
var answer = response.responseXML.documentElement.getAttribute('answer');
alert(answer);
g_form.setValue('role_name', answer);
}
Output:
1.
2.
3.
Thank You!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-21-2025 09:41 AM
Hello @Murali Reddy
Have you tried the solution mentioned above?
Thank You!