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 - Is it possible to invoke a form from an action of an Item type

Santhosh - Thursday, March 17, 2011 2:07 AM:

Hi Community,

Could you anyone please suggest me a way to display a form from Action menu of an item.

This form is not related to any Itemtype. It is a form which I have created in ARAS forms.

Thanks

Santhosh



vishal_trivedi - Thursday, March 17, 2011 8:25 AM:

Hi Santhosh,

 

Refer below code. It might be useful to you.

 

// get the id of your form
var q = new Item("Form", "get");
q.setAttribute("select", "id");
q.setProperty("name", "name of your form");
var r = q.apply();
if ( r.isError()||r.getItemCount()<1 ) {
top.aras.AlertError("Form not found.");
return false;
}
// create an object to pass values required by ShowFormAsDialog.html
var param = new Object();
param.title  = "some title"; // to be shown in the blue bar at top of window
param.formId = r.getItemByIndex(0).getID(); // the id of the Form to be used
param.item = this.newItem("Form"); // an Item of valid type, can be used to populate the Form
param.aras = top.aras; // the aras object


// get the value returned by ShowFormAsDialog.html
// from a modal dialog, setting window attributes
var res = showModalDialog("ShowFormAsADialog.html", param,
  "dialogHeight:250px; dialogWidth:300px; " +
  "status:0; help:0; resizable:1; scroll:0;");
// apply your generic method passing terms and op in body string 
var innovator = this.getInnovator();
var method_name="YOUR METHOD NAME FOR ACTION";
var body=res;
var result = innovator.applyMethod(method_name,body);
// return the result

return result.getResult();

 

- Vishal



Santhosh - Thursday, March 17, 2011 9:07 AM:

Hi Vishal,

Thanks a lot it worked for me.

Santhosh.