NetXMS Support Forum

English Support => General Support => Topic started by: Lostavar on October 14, 2008, 07:21:45 PM

Title: How to pass parameter to script
Post by: Lostavar on October 14, 2008, 07:21:45 PM
How can I pass parameters to user-defined scripts?
How can I pass instance parameter (parameter %6 which is DCI's instance attribute) from action-definition to user-defined script (because calling user-defined script is in format %[scriptname])?

Thanks in advance.
Title: Re: How to pass parameter to script
Post by: Victor Kirhenshtein on October 14, 2008, 07:52:31 PM
In the script, you have access to all event attributes via $event variable, which is an object of class NetXMS_Event with the following attributes:
code - event code
id - event id
severity - event severity (as number)
timestamp - event timestamp (as UNIX timestamp)
message - event message text
userTag - user tag associated with event
parameters[] - array with event parameters

So, to access event's parameter 6, you should use


$event->parameters[6]


Best regards,
Victor