ergr - Thursday, August 29, 2013 7:05 AM:
Hi,
I have created an Action at item level to add the selected item to another item. So, I added a method with the following code:
Innovator inn = this.getInnovator();
string item_id = this.getID();
Item eqe= inn.getItemById("EQE",item_id);
eqe = eqe.apply();
Item qua = inn.newItem("QUA","add");
qua.setPropertyItem("eqe_id",eqe);
qua = qua.apply();
return this;
This is adding a new 'QUA' item and also setting the value to the field without opening the item. But I was hoping to open the item immediately to fill in the other fields.
How to open a new item from an Action?
Thank you-Erg
[email protected] - Thursday, August 29, 2013 2:59 PM:
To perform the described scenario you should not use a Server Method. There are Client Methods in JavaScript available where you are able to perform this scenario.
Please read the Programmers Guide more detailed to get what you want.
Jens Rollenmüller NTT DATA Germany
ergr - Friday, August 30, 2013 3:02 AM:
Thanks Jens, Can you please point out where it is explained in the Programmers Guide. I tried this :
var inn = new Innovator();
var qua = inn.newItem("QUA","add");
qua.setProperty("qua_id","QUA-1");
qua = qua.apply();
This is also adding the item but not opening.
I tried this: top.aras.uiNewItemEx("QUA"); . This is opening the item window but how can I set a value to the new item like qua.setProperty("qua_id","QUA-1"); ? One field of the item should be filled from the code already at the time it gets open.
zahar - Friday, August 30, 2013 6:26 AM:
There are a couple approaches that you can take to complete your task:
- top.aras.uiNewItemEx("QUA"); and then create Client Event onAfterNew of "QUA" itemtype that will populate qua_id
- top.aras.uiNewItemEx("QUA"); and then create Client Event on onLoad of QUA FORM
- Use your code that first creates new item and then use top.aras.uiShowItem("QUA", qua.getID(), 'tab view', true);
ergr - Monday, September 2, 2013 3:40 AM:
Thanks Zahar Chernov, I tried third one-It worked.