In this blog post we will see how to Disable or Hide the query select button using controller class.
override the showQuerySelectButton method in controller class and just add ret = false;
public boolean showQuerySelectButton(str parameterName)
{
boolean ret;
ret = super(parameterName);
ret = false;
return ret;
}
Monday, March 30, 2020
AX 2012 Roles Associated with current user Using X++
In this blog post we will will find the Security Role assigning to the particular user using X++ in AX 2012.
SecurityRole role;
SecurityUserRole userRole;
UserInfo userinfo;
While select role
exists join userRole
where role.RecId == userRole.SecurityRole
&& userRole.User == curUserId()
{
info(role.Name );
}
SecurityRole role;
SecurityUserRole userRole;
UserInfo userinfo;
While select role
exists join userRole
where role.RecId == userRole.SecurityRole
&& userRole.User == curUserId()
{
info(role.Name );
}
Wednesday, March 18, 2020
add address tab on custom form D365FO
In this post we see how to add address tab on custom form dynamics 365 finance and operation. The scenario was to add the tab on custom form same like as on customer or vendor form.
For this scenario we will look how to add the address tab.
Step 1: Create new table or add the DirPartyRecid on your table and make the relationship with DirPartyTable
Step 2: Create new form or add MainTable and DirPartTable in form datasource
Step 3: Set the properties on DirPartyTable datasource
Step 4: Add tab page on form and add form part control in it
Step 5: Set the properties on the form part control in the Menu Item Name set (LogisticsPostalAddressGridFormPart)
Step 6: Add link and set the properties on it.
Step 7: See the results as shown below
For this scenario we will look how to add the address tab.
Step 1: Create new table or add the DirPartyRecid on your table and make the relationship with DirPartyTable
Step 2: Create new form or add MainTable and DirPartTable in form datasource
Step 3: Set the properties on DirPartyTable datasource
Step 4: Add tab page on form and add form part control in it
Step 5: Set the properties on the form part control in the Menu Item Name set (LogisticsPostalAddressGridFormPart)
Step 6: Add link and set the properties on it.
Step 7: See the results as shown below
Thursday, March 12, 2020
X++ Create and post Journal voucher
In this blog we will see how to write the job for Create and post Journal voucher in dynamics ax 2012.
static void legerDimCreateGLJournal(Args _args)
{
AxLedgerJournalTable journalTable;
AxLedgerJournalTrans journalTrans;
container accCon;
container offSetCon;
LedgerJournalTable ledgerJournalTable;
ledgerJournalCheckPost ledgerJournalCheckPost;
;
journalTable = new AxLedgerJournalTable();
journalTrans = new AxLedgerJournalTrans();
//Journal Name
journalTable.parmJournalName("GenJrn");
journalTable.save();
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);
journalTrans.parmTransDate(systemDateGet());
journalTrans.parmAccountType(LedgerJournalACType::Ledger);
accCon = ["110110","110110", 2, "BusinessUnit","001", "Department", "023"];
journalTrans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(accCon));
journalTrans.parmAmountCurDebit(20);
journalTrans.parmOffsetAccountType(LedgerJournalACType:: Ledger );
offSetCon = ["110110","110110", 2, "BusinessUnit","001", "Department", "024"];
journalTrans.clearField(fieldNum(LedgerJournalTrans, OffsetLedgerDimension), false);
journalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId( offSetCon));
journalTrans.save();
ledgerJournalCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(journalTable.ledgerJournalTable(),NoYes::Yes);
ledgerJournalCheckPost.run();
info(strFmt("Journal No. %1.", journalTable.ledgerJournalTable().JournalNum));
}
static void legerDimCreateGLJournal(Args _args)
{
AxLedgerJournalTable journalTable;
AxLedgerJournalTrans journalTrans;
container accCon;
container offSetCon;
LedgerJournalTable ledgerJournalTable;
ledgerJournalCheckPost ledgerJournalCheckPost;
;
journalTable = new AxLedgerJournalTable();
journalTrans = new AxLedgerJournalTrans();
//Journal Name
journalTable.parmJournalName("GenJrn");
journalTable.save();
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);
journalTrans.parmTransDate(systemDateGet());
journalTrans.parmAccountType(LedgerJournalACType::Ledger);
accCon = ["110110","110110", 2, "BusinessUnit","001", "Department", "023"];
journalTrans.parmLedgerDimension(AxdDimensionUtil::getLedgerAccountId(accCon));
journalTrans.parmAmountCurDebit(20);
journalTrans.parmOffsetAccountType(LedgerJournalACType:: Ledger );
offSetCon = ["110110","110110", 2, "BusinessUnit","001", "Department", "024"];
journalTrans.clearField(fieldNum(LedgerJournalTrans, OffsetLedgerDimension), false);
journalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId( offSetCon));
journalTrans.save();
ledgerJournalCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(journalTable.ledgerJournalTable(),NoYes::Yes);
ledgerJournalCheckPost.run();
info(strFmt("Journal No. %1.", journalTable.ledgerJournalTable().JournalNum));
}
Lookup for color Picker In Ax 2012
In this blog we will see how to make lookup for color picker in Dynamics Ax 2012. In a grid we will give the drop down for color picker.
Public void lookup()
{
#DEFINE.COLORVALUE(64)
Int r,g,b
container choosencolor;
Binary customcolors = new Binary(#COLORVALUE);
CCColor colorvalue;
Super();
[r,g,b] = WinAPI::RGBint2Con(this.backgroundColor());
chosenColor = WinAPI::chooseColor(element.hWnd(),r,g,b, customColors, true);
If(chosencolor)
{
[r, g, b] = chosencolor;
Colorvalue = WinAPI::RGB2int(r,g,b);
This.backgroundColor(colorValue);
employeeWorkPlannerForm.parmAbsensceColor(colorvalue);
Employeetable.columns(employeeworkplannerform.numberofcolumns());
Absenscecolorparm = colorvalue;
}
}
- Make Int feild in Table
- Add as a datasource of form
- Overide Lookup Mehtrod of the Int feild
Public void lookup()
{
#DEFINE.COLORVALUE(64)
Int r,g,b
container choosencolor;
Binary customcolors = new Binary(#COLORVALUE);
CCColor colorvalue;
Super();
[r,g,b] = WinAPI::RGBint2Con(this.backgroundColor());
chosenColor = WinAPI::chooseColor(element.hWnd(),r,g,b, customColors, true);
If(chosencolor)
{
[r, g, b] = chosencolor;
Colorvalue = WinAPI::RGB2int(r,g,b);
This.backgroundColor(colorValue);
employeeWorkPlannerForm.parmAbsensceColor(colorvalue);
Employeetable.columns(employeeworkplannerform.numberofcolumns());
Absenscecolorparm = colorvalue;
}
}
X++ Create and post movement journal in AX 2012
static void createMovementJournalAx(Args _args)
{
InventJournalTable inventJournalTable;
InventJournalTrans inventJournalTrans;
InventJournalNameId inventJournalName;
InventDim inventDim;
JournalCheckPost journalCheckPost;
//Below code creates journal header
inventJournalTable.clear();
inventJournalName = InventJournalName::standardJournalName(InventJournalType::Movement);
inventJournalTable.initFromInventJournalName(InventJournalName::find(inventJournalName ));
inventJournalTable.insert();
//Below code creates journal lines
inventJournalTrans.clear();
inventJournalTrans.initFromInventJournalTable(inventJournalTable);
inventJournalTrans.TransDate = systemDateGet();
inventJournalTrans.ItemId = "L0001";
inventJournalTrans.initFromInventTable(InventTable::find("L0001"));
inventJournalTrans.Qty = 25;
inventDim.InventSiteId = '1';
inventDim.InventLocationId = '13';
inventDim.wMSLocationId = '13';
inventJournalTrans.InventDimId = inventDim::findOrCreate(inventDim).inventDimId;
inventJournalTrans.insert();
//The below code posts the journal
journalCheckPost = InventJournalCheckPost::newPostJournal(inventJournalTable);
journalCheckPost.run();
}
{
InventJournalTable inventJournalTable;
InventJournalTrans inventJournalTrans;
InventJournalNameId inventJournalName;
InventDim inventDim;
JournalCheckPost journalCheckPost;
//Below code creates journal header
inventJournalTable.clear();
inventJournalName = InventJournalName::standardJournalName(InventJournalType::Movement);
inventJournalTable.initFromInventJournalName(InventJournalName::find(inventJournalName ));
inventJournalTable.insert();
//Below code creates journal lines
inventJournalTrans.clear();
inventJournalTrans.initFromInventJournalTable(inventJournalTable);
inventJournalTrans.TransDate = systemDateGet();
inventJournalTrans.ItemId = "L0001";
inventJournalTrans.initFromInventTable(InventTable::find("L0001"));
inventJournalTrans.Qty = 25;
inventDim.InventSiteId = '1';
inventDim.InventLocationId = '13';
inventDim.wMSLocationId = '13';
inventJournalTrans.InventDimId = inventDim::findOrCreate(inventDim).inventDimId;
inventJournalTrans.insert();
//The below code posts the journal
journalCheckPost = InventJournalCheckPost::newPostJournal(inventJournalTable);
journalCheckPost.run();
}
Sunday, March 8, 2020
Filter LocationID lookup by name D365FO
We will see how to filter location id by name.
Add new string in table and set any name is my case name is (InventLocation) as shown in image below
Create a new relation with InventLocation Table and set the relation properties.
Create a new form for lookup set the design pattern Lookup - Basic. In data source add the IventLocation table.
Add grid in the form and add fields.
Override the form run method and write the code in it
Now add the field in original form to show the lookup. Override Lookup and resolveAmbiguousReference method on string control (A_Student_InventLocation)
Now write the code in lookup and resolveAmbiguousReference method
Lookup Method
resolveAmbiguousReference Method
After this build and sync the project and you will get appropriate result as shown below.
For more information please see the following link
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/user-interface/contextual-data-entry-lookups
Add new string in table and set any name is my case name is (InventLocation) as shown in image below
Create a new relation with InventLocation Table and set the relation properties.
Create a new form for lookup set the design pattern Lookup - Basic. In data source add the IventLocation table.
Add grid in the form and add fields.
Override the form run method and write the code in it
Now add the field in original form to show the lookup. Override Lookup and resolveAmbiguousReference method on string control (A_Student_InventLocation)
Now write the code in lookup and resolveAmbiguousReference method
Lookup Method
resolveAmbiguousReference Method
After this build and sync the project and you will get appropriate result as shown below.
For more information please see the following link
https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/user-interface/contextual-data-entry-lookups
Tuesday, March 3, 2020
Filter lookup By Name D365 Finance and Operation
Today, we will see how to filter record based on the name or description. By default this functionality is not enable on lookup.
See the image below that is my default lookup.
When we write in the box student id, it automatically filter the record that the default behavior of any lookup. See the below Image.
But when we search from Name It shows nothing
To search with name we will set the Cache Lookup property on the Header table .
Now, we are able to filter the lookup by name.
For more information please see the following link.
Subscribe to:
Posts (Atom)