If you wanted to declare your own global variable object throughout AX application development, below code might be helpful to you.
[your COM DLL Class Name] = WMInterface (this is for my reference)
[your COM DLL Class Init()] = Init() (this is for my reference)
WMInterface WMI;
SysGlobalCache gch = appl.globalCache();
;
WMI = new WMInterface()
WMI.Init();
gch.set(classstr(WMInterface), "WMKey", WMI);
In above line "WMKey" is the unique key to store the unique entry for (Key, Value) pair and WMI is the value for this unique entry.
Thats all.
Now when you want to reuse this object declare, follow steps:
[your desired COM DLL Class method name] = OpenNewItem(int value) (this is for my reference)
WMInterface wmi;
SysGlobalCache gc = appl.globalCache();
;
wmi = gc.get(classstr(WMInterface),"WMKey",null);
wmi.OpenNewItem(1);
Hope it helps someone.
Thanks,
Ashlesh
No comments:
Post a Comment