not able to trigger catalog client script

rajtiwari02
Tera Contributor

No value present: java.util.NoSuchElementException: No value present: java.base/java.util.Optional.get(Optional.java:143)

com.glide.ui.ng.app.AppResources$RecordAcl.ifCanRead(AppResources.java:396)

com.glide.ui.ng.NGUserProcessor.process(NGUserProcessor.java:103)

com.glide.ui.ng.AngularProcessor.process0(AngularProcessor.java:257)

com.glide.ui.ng.AngularProcessor.process(AngularProcessor.java:190)

com.glide.processors.AProcessor.runProcessor(AProcessor.java:759)

com.glide.processors.AProcessor.processTransaction(AProcessor.java:313)

com.glide.processors.ProcessorRegistry.process0(ProcessorRegistry.java:187)

com.glide.processors.ProcessorRegistry.process(ProcessorRegistry.java:175)

com.glide.ui.GlideServletTransaction.process(GlideServletTransaction.java:58)

com.glide.sys.Transaction.run(Transaction.java:2734)

com.glide.ui.HTTPTransaction.run(HTTPTransaction.java:35)

java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)

java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)

java.base/java.lang.Thread.run(Thread.java:840)

 

rajtiwari02_0-1742593419946.png

 

 

 

I'm getting this error while refreshing catalog form in my DEV instance. How to resolve this error? and I have written client script for the catalog item but it's not triggering. Is above error could be reason if yes how to overcome. I have checked in PDI, client script is not causing any error and producing required result. 

Thanks in advance!

10 REPLIES 10

rajtiwari02
Tera Contributor
please find the client script below :

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue === '') {
        g_form.clearOptions('salesforce_profile_required');
        g_form.addOption('salesforce_profile_required', ' ', '--None--');
        return;
    }
    var platform = g_form.getValue('salesforce_platform');
    // console.log("platform:", platform); // Debugging

    if (platform == 'Salesforce - OMC') {
        g_form.clearOptions('salesforce_profile_required');
        g_form.addOption('salesforce_profile_required', ' ', '--None--');

        g_form.addOption('salesforce_profile_required', 'executive', 'Executive');
        g_form.addOption('salesforce_profile_required', 'omc_gcl', 'OMC_GCL');
        // g_form.setValue('salesforce_profile_required', 'executive', 'Executive'); // Set default
    } else if (platform == 'Salesforce - Flywheel') {
        g_form.clearOptions('salesforce_profile_required');
        g_form.addOption('salesforce_profile_required', ' ', '--None--');
        var gr = new GlideRecord('question_choice');
        gr.addQuery('question', '1d6b2daf83dc6250a340c8efeeaad39b');
        gr.orderBy('order');
        gr.query();
        if (gr.hasNext()) {
            while (gr.next()) {
                g_form.addOption('salesforce_profile_required', gr.value.toString(), gr.text.toString());
            }
            //g_form.addOption('salesforce_profile_required', 'contract', 'Contract');
            // g_form.setVisible('contract', true);
            //g_form.setVisible('omc_gcl', true);
            // g_form.setVisible('executive', true);
            //g_form.addOption('salesforce_profile_required', 'executive', 'Executive');
            //g_form.addOption('salesforce_profile_required', 'omc_gcl', 'OMC_GCL');
            // g_form.setValue('salesforce_profile_required', 'executive', 'Executive');

        }



        

    }
}

rajtiwari02
Tera Contributor

rajtiwari02_0-1742818978084.png

 

@rajtiwari02 

I already informed on Saturday (2 days ago), the error you are showing doesn't relate to any client script.

it's a system log so nothing to do with your client script

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

rajtiwari02
Tera Contributor

So do we have other option to check root cause of this error and why my client script is not triggering.

@rajtiwari02 

coming to your 1st question, that's a generic message you can debug server side script

for your 2nd question why client script is not working?

1) are you comparing correct value in IF statement

2) did you add alert and see till which point client script runs?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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