Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support
  3. Using Scripts in Action Messagetext

Using Scripts in Action Messagetext

Scheduled Pinned Locked Moved Support
4 Posts 2 Posters 25.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G
    G
    gkaudewitz
    wrote on last edited by
    #1

    Within action messsage text it is possible to use the %[name] macro for generating output to message-text. The called funktion can have parameters. That works fine.

    The problem I want to solve is:
    Who to use the values of other macros as parameter for the function. E.g. %[script/myfunct(%z,%a,%c)] with the values of %z, %a and %c. The first tests I did are resulting in the strings "%z", %a" and "%c" that are passed to called function.

    Who can I achieve that values of macros are passed to the function?

    Best regards

    Goerg

    1 Reply Last reply
    0
    • F
      F
      Filipp Sudanov
      wrote on last edited by
      #2

      Nested custom attributes are not supported. But you can get all the data you need within the script, either by using object attributes, e.g.

      $node->ipAddr

      or by calling expandString method of NetObj, Event or Alarm , e.g.:

      $node->expandString("%n")
      
      1 Reply Last reply
      0
      • G
        G
        gkaudewitz
        wrote on last edited by
        #3

        Thanks for the info. That helps me very much, concerning data I want to access within action message text!

        But I got an other problem that I don't what goes wrong.

        In message text I am calling a function this way %[NMSRV::test/testfkt1("p1","p2","p3","p4")] for test this is a very simple function with this definition in NMSRV::test :

        function testfkt1(pm1,pm2,pm3,pm4)
         { retval = "Param1: "..pm1.." Param2:"..pm2.." Param3:"..pm3.." Param4:"..pm4;
          return (retval);
         }

        The resulting message differs from expected result. Generated value from this function is:

        Param1:  Param2:p1 Param3:p2 Param4:p3

        It seems, that there is a shift of parameters when script is called from message text. I tested it with two different installations of NetXMS Version 4.4.3.

        Best regards

        Georg

        1 Reply Last reply
        0
        • F
          F
          Filipp Sudanov
          wrote on last edited by
          #4

          It's a bug, was fixed couple of days ago, if there will be another patch release for 4.4, fix will be there, otherwise it will be in 5.0 which should be out in December

          1 Reply Last reply
          0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          Powered by NodeBB Contributors
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups