If your user has a worker then you will have connected records in following two table DirPersonUser and hcmWorker.
In dirPersonUser table you can have a look at the user id, and using PersonParty field, try to find related record in the hcmWorker table,( field Person)
Or you can use the easy way ( by using hcmWorker.serid to worker method 🙂
In my case I was looking for 2 U letters anywhere in the name or the short name of the company.
static void Job107(Args _args)
TextBuffer companyShort = new TextBuffer();
TextBuffer companyName = new TextBuffer();
if (companyName.find(‘u.*u’) ||companyShort.find(‘u.*u’))
Nice links to check regexp stuff : http://www.zytrax.com/tech/web/regex.htm
And online editor to check if you were right: https://regex101.com/
When debugging on server do not forget to check if the Visual Studio Remote Debugging Monitor was run.
If not find it here:
Program Files\Microsoft Visual Studio 1x.0\Common7\IDE\Remote Debugger\x86\msvsmon.exe
Program Files\Microsoft Visual Studio 1x.0\Common7\IDE\Remote Debugger\x64\msvsmon.exe
and run it as administrator
So the issue was that I was supposed to create bunch of methods ( like parm) , when I knew the table fields, and where they had really similar code.
Instead doing that manually I have created a following job. Hope it helps 🙂
static void aka_createDetermineMethods(Args _args)
TreeNode tnclass, tntable,tnfield;
str code = "protected %1 %2()\n"+
"//overwritten in sub classes\n"+
" return '%3';\n"+
tnClass = TreeNode::findNode(@"\Classes\[class to add methods]");
tntable = TreeNode::findNode(@"\Data Dictionary\Tables\CustTable\Fields");
tnfield = tntable.AOTfirstChild();
name = "parm"+tnfield.treeNodeName();
tnMethod = tnClass.AOTfindChild(name);
tnMethod = tnClass.AOTadd(name);
tnMethod.AOTsetSource(strFmt(code, tnfield.AOTgetProperty("ExtendedDataType"), name,name));
tnfield = tnfield.AOTnextSibling();
If you have faced the similar situation using Microsoft Dynamics AX, do not worry as there are few solutions that may help you. Sometimes there are even less time consuming than the debugging in server itself.
One of the most favourite ones is to enter all data in the file, and than be able to trace necessary data. you Can find example below
fileName = @"\\c:\temp\sometext.txt";
perm = new FileIoPermission(fileName, 'W');
file = new AsciiIo(fileName, 'W');
//super smart code that needs debuggin
file.writeRaw("Super secret value to export");
//some other code
file = null;
When you have name of the enum and you know integer of the value that you want to display.
dictEnum = new DictEnum(enumName2Id(“NoYes”));
info( strFmt(“%1”, dictEnum.index2Label(1)));
Some part of code where taken from https://community.dynamics.com/ax/f/33/t/86432
I was looking for this little piece of code for too long to let it go.
So pretty much this code can be helpful. Enjoy
DictEnum dictEnum = new DictEnum(enumName2Id(“NoYes”));
info(int2str(dictEnum.name2value(“No”)));//<– that is label, not the name of the field
I was creating form and regarding on the value of the record, I had to add or remove specific form elements ( fields and etc. )
The most convenient place to do that is on a data source, in method Active. It is possible that you have to try few data sources and decide which one suits you more.
Although this doesn’t work during initialization of the form. When you open the form it gathers 0 instead of actual record value.
So pretty much this is the way to generate a line of csv file, getting value of the query table daa soucre field label values.
str output =””;
_query = new Query(“<nameOfTheQuery>”);
qR = new QueryRun(_query);
for(x = 1; x <= _query.dataSourceCount(); x++)
dictTable = new DictTable(_query.dataSourceNo(x).table());
for(y = 1; y <= _query.dataSourceNo(x).fields().fieldCount(); y++)
fieldId = _query.dataSourceNo(x).fields().field(y);
dictField = new DictField(dictTable.id(), fieldId);
if(dictField.arraySize() > 1)
output += strFmt(“%1%2”, dictField.label(), “|”);