Forum Discussion

Morgan's avatar
Morgan
Creator III
5 years ago
Solved

How can I open an item I just created via an action?

Hi all,

I have a client method that calls a server method to create an item based off some properties on the context item.

How can I display the new item in a tab after it is created by the server method?

  • if your server method looks like

    [embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:909d3b9c-2e79-49c3-9752-ba25fe6fded0:type=csharp&text=...%0D%0AItem%20item%3DnewItem%28ItemType%2C%20%22add%22%29%3B%0D%0Aitem.setProperty%28...%29%3B%0D%0AItem%20res%3Ditem.apply%28%29%3B%0D%0Areturn%20res%3B]

    you can get the result like this

    [embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:3eb5688a-1cd7-459c-9c20-2667a590afe5:type=javascript&text=var%20res%3Daras.applyMethod%28%22MyMethod%22%2C%22%22%29%3B%0D%0Avar%20resItem%3Daras.newIOMItem%28%22%22%29%3B%0D%0AresItem.loadAML%28res%29%3B%0D%0Aaras.uiShowItem%28resItem.getType%28%29%2C%20resItem.getID%28%29%29%3B]

4 Replies

    • Morgan's avatar
      Morgan
      Creator III

      Thanks for this, I guess I am unclear on how to return the ID of the new item from the server side method to the client side method that called it.

      • alaxala's avatar
        alaxala
        Creator III

        if your server method looks like

        [embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:909d3b9c-2e79-49c3-9752-ba25fe6fded0:type=csharp&text=...%0D%0AItem%20item%3DnewItem%28ItemType%2C%20%22add%22%29%3B%0D%0Aitem.setProperty%28...%29%3B%0D%0AItem%20res%3Ditem.apply%28%29%3B%0D%0Areturn%20res%3B]

        you can get the result like this

        [embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:3eb5688a-1cd7-459c-9c20-2667a590afe5:type=javascript&text=var%20res%3Daras.applyMethod%28%22MyMethod%22%2C%22%22%29%3B%0D%0Avar%20resItem%3Daras.newIOMItem%28%22%22%29%3B%0D%0AresItem.loadAML%28res%29%3B%0D%0Aaras.uiShowItem%28resItem.getType%28%29%2C%20resItem.getID%28%29%29%3B]