Display Method:
The display method means that the method’s return value is being displayed on a form or a report. This value is fixed and cannot be edited on the form or report. If a user only wants to display the value display method is used.
The display method means that the method’s return value is being displayed on a form or a report. This value is fixed and cannot be edited on the form or report. If a user only wants to display the value display method is used.
Using table initValue() we can set default values of any table field during creating a new record. This can also be done on a form level so that the value will only be set for the specific form. Here is the example, let's suppose the table is yourTable and fields are currentDate, YourField
public void initValue() { super(); // setting current date time yourTable.currentDate = this.Now();
//setting any default value yourTable.YourField = "Default value";
}
Here is the X++ code to send the custom notification alert in Ax 2012.
Microsoft Dynamics 365FO (AX 7) is web-based and there is no separate client.
For development, Microsoft Dynamics 365FO (AX 7) uses Visual Studio (VS) IDE whereas the older version Ax 2012 uses MorphX.
Another is the Introduction of data entities in Dynamics D365 Finance and Operations
This blog will explain all possible ways where form control can be accessed in form using event handlers at different form levels. Events on a form are available at the form level, form control level and on the datasources level in Dynamics 365 for Operations (AX7).
We will access the form control in following
Form Control Access in Form’s Method pre/post Event Handlers
For example, we are using the CustTable form. and using the init method pre-event handler. we are going to access the CustTable_name control in the event handler. Both pre post event contail XppPrePostArgs class parameter. This will provides information about arguments and return values for event handlers.
Firstly, stop the AOS service before starting the compilation
Open the command prompt and type the below command to compile Ax 2012. You can found AXBuild below location. first, change the directory by copy-paste below command
cd C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin
Next, enter the command for compilation
AXBuild.exe xppcompileall /s=01
here s = 01 is the server-id
AxBuild.exe can accomplish a full compile of all X++ code which is faster than compiling form MorphX client menu.
For more details visit https://docs.microsoft.com/
Sometimes we need to select the records only if the field value is in a set of expected values. Microsoft Introduce In Operator in X++ in D365FO. Remember this can only be used for enum type fields
First, you need to assign containers with specified values. Here is sample code where the query selects only the records with status delivered, Sales, Invoice in where clause
During SSRS report development in ax sometimes we have a requirement to convert the amount into words, unfortunatly in SSRS report level, there is no such method available. You have to write VB code to do it.
The more simple solution would be to write the code in the report data provider class to perform conversion and store it into a field that can easily be used in the SSRS report
Here is the code you can convert the amount in words in Ax / D365FO
private String255 AmountInWords(real _amount)
{
int amount;
String255 amount2Words;
amount = real2int(round(_amount , 1));
amount2Words = Global::numeralsToTxt(amount);
amount2Words = subStr(amount2Words,5,strLen(amount2Words)-4);
amount2Words = subStr(amount2Words,strLen(amount2Words)-10,-strLen(amount2Words));
amount2Words = (amount2Words) + ' Only';
return amount2Words;
}
there is a builtin function available in Global class as well, you can try this as well
Global::numeralsToTxt(Amount)
static void GetAttribute(Args _args)
{
inventTable InventTable;
EcoResProductAttributeValue ecoResProductAttributeValue;
EcoResAttribute ecoResAttribute;
EcoResValue ecoResValue;
while select InventTable where InventTable.itemid == "0000001"
join RecId from ecoResProductAttributeValue
where ecoResProductAttributeValue.Product == InventTable.Product
join Name from ecoResAttribute
where ecoResProductAttributeValue.Attribute == ecoResAttribute.RecId
join ecoResValue
where ecoResValue.RecId == ecoResProductAttributeValue.Value
{
info(strFmt("%1 - %2 - %3", InventTable.ItemId, ecoResAttribute.Name, ecoResValue.value()));
}
}
Here is the X++ code to find Worker Primary Position in given date time
public static HcmWorkerPrimaryPosition findByWorker(
HcmWorkerRecId _worker,
utcdatetime _validFrom = DateTimeUtil::utcNow(),
utcdatetime _validTo = _validFrom,
boolean _forUpdate = false,
ConcurrencyModel _concurrencyModel = ConcurrencyModel::Auto)
{
HcmWorkerPrimaryPosition hcmWorkerPrimaryPosition;
hcmWorkerPrimaryPosition.selectForUpdate(_forUpdate );
if (_forUpdate && _concurrencyModel != ConcurrencyModel::Auto)
{
hcmWorkerPrimaryPosition.concurrencyModel(_concurrencyModel);
}
if (_worker)
{
if (prmisdefault(_validFrom) && prmisdefault(_validTo))
{
select firstonly hcmWorkerPrimaryPosition
where hcmWorkerPrimaryPosition.Worker == _worker;
}
else if (_validFrom == _validTo)
{
select firstonly ValidTimeState(_validFrom) hcmWorkerPrimaryPosition
where hcmWorkerPrimaryPosition.Worker == _worker;
}
else
{
select ValidTimeState(_validFrom, _validTo) hcmWorkerPrimaryPosition
where hcmWorkerPrimaryPosition.Worker == _worker;
}
}
return hcmWorkerPrimaryPosition;
}
X++ code to create default dimension in both D365FO and AX-2012
public class DefaultDimesnionHelper
{
X++ code to find employee dimension
static void employeeDim(Args _args)
Here is the X++ code to find the complete list of tables in Ax 2012 and D365FO
public void getTableList()
Display Method: The display method means that the method’s return value is being displayed on a form or a report. This value is fixed and c...