Forum Discussion

ShrutiS's avatar
ShrutiS
Ideator I
5 years ago

Get the Context Action Name in the Method

Hi All, 

I have Multiple Server Side Item Actions Configured on the Part Item , I want the logic/functionality to be performed by each action to be controlled by the same method .

In which case , is there a way to pass the Invoking action name to the Method so that based on the value I can chose the function to be performed.

For the above action , I want to get the action name "plm_Test" while invoking the method on the Item.

This would greatly help me in avoiding creating Multiple Methods for each Action.

Thanks.

7 Replies

  • Hi ShrutiS,

    that´s a very good question! I myself searched two years for this one until I was able to find the most obvious solution:

    Innovator inn = this.getInnovator();
    return inn.newError("This call comes from " + this.getAction());

    • ShrutiS's avatar
      ShrutiS
      Ideator I

      Hi Angela,

      Thanks for the response, for some response when I tried this.getAction() it returned the method name and not the Action name.

      I then switched to the CUI menu item and I am now able to get the resp menu button name in the inArgs parameter [emoticon:c4563cd7d5574777a71c318021cbbcc8]

      Regards

      • AngelaIp's avatar
        AngelaIp
        Ideator I

        Hi Shruti,

        I right now want to build a similar CUI Menu with buttons like you did in this post a few month ago.

        Can you give me some hints regarding getting the Action or CUI Menu Button name with inArgs?

        I thought I could use inArgs.commandId  or inArgs.control.getId() to get the calling element.

        But none of my variants I tried so far did contain anything. Not sure what is missing. Would be great if you could tell me how you did it :-D . 

        Thanks!

        Angela