Filter a list of ItemTypes using onBeforeGet or onGet in the simple List All ItemType view

How I can filter a list of ItemTypes using onBeforeGet or onGet in the simple List All ItemType view, I'm thinking using the user logged with the CREATED_BY_ID of the current list of ItemType?

Parents
  • Hello Everyone!

    I got resolve this issue, for this I implemented a c# method(bellow) and I call it in onBeforeGet event.

    var context = this.getInnovator()
    var currentUserId = CCO.Variables.GetUserID();
    this.setProperty("created_by_id", currentUserId);
    return this;

    Thanks for all!

  • Hi Helio,

    I wanted to offer two pieces of advice here. 

    To start, your method of getting the user ID is perfectly valid, but you can also get it directly from the Innovator object like so.

    var context = this.getInnovator();
    var userId = context.getUserID();

    Secondly, if you're simply trying to filter a list of items returned from a query, this will be better accomplished by using the Aras permission model rather than a custom onGet event. You can get to an ItemType's permission by navigating to the Permissions relationship tab on the ItemType. From here you can set which Identities have Get, Update, Delete, and Discover access.

    Chris

    Christopher Gillis

    Aras Labs Software Engineer

Reply
  • Hi Helio,

    I wanted to offer two pieces of advice here. 

    To start, your method of getting the user ID is perfectly valid, but you can also get it directly from the Innovator object like so.

    var context = this.getInnovator();
    var userId = context.getUserID();

    Secondly, if you're simply trying to filter a list of items returned from a query, this will be better accomplished by using the Aras permission model rather than a custom onGet event. You can get to an ItemType's permission by navigating to the Permissions relationship tab on the ItemType. From here you can set which Identities have Get, Update, Delete, and Discover access.

    Chris

    Christopher Gillis

    Aras Labs Software Engineer

Children