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

        CUI is the choice of the real professional![emoticon:1435ff2429184e17bc948e4f19178e1e][emoticon:c4563cd7d5574777a71c318021cbbcc8]

        Haven´t tried this one with CUI so far, so your inArgs hint is also useful for myself. Not sure if I was really right with my Action solution. I think I mixed it up with a different issue. I checked my Actions again -> in reality I used small Methods that call the main Method with "dummy" property to indicate the calling Action. Your CUI solution is more elegant.