This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - How do you open a Item in a form you specify?

jweir - Sunday, April 1, 2012 11:16 PM:

If there are multiple forms specified for an ItemType, how do you programmically open an Item in a form you specify?  The end goal is to create an Action that a user can execute on an Item to open a form other then the default.

I have explored uiShowItem and uiShowItemEx with no luck.



Yoann Maingon - Tuesday, April 3, 2012 7:34 AM:

Hi,

What is the decision's logic based on?

Best,

Yoann



aponceot - Tuesday, April 3, 2012 8:11 AM:

Hi, You can try : 

 

var formNd = top.aras.getItemByName("Form", "[FORM_NAME]", 0);

if (formNd)

{

  var param = new Object();

  param.title = "[Name Of the Window]";

  param.formId = formNd.getAttribute("id");

  param.aras = top.aras;

  param.itemTypeName = "[ITEM TYPE NAME]";

 

  var width = top.aras.getItemProperty(formNd, "width");

  var height = top.aras.getItemProperty(formNd, "height");

 

  var result = showModalDialog("ShowFormAsADialog.html", param,

          "dialogHeight:" + height + "px; dialogWidth:" + width + "px; " +

          "status:0; help:0; resizable:0; scroll:0;");

  }



jweir - Tuesday, April 3, 2012 10:24 AM:

The decision logic is based on the users action/decision.

Consider the following:

"View [ItemType Name]" is the built in action that would bring up the default form based on Type. Classification and or Display Priority.  I want to create another action "View [ItemType Name] Simple Form" that will ignore the aforementioned rules specified on the ItemTypes View relationship and explicitly specify the the "Simple Form".



jweir - Tuesday, April 3, 2012 10:15 AM:

How does the form get populated if you are not setting the context Item? 

Thanks for your response.



jweir - Tuesday, April 3, 2012 10:26 AM:

So, I guess I would add to your logic:

param.item = myItem;

Thanks for the help, I will give this a try...

Cheers



aponceot - Tuesday, April 3, 2012 10:22 AM:

A quick look in the "ShowFormAsADialog.html" file reveals the awaited parameters : 

      var formId = dialogArguments.formId;

      var item   = dialogArguments.item;

      var aras   = dialogArguments.aras;

      var isEditMode = dialogArguments.isEditMode;

      if (isEditMode === undefined) isEditMode = true;

So I guess you just need to pass the item as an argument when opening the form :

param.item = MyItem;



jweir - Tuesday, April 3, 2012 12:19 PM:

I've implemented the sample code provided, but realized that it is a dialog without the regular Aras toolbar and manubar.  I was looking for it to be in a standard innovator window.



guido.chiavaccini - Saturday, February 1, 2014 1:10 PM:

A quick look in the "ShowFormAsADialog.html" file reveals the awaited parameters : 

 

      var formId = dialogArguments.formId;

      var item   = dialogArguments.item;

      var aras   = dialogArguments.aras;

      var isEditMode = dialogArguments.isEditMode;

      if (isEditMode === undefined) isEditMode = true;

 

So I guess you just need to pass the item as an argument when opening the form :

param.item = MyItem;

Hi Anthony,

is it possible to view (in the dialog) the Relationship tabs too?

I definitely need an Item Form without MenuBar and ToolBar (like the one showed for Activity2 Items).

Guido



guido.chiavaccini - Monday, February 3, 2014 1:16 PM:

I have found the solution by "reverse engineering" of "Activity2" form window.