OnBeforeNew - unable to get new Item

I am trying to pre-populate a property value before the create new item form is displayed. However I cant seem to get the reference of the new item, and I am using JavaScript for client event: OnBeforeNew of the Item. var itm = this.newItem(this.getType(),"get"); alert(itm.toString()); itm.setProperty("team_id",sTeamId); itm = itm.apply(); When I use alert to display the item fetched, it looks like getting one of the existing records? Please advise how can I achieve this.
  • Hello, You can accomplish this by changing this code to run from an OnAfterNew client event instead. In an OnBeforeNew, the new item has not yet been created, so you cannot set the value of any properties. Additionally, you can simplify the code that runs in the OnAfterNew event to be:
    this.setProperty("team_id", sTeamId); // Assumes that you assign sTeamId previously in the method
    return this;
    Chris
    Christopher Gillis Aras Labs Software Engineer