Tuesday, March 31, 2009
how to pass the parameter form form a to form b
I can easily pass value from Form1 to Form2 using:
args.parm("hello" );
and can get value on Form2 using:
info(element. args().parm( ));
But how would I pass value from Form3 to Form1? How can I pass more than one values from Form3 to Form1?
You can use args.parmObject( ) to pass object as a parameter,
or pass reference of form1 by args.caller( )
Thursday, March 5, 2009
How to create a crash dump for Axapta processes ?
Here are the steps to do so:
- Download the Microsoft debugging tools, from here:
http://www.microsoft.com/whdc/devtools/debugging/installx86.Mspx
The 64-bit Version is available here:
http://www.microsoft.com/whdc/devtools/debugging/install64bit.mspx - Install the debugging tools on the problem machine.
- Switch to the install folder of the debugging tools using the command line.
- Attach the tracing tool(adplus) to the crashing process.
- Use the following command line options to attach the debugger.
adplus –crash –pn ax32.exe
adplus –crash –pn ax32serv.exe
oradplus –crash –p
To enable the Process ID, go to Task Manager\View\Select Columns…
PID (Process Identifier) - Now the tracing tool is active and should generate a crash dump, once the process crashes.
- You will find the dump file in the installation folder of the debugging tools.
- A correct crash dump file should look like this:
PID-4580__AX32.EXE__2nd_chance_UnknownException__full_1810_2008-12-04_20-53-48-528_11e4.dmp
Please focus on the 2nd_chance in the title. Please reattach the tracing tool again in case you get only 1st_chance exception, or just a log file(has a *.log extension).
Example: - Once you have created a second chance crash dump file, send it to the Microsoft MBS support to get the file analyzed in detail.
Creation of new financial dimension
- Base enum "SysDimension" : Find this base enum and right click on this base enum -> Select option "New element". In properties window give a name to this element say "TestDim" and label as "Test dimension". Save the base enum.
- Extended data type "Dimension" : Find this EDT and then add a new array element in this EDT. Name this array element as "TestDim". In properties window specify label as "Test dimension". Now in the "Relations" tab of this new array element add a new "Normal" relation first. To this normal relation open properties window and set property Table as "Dimensions" and Related field as "Num". Now add another relation of type "Related field fixed". To this related field fixed relation open properties window and set Related field as "DimensionCode" and property value as "3" (this is the value of the new enum element created in SysDimension). Save the EDT.
- Extended data type "DimensionCriteria" : Repeat the process of modification as done for EDT "Dimension" above.
- Extended data type "XMLMapDimension" : Find this EDT in AOT and then create a new array element for this EDT. Label this array element as "Test document value". Save the EDT.
- Extended data type "MandatoryDimension" : Find this EDT in AOT and then create a new array element for this EDT. Label this array element as "Validate test dimension". Save the EDT.
- Extended data type "DimensionLedgerJournal" : Find this EDT in AOT and then create a new array element for this EDT. Label this array element as "Test dimension". Save the EDT.
- Extended data type "DimensionKeepFromTransaction" : Find this EDT in AOT and then create a new array element for this EDT. Label this array element as "Keep transaction test dimension". Save the EDT.
- Extended data type "COSAllowDimensions" : Find this EDT in AOT and then create a new array element for this EDT. Label this array element as "Test dimension". Save the EDT.
- Extended data type "DimensionPriority" : Find this EDT in AOT and then create a new array element for this EDT. Label this array element as "Test dimension". Save the EDT.
- Extended data type "DimensionAllocation" : Find this EDT in AOT and then create a new array element for this EDT. Label this array element as "Test dimension". Save the EDT.
- Table "LedgerJournalTrans" : Find this table in AOT and add a new relation in the relations tab as follows. Create a new relation in relations tab and name it as say "interCoDimension3" (You can see three more similar relations with suffix 0, 1 and 2 for three standard dimensions). Now set the property table of this relations as "Dimensions". Create a new "Normal" relation under this realtion tab and set the property "Field" = "OffsetCompany" and property "RelatedField" = "dataAreaId". Create another "Normal" relation under this relation tab and set the property "Field" = "InterCoDimension[4]" and property "RelatedField" = "Num". Now create a new "Related field fixed" relation under this tab and set property "Value" = 3 (this is the value of the new enum element created in SysDimension) and property "Related field" = "DimensionCode". Save the changes.
The new financial dimension is successfully created in AX and can be viewed in different forms through out the AX where ever dimensions are used.
Wednesday, February 4, 2009
Extracting data from Ax3.0 to Xml
============ ========= ==
static XML getAllDlvMode( )
{
DlvMode dlvMode;
XML xml;
;
xml = '
return xml;
}
============ ========= ========= =======
Sample code to load and parse XML file:
============ ========= ========= =======
XMLDocument XMLDOM;
XMLNodeList XMLNodes_ItemOut;
TextBuffer tbPurchOrder;
boolean blnXMLLoaded;
str nodeText;
;
XMLDOM = new XMLDocument( ) ;
XMLDOM.async( false);
XMLDOM.setProperty( "ServerHTTPReque st", true);
strUNCFileName_ reg = strfmt("%1", _strFileName) ;
tbPurchOrder = new TextBuffer() ;
tbPurchOrder. fromFile( strRTrim( strLTrim( strUNCFileName_ reg)));
temp = tbPurchOrder. getText() ;
blnXMLLoaded = XMLDOM.loadXML( temp);
if(blnXMLLoaded)
{
//parse the XMLDOM
nodeText = strXMLDOM.selectSin gleNode(" path/nodeName" ).text
();
}
============ ========= ========= ========= ========= =========
Sample code to write a file
============ ========= ========= ========= ========= ========= =========
AsciiIo oAsciiIo;
str strFilePath, strMode, strLog;
;
//oAsciiIo = new AsciiIo(strFileName , "A");
oAsciiIo = new AsciiIo(strFilePath , strMode);
oAsciiIo.write( strLog);
/*
You may use WinAPI static methods to create and manage folders.
e.g.: if (!WinAPI::folderExi sts(strFolderPat h))
WinAPI::createDirec tory(strFolderPa th);
*/
============ ========= ========= ========= ========= ========= ========
Working with Dynamics AX Table Meta Data
Recently I had to create a custom database log for a client. Dynamics AX does come with a database log feature (with the proper license key). However, my client wanted something different to allow easier reporting and tracking of changes. The log must be searchable, filterable, and sortable based on any field. For instance, if the CustTable updates were being logged, the user must be able to search, filter, and/or sort by CustGroup, AccountNum, or any other field that was logged. The standard log does not have this capability.
It was decided that in order to achieve these goals, each table to be logged (source) should have its own log table. The log table would mirror the table structure of the source table, with some additional log specific fields, such as log type, date and time of log, changed by, etc. The custom log needed to be able to record the same table events as the standard log (inserts, updates, deletes, and rename keys).
Problem
I had to have a way to perform a field-to-field data transfer from the source table to the log table (ie. source.AccountNum --> log.AccountNum). My initial thought was to copy the data using the intrinsic "data" method on table buffer object. This method allows a table buffer (record) to be passed to the "data" method of another (empty) table buffer to be copied field for field, with the exception of system fields like RecId, RecVersion, etc. It turns out that a field-to-field data copy only works if the two table buffers are of the same table. Unfortunately, even if the field names were the same, the "data" method does not copy the data if the table buffers objects were for different tables.
I needed to write my own data copy function. My function had to be generic, because I didn't want to hard-coded the field name and the mappings between the source and log tables. Additionally, I didn't want to have to update my code each time a new field was added or removed from the source table. In order to make the log function in a generic way, I needed to the meta data within Dynamics AX.
Solution
Below is the code for the static method I created to transfer the data from the source table to the log table. I've placed comments in red to explain the interesting parts of the code.
Basically the method loops through the fields of the source table, and assigns it to the corresponding field in the log table. By using the SysDictTable class, I'm able to retrieve the field list for the source table. This allows me to "see" all the fields, including newly added fields. I also do not have to deal with deleted fields, because they won't appear in the field list.
The challenging part of this method was dealing with array fields. These are fields that are based on an extended data type that is an array. A prime example of this type of field is the "Dimension" field found in many master and transactions tables. Each array element translates to a single field in the table in the database. In Dynamics AX, an array field appears as a single field would. It has a field ID just like any other field, with one exception. An array field has what's called an "extended field ID". This is the combination of the field's ID and the element's position or index in the array. Therefore, to properly retrieve the data for an array field, you must properly address the field's array element to get the correct field ID. This can be done via the "fieldId2Ext" function.
static void copyDataToLog(Common _fromTable, Common _toTable)
{
SysDictTable fromDictTable;
SysDictField fromDictField;
SysDictTable toDictTable;
SysDictField toDictField;
int fields;
int fieldIndex;
int arraySize;
int arrayIndex;
int fromFieldId;
int toFieldId;
;
// Instantiate the SysDictTable object. The SysDictTable class
// extends the DictTable class. By using the SysDictTable class,
// instead of the DictTable class, you get the ability override methods,
// and get the field list, among other things.
//
// I use the SysDictField class in the same way as I use the
// SysDictTable class to process and the retrieve meta data
// about the fields. It provides information about each field.
fromDictTable = new SysDictTable(_fromTable.TableId);
toDictTable = new SysDictTable(_toTable.TableId);
// Loop through the field list for the source table.
// Note that the loop excludes the system fields, such as
// RecId, RecVersion, CreatedDate, CreatedBy, etc. Each
// table will have its own set of system fields, which will be
// populated by Dynamics AX when the record is inserted.
fields = fromDictTable.fieldCnt();
for (fieldIndex = 1; fieldIndex <= fields; fieldIndex++)
{
fromDictField = new SysDictField(fromDictTable.id(),fromDictTable.fieldCnt2Id(fieldIndex));
if (!fromDictField.isSystem())
{
// Some tables contain fields that inherit from array extended data
// types. An example of an array field is the "Dimension" field,
// found in tables throughout the database.
// Each element in the array field corresponds to a real field
// in the database. The concept of field ID still exists for array
// fields, but with a little twist. The field ID for each
// array element is called an "extended field ID". This extended
// field ID is the combination of the field ID and the array index
// for the element.
// The function "fieldId2Ext" provides a way to get an array field's
// field ID.
if (fromDictField.arraySize() > 1)
{
// Field is an array (ie. Dimension).
arraySize = fromDictField.arraySize();
// Loop through each array field's element to copy its value
// to the corresponding log array field's element.
for (arrayIndex = 1; arrayIndex <= arraySize;arrayIndex++)
{
fromFieldId = fieldId2Ext(fromDictField.id(),arrayIndex);
toFieldId = fieldId2Ext(fieldName2Id(_toTable.TableId, fromDictField.name()), arrayIndex);
// Note that field values may be assigned and retrieved using
// the field ID instead of the field name.
_toTable.(toFieldId) = _fromTable.(fromFieldId);
}
}
else
{
// Use the "fieldName2Id" function to convert the field name
// from the source table to the corresponding field ID for the
// log table. This is possible because the field names in the log
// table are the same as the source table.
toFieldId = fieldName2Id(_toTable.TableId,fromDictField.name());
_toTable.(toFieldId) = _fromTable.(fromDictField.id());
}
}
}
}
Conclusion
Using this static method, I'm able to copy the source table fields to the log table fields. This method illustrates one possible usage of system meta data as provided by the "Dict*" classes to perform generic work. These classes provided the necessary information about the table and fields to perform the task without the need to hard-code table or field names. There are several other "Dict" classes that provide information about other application objects.
Installation assembly with GAC
Wednesday, January 14, 2009
How to count the number of record in a table
{
int64 getRecordCount( str _tname)
{
common common;
SysDictTable dictTable = new SysDictTable( tableName2id( _tname));
;
common = dictTable.makeRecor d();
select count(RecId) from common;
return common.RecId;
}
;
info(strfmt("Number of records in %1 is %2", "CustTable", getRecordCount("CustTable")));
}
Sunday, December 21, 2008
Singleton pattern
Mandatory DialogField
Determining if an object is a subclass
Set Class
Set consist of a data set that contains values of the same type, where value is unique.
A Set is alway sorted on the value.
Define
Set s = new Set(Types::STRING);
Insert a value
s.add("Wassini");
s.add("Eric");
Exists value
To see if a value already is added, use the in method:
if (s.in("Wassini"))
print "Yes!";
else
print "No!";
Getting values
There are several ways to get the values in the set.
Using a SetIterator
Using a SetEnumerator
SetIterator
The SetIterator loops throug the complete set:
SetIterator si;
si = new SetIterator(s);
while (si.more())
{
print si.value();
si.next();
}
SetEnumerator
SetEnumerator class is like SetIterator class, but allows the deletion of elements during enumeration and SetIterator does not.
SetEnumerator se=s.getEnumerator();
while (se.moveNext())
{
print se.current();
}
Removing values
Just use the remove method to remove the active value.
s.remove("Wassini");
Other methods
// Get number of elements:
print s.elements();
// Get the used types:
print s.definitionString();
// Dump the whole set as a string:
print s.toString();
Map Class
A Map is alway sorted on the key value.
Contents [hide]
1 How to use
1.1 Define
1.2 Insert a value
1.3 Exists value
1.4 Getting values
1.4.1 MapIterator
1.4.2 MapEnumerator
1.4.3 Direct method
1.5 Removing values
1.6 Updating values
1.7 Other methods
2 See also
How to use
Define
Map m = new Map(Types::STRING, Types::INTEGER); Insert a value
m.insert("Wassini", 37);
m.insert("Eric", 102); Exists value
To see if a value already is added, use the exists method:
if (m.exists("Wassini"))
print "Yes!";
else
print "No!"; Getting values
There are several ways to get the values in the map.
Using a MapIterator
Using a direct method
MapIterator
The MapIterator loops throug the complete map:
MapIterator mi;
mi = new MapIterator(m);
while (mi.more())
{
print mi.key();
print mi.value();
mi.next();
} MapEnumerator
MapEnumerator class is like MapIterator class, but allows the deletion of elements during enumeration and MapIterator does not.
MapEnumerator me = m.getEnumerator();
while (me.moveNext())
{
print me.currentKey();
print me.currentValue();
} Direct method
It is possible to get find a specific value from the key:
print m.lookup("Wassini"); Removing values
Just use the remove method to remove the active key/value pair.
m.remove("Wassini"); Updating values
It is not possible to update a value directly:
int age;
str keyid = "Wassini";
age = m.exists(keyid) ? m.lookup(keyid) : 0;
m.insert(keyid, age + 1); Other methods
// Get number of elements:
print m.elements();
// Get the used types:
print m.definitionString();
// Dump the whole map as a string:
print m.toString();
Image Class
The class can construct and manipulate Image objects of the following file types:
Raster (bitmap) formats - .bmp, .gif, .jpg, .png, .tiff, and .exif
Vector formats - .emf and .wmf
Because of security reasons the class in Dynamics Ax can not be run from the server and is bound to the client.
The image object can be created from scratch, captured from the screen or loaded from a file. It can then be cropped, resized, flipped, rotated etc...
Examples
Load an image from file and place it in a table:
Image image;
str fileName;
;
filename = myImagePath + myImageFile;
if (Image::canLoad(Filename))
{
image.loadImage(Filename);
myTable.imageContainer = image.getData();
}...and to display the image on a form:
Image Image;
container imageContainer;
;
imageContainer = myTable.imageContainer;
Image = new Image();
Image.setData(imageContainer);
imageWindow.image(Image);
imageWindow.widthValue(image.width());
imageWindow.heightValue(image.height());
Array Class
The array is created with a type that defines what contents the array contains. It can not use Types::Anytype!
Contents
1 Example
2 Tips
3 Methods
4 See also
Example
array a = new array(Types::string);
a.value(1, "First");
a.value(2, "Second");
a.value(3, "Third");
print a.lastIndex();
print a.toString();
pause;
Tips
When inserting the array is dynamicly expanded. If you just want to add an element to the end of the array it is possible to use:
a.value(a.lastIndex()+1, "element");
If a container is needed use the pack method:
c = a.pack();
Methods
definitionString
exists
lastIndex
pack
toString
typeId
Validate field values on form
Example:
Change the behavior of the "Customer Group" on "CustTable" form.
Overwrite the method "validate" on the field "CustGroup" on the data source on "CustTable" public boolean validate()
{
boolean ret;
ret = super();
return ret;
}
Change method:
public boolean validate()
{
boolean ret;
;
if(custTable.orig().CustGroup == '30') // Non changeable group.
{
info('You cannot change this Customer group');
ret = false;
} else {
ret = super();
}
return ret;
}
Note: I've explained the general principle for validating a field against it's old value, however there are some issues with the data source not refreshing data set when changing the value back and forth.
How to count records in a Query
QueryRun qr;
QueryBuildDataSource qbd;
;
q = new Query();
qbd = q.addDataSource(TableNum(CustTable));
qr = new QueryRun(q);
info(int2str(SysQuery::countTotal(qr)));
As seen you can use SysQuery object.
Runtime / Performance considerations
The call you are doing here works well if and only if you have exactly one datasource in the query. In the case you are starting to join up stuff here, things get complicated, as the implementation behind this call (specifically SysQuery::countPrim()) does actually loop over the entire resultset. It has to be taken with care therefore.
Retrieved from "http://www.axaptapedia.com/How_to_count_records_in_a_Query"
Create New AOT Project From Template
// and automatically creates a new Project from a Template Project.
//
static void CreateNewAOTProjectFromTemplate(Args _args)
{
ProjectNode templateproject;
ProjectNode pretargetproject;
ProjectNode targetproject;
TreeNode sharedProject;
UtilElements utilElement;
str templateprojectname;
str pretargetprojectname;
str targetprojectname = 'AATest';
str pretargetprojectname()
{
return pretargetprojectname;
}
;
// Get the templateprojectname from someplace where the name of a Template project can be found.
// NOTE: You'll need to change this Line and assign your own Template name.
templateprojectname = DPA_Parameters::find().AOTProjectTemplate;
sharedProject = SysTreeNode::getSharedProject();
if (sharedProject.AOTfindChild(targetprojectname))
return;
// Find the Template Project and load it for inspection
templateproject = sharedProject.AOTfindChild(templateprojectname);
if (!templateproject)
return;
templateproject.loadForInspection();
// Duplicate the Template Project using an intermediary ProjectNode
pretargetproject = templateproject.AOTDuplicate();
pretargetproject.AOTsave();
// Get the name of the duplicated project - CopyOf%1 (%1 = whatever the Template name is)
pretargetprojectname = pretargetproject.AOTname();
// Rename the duplicated Project to the desired project name.
// NOTE: I tried other ways, but this is the only way that worked!
// And, it's fast!
ttsbegin;
select firstonly forupdate utilElement
where utilElement.recordType == UtilElementType::SharedProject
&& utilElement.name == pretargetprojectname();
if (utilElement)
{
utilElement.name = targetprojectname;
utilElement.doUpdate();
}
ttscommit;
// Have to refresh the SharedProject Node - Very important!
sharedProject.AOTrefresh();
// Now just get the new project and open it.
targetproject = sharedProject.AOTfindChild(targetprojectname);
targetproject.AOTrun();
}
Friday, December 19, 2008
working on Bits
importing chart of accounts from CSV file
working on container
Active X create Analog Meter
delete Files In Folder
ExecuteCodeFromFile
FileOperations
getTableProperty
Set Examples
realPrecision
setTableProperty
Test Query
TestDateTimeConversion
Thursday, December 18, 2008
Using global search for virtual tables
Now, if some of your tables that are searched belong to a virtual company, the data crawler will mark them as records of the company it is running in. That means that if you want to search for your virtual data from a different company, it will return no results.
Example: you have the companies xxx and yyy and a virtual company vir. Table CustTable is virtual (dataareaid of the records is vir). The data crawler runs in company xxx and will mark the CustTable records as belonging to company xxx .
Now, if you start a search in company yyy, it will not find the Custtable records as they seem to belong to a different company. You could only set up a second data crwaler for company yyy which would collect exactly the same records and you would need to store them twice in your database.
The following changes will circumvent that: you will be able to see data from different companies. There are some drawbacks, however: you will be able to see search results from your "data crawler company". But it the data is from a non-virtual table, you will not be able to see the results. But I hope it will lead you to a way where you can make your own modifications to get the best out of the global search. Remember: all changes you make are at your own risk.
Here are the changes you have to do:
Class SysGSSearchStart, method startSearch
comment the following line:
infolog.add(Exception::Warning,"@SYS98793");
With that, there will be no warning if you are working in a company where the data crawler is not running.
Class SysSearch, method search:
at line 28, just after "if (!searchname)" add:
select firstonly RecId from sysSearchName
where sysSearchName.Design == 'SDS_xxx_default'
&& sysSearchName.LanguageId == this.languageId();
if (!sysSearchName)
replace the xxx in the 'SDS_xxx_default' with the company id where the data crawler is running.
Class SysSearch, methods searchWord and searchExactWord:
at line 11, replace the "where sysSearchName.Design == this.design() &&" with:
where (sysSearchName.Design == this.design()
sysSearchName.Design == 'SDS_xxx_default') &&
again, replace the xxx in the 'SDS_xxx_default' with the company id where the data crawler is running.
Class SysSearchDoDataSearch, method buildItemListXML:
at line 11, after a while select indextable from sysDataSearch block, add the following code:
changecompany('xxx')
{
sysDataSearch = null;
while select IndexTable from sysDataSearch
{
dictTable = new DictTable(sysDataSearch.IndexTable);
if (dictTable.rights() != AccessType::NoAccess)
searchTableMap.insert(dictTable.id(),0);
}
}
sysDataSearch = null;
Replace 'xxx' with the company id where the data crawler is running.
At line 77, after select sysDataSearch where sysDataSearch.SearchGroupId == m_eSearchGroupDef && sysDataSearch.IndexTable == tableid; add the following code:
if (!sysDataSearch)
{
changecompany('xxx')
{
sysDataSearch = null;
select sysDataSearch
where sysDataSearch.SearchGroupId == SearchGroupDef
&& sysDataSearch.IndexTable == tableid;
}
}
Replace 'xxx' with the company id where the data crawler is running.
Using global search for virtual tables
Now, if some of your tables that are searched belong to a virtual company, the data crawler will mark them as records of the company it is running in. That means that if you want to search for your virtual data from a different company, it will return no results.
Example: you have the companies xxx and yyy and a virtual company vir. Table CustTable is virtual (dataareaid of the records is vir). The data crawler runs in company xxx and will mark the CustTable records as belonging to company xxx .
Now, if you start a search in company yyy, it will not find the Custtable records as they seem to belong to a different company. You could only set up a second data crwaler for company yyy which would collect exactly the same records and you would need to store them twice in your database.
The following changes will circumvent that: you will be able to see data from different companies. There are some drawbacks, however: you will be able to see search results from your "data crawler company". But it the data is from a non-virtual table, you will not be able to see the results. But I hope it will lead you to a way where you can make your own modifications to get the best out of the global search. Remember: all changes you make are at your own risk.
Here are the changes you have to do:
Class SysGSSearchStart, method startSearch
comment the following line:
infolog.add(Exception::Warning,"@SYS98793");
With that, there will be no warning if you are working in a company where the data crawler is not running.
Class SysSearch, method search:
at line 28, just after "if (!searchname)" add:
select firstonly RecId from sysSearchName
where sysSearchName.Design == 'SDS_xxx_default'
&& sysSearchName.LanguageId == this.languageId();
if (!sysSearchName)
replace the xxx in the 'SDS_xxx_default' with the company id where the data crawler is running.
Class SysSearch, methods searchWord and searchExactWord:
at line 11, replace the "where sysSearchName.Design == this.design() &&" with:
where (sysSearchName.Design == this.design()
sysSearchName.Design == 'SDS_xxx_default') &&
again, replace the xxx in the 'SDS_xxx_default' with the company id where the data crawler is running.
Class SysSearchDoDataSearch, method buildItemListXML:
at line 11, after a while select indextable from sysDataSearch block, add the following code:
changecompany('xxx')
{
sysDataSearch = null;
while select IndexTable from sysDataSearch
{
dictTable = new DictTable(sysDataSearch.IndexTable);
if (dictTable.rights() != AccessType::NoAccess)
searchTableMap.insert(dictTable.id(),0);
}
}
sysDataSearch = null;
Replace 'xxx' with the company id where the data crawler is running.
At line 77, after select sysDataSearch where sysDataSearch.SearchGroupId == m_eSearchGroupDef && sysDataSearch.IndexTable == tableid; add the following code:
if (!sysDataSearch)
{
changecompany('xxx')
{
sysDataSearch = null;
select sysDataSearch
where sysDataSearch.SearchGroupId == SearchGroupDef
&& sysDataSearch.IndexTable == tableid;
}
}
Replace 'xxx' with the company id where the data crawler is running.
Send message to online user in Dynamics AX 4.0 (quick & dirty)
{
EventInbox inbox;
EventInboxId inboxId;
inboxId = EventInbox::nextEventId();
inbox.initValue();
inbox.ShowPopup = NoYes::Yes;
inbox.Subject = "Message to online user";
inbox.Message = "Message you want to send to user";
inbox.SendEmail = false;
inbox.UserId = curUserID();
inbox.InboxId = inboxId;
inbox.AlertCreatedDate = systemdateget();
inbox.AlertCreateTime = timeNow();
inbox.insert();
}
Be careful when resetting your usage data
But here's another thing for you:
in Dynamics AX 4.0, a "Favorites" menu was introduced. You can drag a form to your favorites pane. Then you will be asked to give it a name, and: you can add a saved query to it. With that, you can easily make favorites the open the forms filtered on the data you just need.
But there's another thing: as long as your system is still in change, everybody recommends that you delete your usage data from time to time (in User/Options).
But what happens to your favorites if you delete all your usage data?
The answer is: you'll get an error message. The system will tell you that it cannot find your saved query anymore. So, the whole work saving your queries and making your favorites is lost.
A small little addition to the method "reset" in the form "SysLastValue" will help you avoid that.
Add the line
&& _sysLastValue.recordType != UtilElementType::UserSetupQuery;
in the "delete_from" statement.
So, the deletion will not delete your saved queries.
Things that could be improved:
- Only skip queries that have been saved with a name
- Only skip queries that are used for a favorite menu item
Automatically open grid filter when opening form
this.task(2855);
So, your run() method should look like:
public void run()
{
..... // some programming lines....
super();
this.task(2855);
}
Activating query tracing for all users
static void Set_SQLTrace_AllUsers(Args _args)
{
#LOCALMACRO.FLAG_SQLTrace (1 << 8) #ENDMACRO
#LOCALMACRO.FLAG_TraceInfoQueryTable (1 << 11) #ENDMACRO
boolean set;
UserInfo userInfo;
;
set = true;
ttsbegin;
while select forupdate userinfo
{
userinfo.querytimeLimit = 1000;
if (set)
{
userInfo.DebugInfo = userInfo.DebugInfo | #FLAG_SQLTrace;
userInfo.TraceInfo = userInfo.TraceInfo | #FLAG_TraceInfoQueryTable;
}
else
{
userInfo.DebugInfo = userInfo.DebugInfo ^ #FLAG_SQLTrace;
userInfo.TraceInfo = userInfo.TraceInfo ^ #FLAG_TraceInfoQueryTable;
}
userinfo.update();
}
ttscommit;
}
AD user creation
Basics of changecompany
Browse the data dictionary with X++
Caching in Microsoft Axapta
How to identify the user that was used to change an object from AOT in AX2012
Get the object name for which we need to track these (user and date&time) information's. Login to SQL Server Management Studio an...
-
I've recently found an interesting feature of DAX4 Object Server: it can run not only as a service, but also as a console application st...
-
static void CreateTransferOrderLine(Args _args) { InventTransferTable inventTransFerTable; InventTransferLine inventTransFerLine; ...
-
Settlement feature allows you to select the open transactions(Vendor / customer) and then you can post the payment journal for the same. I...