Script include

SIVAKARTHICS
Tera Contributor

SIVAKARTHICS_0-1753593096320.png

when i use glide ajax in script include and using client Script onsubmit on form for preventing form submission . when i click order now the form showing this in scoped application what can i do

1 ACCEPTED SOLUTION

Roshnee Dash
Tera Guru

Hi @SIVAKARTHICS 

  1. Accessible from other application scopes

    • Set Accessible from: to “All application scopes”.
    • This ensures that the Script Include can be called from client scripts or other components outside its own scope.
  2. Client Callable

    • Mark the Script Include as Client Callable by checking the Client Callable checkbox.
    • This allows it to be invoked from client-side scripts using GlideAjax.
  3. Extending AbstractAjaxProcessor

    • The Script Include should extend AbstractAjaxProcessor to handle AJAX calls properly.
var Yourscriptinclude = Class.create();
Yourscriptinclude .prototype = Object.extendsObject(AbstractAjaxProcessor, {
    myFunction: function() {
        var param = this.getParameter('sysparm_name');
        // Your logic here
        return "Processed: " + param;
    }
});
Your feedback makes the community stronger! If you found this helpful, marking it as the correct answer helps others.
Stay awesome,
Roshnee Dash

View solution in original post

7 REPLIES 7

I reported the issue since it affects our ability to assist the post creator.

OlaN
Giga Sage
Giga Sage

Hi,

Generally you shouldn't use a GlideAjax in combination with a onSubmit client script.

The GlideAjax call happens async, meaning the call to the server will not return a value in time to prevent the submit of the form.

You should perform the GlideAjax validation with an onchange client script instead.