Reference Qualifier not working..

Yashwanth_reddy
Tera Contributor

Hi, there is Catalog item when trying to try it, this is not working as expected.

Details:

 

When Technology is selected, respective courses which are mapped with that technology to be displayed under lookup.

But the same is not working.

 

Script include, Ref Qualifier screen shots enclosed.

 

Plz provide solution on this.

 

 

5 REPLIES 5

Siddhesh Gawade
Mega Sage
Mega Sage

Hello @Yashwanth_reddy ,

 

Can you share the code and reference qualifier ? From the images cannot see them clearly.

Ankur Bawiskar
Tera Patron
Tera Patron

@Yashwanth_reddy 

very difficult to see the scripts.

Please share the actual scripts and not images

Also what debugging have you done from your side?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Also plz suggest what best can be done to achieve the requirement

Yashwanth_reddy
Tera Contributor

Hi please find scripts:

Script include:

var Training = Class.create();
Training.prototype = {
initialize: function() {},
getCoursesByTechnology: function(technology) {
// Query the courses based on the technology field value
var courses = [];
// Replace 'course_table' with the actual name of your course table
var gr = new GlideRecord('x_meri9_e_training_training_programs');
gr.addQuery('selected_users', technology);
gr.query();

while (gr.next()) {
var CourseName = gr.getValue('name');
courses.push(CourseName);
}
return courses;
},
type: 'Training'
};

 

 

 

Client script:

function onChange(control, oldValue, newValue, isLoading, isTemplate) 
{
    if (isLoading || newValue === '') 
{
        return;
    }
    var technology = g_form.getValue('technology');
    if (technology) 
{
               g_form.clearValue('u_course');
            var courses = new Training().getCoursesByTechnology(technology);
            courses.forEach(function(course) 
{
                g_form.addOption('u_course', course, course);
            });
}    
}