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

Kunal Varkhede
Tera Guru

Hi mallikharjunaswamyvutla,

 

You can not call event from client side, Event will be call on server side only.

You can call event in UI action. By using below method.

gs.eventQueue('Event Name','GlideRecord Object','parm1','parm2');

 

Please Mark Correct/Helpful answer if it helps you.

Regards,

Kunal.

 

gs.event takes 5 inputs last one is eventqueue name

SatheeshKumar
Kilo Sage

You can't trigger events from client side directly.

But as a  workaround, you can do it through glide ajax  and script include  combination .

On change of fields in client side ....call glide Ajax and it will invoke a script include - from where you can trigger the event.

Kunal Varkhede
Tera Guru

Hi,

UI action also worked on both side client side and server side, so using ui action you can trigger event also.

Regards,

Kunal.