Create a GlideAjax call from a client script to a script include

2.7k views Asked by At

I need assistance with a project task.

I'm new to ServiceNow and I get a little confused. I'm supposed to use a GlideAjax script for the response below.

The logic is

When the due date on an Issue record changes, send that date to the server side code.

Check the date against all key milestone records (these are pm_project_tasks with the key milestone flag set to true).

If the date is past the date of an open key milestone, return a value to the client script indicating so.

On the client side, pop up an alert (javascript confirm box) notifying the user of that fact that their issue is after a key milestone.

Can anyone assist me on how to start this?

1

There are 1 answers

1
Hawful On

Even as a ServiceNow dev with 5 years of experience I will find myself looking up GlideAjax syntax when I have to write it, so please don't feel bad.

Here is a very complete ServiceNow Community post on writing GlideAjax

In short:

  1. Create your script include, check client callable. Gather all milestone dates.
  2. Create a new client script, set it to onChange and select your due date field
  3. Call your script include with new GlideAjax(script include)

The rest of the specifics are spelled out well on the post. Also, no shade to Stack Overflow, but if you want ServiceNow specific answers the best place to ask is on the ServiceNow Community page.