Showing posts with label function. Show all posts
Showing posts with label function. Show all posts

Saturday, February 23, 2019

Frequently used functions in D365 operations

Below listed are some frequently used functions in AX 2012, AX 2012 R2/R3, Dynamics 365 operations

1) Print text using label ids.
SysLabel::labelId2String2(literalStr("@DPL1228"))

2)

Friday, February 22, 2019

Validate WrkCtrId AX 2012/D365

Below are some example to understand Relations between Route, Resource and Resource group tables in AX 2012/D365

if(routeWrkCtrId != "" &&  routeWrkCtrId != _wrkCtrIdToValidate)
    {
        select firstOnly wrkCtrResourceGroupResourceRoute
            where wrkCtrResourceGroupResourceRoute.WrkCtrId == routeWrkCtrId;

        select firstOnly wrkCtrResourceGroupResource
            where wrkCtrResourceGroupResource.WrkCtrId == _wrkCtrIdToValidate;

        if(wrkCtrResourceGroupResource.ResourceGroup != wrkCtrResourceGroupResourceRoute.ResourceGroup)
        {
            throw error(strFmt('@TTT214',WrkCtrResourceGroup::find(wrkCtrResourceGroupResourceRoute.ResourceGroup).WrkCtrId));
        }
    }
    //If resource group is attached to selected opration, validate that selected resource should fall under that resource group.
    else if(prodRoute.activityRequirementSet().resourceGroupRequirement().RecId)
    {
        //retrive operation resource group.
        routeWrkCtrId = prodRoute.activityRequirementSet().resourceGroupRequirement().WrkCtrId;

        select firstOnly wrkCtrResourceGroupResource
                where wrkCtrResourceGroupResource.WrkCtrId == _wrkCtrIdToValidate;

        if(prodRoute.activityRequirementSet().resourceGroupRequirement().RecId != wrkCtrResourceGroupResource.ResourceGroup)
        {
            throw error(strFmt('@TTT214',routeWrkCtrId));
        }
    }
    else
    {
        throw error('@TTT216');
    }

num2Str example AX 2012/Dynamics 365

Below is sample example for the function num2str

static void dtformatNum(Args _args)
{
    real lineNum = 5.69;
    int d = 0;
    ;
    while ((d < 10) && (lineNum != str2num( num2str(lineNum,1,d,1,0) ) ))
        d++;

    info(num2str(lineNum, 1, d, 1, 0));

}

Happening

Upgrade from AX 2012 to Latest Dynamics 365 Finance and Operation

Below are the steps defined by sequence. 1. Create new Upgrade project in Dynamics LCS. 2. Create VSTS Project and connect it with L...

Trending now