Sometimes it's very annoying to do same thing again and again in Axapta. For example, you may want to use a form design in all companies or use same range for a report in all companies. This behavior can be called as "Inter company usage of SysLastValue". To do so, we must modify saveLast() and getLast() methods of xSysLastValue class.
Note: Use appropriate value for "Your company id" parameter.
\Classes\xSysLastValue\saveLast(Object caller)
static public void saveLast(Object caller)
{
;
// --> InterCompany
if (strScan(caller.lastValueElementName(), "SysTableBrowser", 1, strLen(caller.lastValueElementName())) )
{
classFactory.lastValuePut( caller.pack(),
"Your company id",
caller.lastValueUserId(),
caller.lastValueType(),
caller.lastValueElementName(),
caller.lastValueDesignName());
} // <-- else { classFactory.lastValuePut( caller.pack(), caller.lastValueDataAreaId(), caller.lastValueUserId(), caller.lastValueType(), caller.lastValueElementName(), caller.lastValueDesignName()); } }
\Classes\xSysLastValue\getLast(Object caller)
/*MAN
The method gets last choice.
Returns true if a last choice was found and unpacked
*/
static public boolean getLast(Object caller)
{
boolean initParm = true;
container value;
Utilelementtype u;
;
u = caller.lastValueType();
// --> InterCompany
if (strScan(caller.lastValueElementName(), "SysTableBrowser", 1, strLen(caller.lastValueElementName())) )
{
value = classFactory.lastValueGet( "Your company id",
caller.lastValueUserId(),
caller.lastValueType(),
caller.lastValueElementName(),
caller.lastValueDesignName());
} // <--
else
{
value = classFactory.lastValueGet( caller.lastValueDataAreaId(),
caller.lastValueUserId(),
caller.lastValueType(),
caller.lastValueElementName(),
caller.lastValueDesignName());
}
if (value)
initParm = ! caller.unpack(value);
if (initParm)
caller.initParmDefault();
return !initParm;
}
Microsoft Axapta Dynamics DAX Development X++ Blog Necmi GÖCEK Necmi GOCEK
2008-09-03
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment