Discussion:
Change company in Enterprice portal
(too old to reply)
Arne
2010-08-19 11:31:03 UTC
Permalink
Hi.

I have to open an URL link in another company.

In "normal" AX I do this by using the appl.SetDefaultCompany("company")

This does not work in enterprice portal.

The reason for this is that certain stuff is only to be created in a
specific company.

Thanks in advance
Lars Holm
2010-08-20 07:03:03 UTC
Permalink
Hi Arne,

How about good old changecompany?

changecompany('xxx')
{
}

It's adviced to be careful with appl.setDefaultCompany because if your code
will fail, it might not revert to the right company. changecompany takes care
of that.

Best regards,
Lars
Post by Arne
Hi.
I have to open an URL link in another company.
In "normal" AX I do this by using the appl.SetDefaultCompany("company")
This does not work in enterprice portal.
The reason for this is that certain stuff is only to be created in a
specific company.
Thanks in advance
Arne
2010-08-20 08:47:03 UTC
Permalink
It does not seem to work.

I have found out that in regular AX when you pass a record of another
company than the one you are changing to in the Args it does not change
company. So I usually do a workaround, but in Enterprice Portal not even that
works.

Here is my code for changing company in Enterprice Portal, it should change
from NER to SLO, but it does not.

void clicked()
{
WebLink webLink = new WebLink();
ASMHelpDeskTable tbl;
DataAreaID currentDataAreaID = curExt();
;

if(ASMHelpDeskTable.SwapCompany != CurExt())
{
changeCompany(ASMHelpDeskTable.SwapCompany)
{
webLink.menufunction(new
WebURLMenuFunction(WebURLItemStr(CIT_CSS_SwapCreate)));
webLink.parm(strfmt('%1,%2', ASMHelpDeskTable.SwapCompany,
ASMHelpDeskTable.ASMCallId));
// webLink.record(ASMHelpDeskTable);
WebSession().redirect(webLink);

if(curuserID() == '20185')
info(strfmt('%1 --> %2',
currentDataAreaID,ASMHelpDeskTable.SwapCompany));
}

}
else
super();
}
Post by Lars Holm
Hi Arne,
How about good old changecompany?
changecompany('xxx')
{
}
It's adviced to be careful with appl.setDefaultCompany because if your code
will fail, it might not revert to the right company. changecompany takes care
of that.
Best regards,
Lars
Post by Arne
Hi.
I have to open an URL link in another company.
In "normal" AX I do this by using the appl.SetDefaultCompany("company")
This does not work in enterprice portal.
The reason for this is that certain stuff is only to be created in a
specific company.
Thanks in advance
Loading...