Bojensen Blogs

create a web popup form in AX

How to create a popup web form in AX Enterprise Portal.

1. (Using a WebLet – the "right" way to do it)

a) Insert a WebGroup where you want the link to be.

b) Insert a Weblet into this group, specify the following properties for it:

Weblet = WebPopUpWeblet

DataSource = Your datasource name

c) Override the layout() method on the created weblet and insert the following code: (all it does is specifies the properties needed to identify the object you need to popup)

public boolean layout(Object _p1)
{
boolean ret;

ret = super(_p1);

_p1.setProp(extendedTypeStr(menuItemNameDisplay),menuitemdisplayStr(EPSalesTotalsAll));
_p1.setProp(enumStr(MenuItemType),MenuItemType::Display);
_p1.setProp(extendedTypeStr(WebHeight),300);
_p1.setProp(extendedTypeStr(WebWidth),450);

return ret;
}

This code opens a WebForm EPSalesTotals with width and height specified.

EASY! 🙂

2. (The ugly way, but also kinda cute)

a) Add a WebStaticText control where you need the link.

b) In the init method of the WebForm (or anywhere else you like) change the text property of this control, inserting the link in it:

void clicked()
{
WebLink link;

super();

link = new WebLink();
link.openInNewWindow(true);
link.menufunction(new MenuFunction(‘EPCustTableInfo’, MenuItemType::Display));
link.asppage(‘default.asp’);
WebStaticText1.text(‘<A href="’+link.url()+’">’ + "My Customer Info" + "</A>");
}

The WebStaticText1 will now look as a link with the text "My Customer Info". Clicking on it will open a separate window with the Customer Info Table.

You might notice that the asppage ‘default.asp’ is used here. So the global and local menues will also be opened. Try using the lookup.asp if you need to hide the menues.

Comments are closed.