Author Topic: nxsl: function to get object of an event  (Read 526 times)

Dmitri Lunyov

  • Newbie
  • *
  • Posts: 4
    • View Profile
nxsl: function to get object of an event
« on: January 30, 2020, 08:34:49 am »
I didn't find a way to get object of an Event and, consequently, parameters of an Event from a script that does not inherit reference $event (e.g. running from scheduler). I can get object of an Alarm and then get id of origin Event among attributes of the Alarm, but it's no nxsl's function to get object of the Event neither by id nor somehow else.

Is this because of security rules or it can be implemented?

So far I have to use Persistent Storage to save parameters from an Event and to get them from a script later. This way is not very convenient.

Victor Kirhenshtein

  • Lead Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 7058
    • View Profile
Re: nxsl: function to get object of an event
« Reply #1 on: January 30, 2020, 05:16:45 pm »
You can load event from database using function LoadEvent. It accepts single argument - event ID, and returns event object.

Best regards,
Victor

Dmitri Lunyov

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: nxsl: function to get object of an event
« Reply #2 on: January 31, 2020, 02:00:29 pm »
Thank you, Victor! It is great!