Can we call Events from client side?

mallikharjunasw
Tera Contributor

Can we call Events from client side? 

1 ACCEPTED SOLUTION

AbhishekGardade
Giga Sage

Hello mallikharjunaswamyvutla,

No, We can not trigger events from client side But we can do it by calling script include by using glideAjax call from client script. In Script include, we can call server side API's.

The eventQueue() method is part of the GlideSystem server-side API. The eventQueue() method inserts an event in an event queue. The eventQueue() method is typically passed four parameters but can also take an optional 5th parameter:

eventQueue(String name, Object instance, String parm1, String parm2, String queue)

Queues an event for the event manager.

Parameter(s):
NameTypeDescription
nameStringName of the event being queued.
instanceObjectGlideRecord object, such as "current".
parm1String(Optional) Saved with the instance if specified.
parm2String(Optional) Saved with the instance if specified.
queueStringName of the queue.
  1. Event name: Enclose the event name in quotes.
  2. GlideRecord object, typically current but can be any GlideRecord object from the event's table. or you can pass gr object if you are doing glideRecord and then calling event.
  3. Any value that resolves to a string. This is known as parm1 (Parameter 1). Can be a string, variable that resolves to a string, or method that resolves to a string.
  4. Any value that resolves to a string. This is known as parm2 (Parameter 2). Can be a string, variable that resolves to a string, or method that resolves to a string.
  5. (Optional) Name of the queue to manage the event.
    gs.eventQueue method is typically passed four parameters

The logic that responds to an event has access to the passed in GlideRecord object, parm1, and parm2.

Please mark as Correct Answer and Helpful, if applicable.
Thank You!
Abhishek Gardade

Thank you,
Abhishek Gardade

View solution in original post

8 REPLIES 8

Ganesh Pardhe
Kilo Guru

hello  mallikharjunaswamyvutla,

You can't trigger email notification from client side scripts. As best practice have your Glide-Ajax as Asynchronous so that browser won't wait till the script include function returns something and email will get triggered in back end.

 

Thanks and regards,

Ganesh

 

AbhishekGardade
Giga Sage

Hello mallikharjunaswamyvutla,

No, We can not trigger events from client side But we can do it by calling script include by using glideAjax call from client script. In Script include, we can call server side API's.

The eventQueue() method is part of the GlideSystem server-side API. The eventQueue() method inserts an event in an event queue. The eventQueue() method is typically passed four parameters but can also take an optional 5th parameter:

eventQueue(String name, Object instance, String parm1, String parm2, String queue)

Queues an event for the event manager.

Parameter(s):
NameTypeDescription
nameStringName of the event being queued.
instanceObjectGlideRecord object, such as "current".
parm1String(Optional) Saved with the instance if specified.
parm2String(Optional) Saved with the instance if specified.
queueStringName of the queue.
  1. Event name: Enclose the event name in quotes.
  2. GlideRecord object, typically current but can be any GlideRecord object from the event's table. or you can pass gr object if you are doing glideRecord and then calling event.
  3. Any value that resolves to a string. This is known as parm1 (Parameter 1). Can be a string, variable that resolves to a string, or method that resolves to a string.
  4. Any value that resolves to a string. This is known as parm2 (Parameter 2). Can be a string, variable that resolves to a string, or method that resolves to a string.
  5. (Optional) Name of the queue to manage the event.
    gs.eventQueue method is typically passed four parameters

The logic that responds to an event has access to the passed in GlideRecord object, parm1, and parm2.

Please mark as Correct Answer and Helpful, if applicable.
Thank You!
Abhishek Gardade

Thank you,
Abhishek Gardade

asifnoor
Kilo Patron

Hi,

It is not possible to trigger events from client side directly. But you can call a SI, which can trigger a event. 

Could you let me know the use case that you are working on, may be i can help you based on that.

Mark the comment as helpful and correct answer if it helps.

RAHUL Khanna1
Mega Guru

Please close the thread if answered