Monday, October 20, 2014

AX 2012 Development Cheat Sheet

AX 2012 Development Cheat Sheet / X++ Cheat Sheet
Wednesday, 21 May 2014
3:02 PM
How to access individual field on the form using form data source?
myTable_ds.object( fieldNum( myTable, myField ) ).visible( false );

How to create an auto lookup without writing code where Field 2 lookup is based on Field 1 Value?
In order to achieve this create a relationship in the related table but make sure Field 1 is the first relation in the relationship and Field 2 is the second relation. This can be done by actually creating Field 2 relation before Field 1.

How to create a simple dialog box?
Dialog      dialog;
DialogField field;
   
dialog = new Dialog("My Dialog");
dialog.addText("Select your favorite customer:");
field = dialog.addField(ExtendedTypeStr(CustAccount));
dialog.run();
if (dialog.closedOk())
{
info(field.value());
}

How to convert string to enum?
SMATransactionType  transactionType;
transactionType = str2enum(transactionType, "Hour");
info(enum2str(transactionType));

Date Time Affectivity
utcDateTime fromDateTime, toDateTime;
fromDateTime = DateTimeUtil::newDateTime(3\3\2012, 0);
toDateTime   = DateTimeUtil::maxValue();

#Selecting a time effective record based on from date
select validTimeState(fromDateTime) table;

#Selecting a time effective record based on from date and to date
select validTimeState(fromDateTime, toDateTime) table;


Import Text File
static void RB_ReadTextFile(Args _args)
{
    Filename                                              filename = @'C:\Desktop\AX2012.txt';
    System.IO.StreamReader          reader;
    System.String                                   line;
    InteropPermission                       interopPermission;
    Str                                                         text;

    interopPermission = new InteropPermission(InteropKind::ClrInterop);
    interopPermission.assert();

    reader = new System.IO.StreamReade(filename,System.Text.Encoding::get_UTF8());
    line = reader.ReadLine();

    while (!System.String::IsNullOrEmpty(line))
    {
        line = reader.ReadLine();
        text = line;
        info(strfmt("%1", text));
    }

    reader.Close();
    reader.Dispose();
}


Import CSV File
static void RB_ReadCsvFile(Args _args)
{
    #File
    IO  iO;
    CustAccount custAccount;
    CustName custname;
    FilenameOpen        filename = "C:\\Desktop\\RB.csv";
    Container           record;
    boolean first = true;

    ;

    iO = new CommaTextIo(filename,#IO_Read);

    if (! iO || iO.status() != IO_Status::Ok)
    {
        throw error("@SYS19358");
    }
    while (iO.status() == IO_Status::Ok)
    {
        record = iO.read();
        if (record)
        {
            if (first)  // to exclude the header
            {
                first = false;
            }
            else
            {
                custAccount = conpeek(record, 1);
                custname = conpeek(record, 2);
                info(strfmt('%1--%2',custAccount,custname));
            }
        }
    }
}


Import Excel File
// >>> abdul @ 4th June 2014 / This job is used to update the parking locations for all shifts
//>>> Excel Format / Shift ID, Block ID, Parking Location
static void MSTA_DM_Roster_UpdateParkingLocations(Args _args)
{
    //Dialog Field
    Dialog fileDialog;
    DialogField sharedPath;

    // Excel Setup
    SysExcelApplication application;
    SysExcelWorkbooks workbooks;
    SysExcelWorkbook workbook;
    SysExcelWorksheets worksheets;
    SysExcelWorksheet worksheet;
    SysExcelCells cells;
    COMVariantType type;
    int row = 1;
    //Data Setup
    MSTARosterGroupLine rosterGroupLine;
    MSTARosterLine rosterLine;
    str 20 shiftFilter;



    fileDialog = new Dialog("Select parking locations improt files for company " + curext());
    fileDialog.addText("Select parking locations improt files for company " + curext());
    sharedPath = fileDialog.addField(extendedTypeStr(FilenameOpen), "File Path");

    fileDialog.run();
    if (fileDialog.closedOk())
    {
        try
        {
            application = SysExcelApplication::construct();
            workbooks   = application.workbooks();
            //TODO: Enter the excel file path
            workbooks.open(sharedPath.value());
            workbook = workbooks.item(1);
            worksheets = workbook.worksheets();
            worksheet = worksheets.itemFromNum(1);
            cells = worksheet.cells();

            ttsBegin;
           
            do
            {
                //First row should be column names
                row = row + 1;

                while select forupdate rosterGroupLine               
                    where rosterGroupLine.ShiftId == Global::COMVariant2Str(cells.item(row, 1).value())                      
                {
                    rosterGroupLine.ParkingLocationUniqueId = Global::COMVariant2Str(cells.item(row, 3).value());
                    rosterGroupLine.update();
                   
                   
                    while select forUpdate rosterLine
                        where rosterLine.GroupRefId == rosterGroupLine.RecId
                    {
                        if(rosterLine.VehicleBlockId == Global::COMVariant2Str(cells.item(row, 2).value()))
                        {
                            rosterLine.ParkingLocationUniqueId = Global::COMVariant2Str(cells.item(row, 3).value());
                            rosterLine.update();
                        }
                    }
                }
               
                type = cells.item(row, 1).value().variantType();
            }while (type != COMVariantType::VT_EMPTY);

            application.quit();
            info("Records Import " + int2str(row));

            ttsCommit;
        }
        catch
        {
            ttsAbort;
            application.quit();
            error("@SYS80663");
        }
    }
}


Importing Data from Database

Which EDT is associated with File Selection and Folder Selection
For folder use FilePath EDT
For File Name use FileNameOpen EDT

How to make any alphabet as capital letter?
Use strUp method


How to create manual auto numbering system?
A technique I used in HR was as below,

// >>> abdul @ 3rd June 2014 / Get New Auto Number Based On Company
public static str getNewPersonnelNumber()
{
    int maxLenght = 4;
    str tempEmployeeID;
    str newNumber;
    int newIndex;
    str companyIdx;
    HCMWorker localWorker;
    str ret;
    str 2 companyIdFilter;

    //Pickup the first digit as company name
    companyIdx = String::trimToLength(curext(), 1);
    companyIdx = strUpr(companyIdx);
    companyIdFilter = companyIdx + '*';
    select firstOnly localWorker
        order by localWorker.PersonnelNumber desc
        where localWorker.PersonnelNumber like companyIdFilter;
    tempEmployeeID = localWorker.PersonnelNumber;
    newNumber = String::replaceAll(tempEmployeeID, companyIdx, "");
    newIndex = str2int(newNumber);
    newIndex = newIndex + 1;
    newNumber = String::fillString(maxLenght - strLen(int2str(newIndex)), '0') + int2str(newIndex);
    newNumber = companyIdx + newNumber;
    ret  = newNumber;

    return ret;
}
// >>> abdul @ 3rd June 2014 / Get New Auto Number Based On Company


Creating a form at run time / dynamic form

Creating and saving AX object on runtime (Saving in AOT Tree)


Creating a sys progress bar
#AviFiles
SysOperationProgress    progressBar = new SysOperationProgress();
;
// Initialising progress bar
progressBar.setCaption("Export To Excel in progress...");
progressBar.setAnimation(#AviTransfer);

progressBar.setText(strfmt("Employee %1", emplTable.name()));

Traversing a data source on a form
PRMJournalTransHeader journalTransHeaderLocal;
    if(Box::yesNo("@BCS10177", DialogButton::No) == DialogButton::Yes)
    {
        ttsbegin;
        for (journalTransHeaderLocal = PRMJournalTransHeader_DS.getFirst();
            journalTransHeaderLocal; journalTransHeaderLocal = PRMJournalTransHeader_DS.getNext() )
        {
           
            PRMGenerateEarningAndDeductions::generateAllDedAndEarns(journalTransHeaderLocal);
        }
        ttscommit;
       
        PRMJournalTransHeader_ds.executeQuery();
    }
}


Ledger Dimensions Functionality
Print the financial dimensions for all employments
static void MSTA_HR_140610_EmplDim(Args _args)
{
   
    HcmWorker worker;
    HcmEmployment employment;
    #AviFiles
    SysOperationProgress    progressBar = new SysOperationProgress();
   
    // Initialising progress bar
    progressBar.setCaption("Printing in progress...");
    progressBar.setAnimation(#AviTransfer);
   
    while select worker
    {
        progressBar.setText(strfmt("Employee %1", worker.name()));
        employment = HcmEmployment::getActiveEmploymentsByWorker(worker.RecId);
        if(employment.DefaultDimension)
        {
            info(strFmt("%1, %2, Department Value: %3", worker.PersonnelNumber, worker.name(), getDefaultDimensionValue(employment.DefaultDimension, "Department")));
        }
    }  
}

How to get the dimension value from a ledger dimension

static str 255 getDefaultDimensionValue(RecId defaultDimension, Name dimName)
{
    str 255 ret;
    DimensionAttributeValueSetStorage dimStorage;
    dimStorage = DimensionAttributeValueSetStorage::find(defaultDimension);
    ret = dimStorage.getDisplayValueByDimensionAttribute(DimensionAttribute::findByName(dimName).RecId);
    return ret;
}

How to get the dimension value from a ledger dimension

static RecId setDefaultDimensionValue(RecId defaultDimension, Name dimName, str 255 dimValue)
{
    DimensionAttributeValueSetStorage dimStorage;
    Counter i;
    DimensionAttribute dimAttributeCostCenter;
    DimensionAttributeValue dimAttributeValue;
    dimStorage = DimensionAttributeValueSetStorage::find(defaultDimension);
    dimAttributeCostCenter = DimensionAttribute::findByName(dimName);
    if(dimValue)
    {
        dimAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttributeCostCenter, dimValue, true, true);
        dimStorage.addItem(dimAttributeValue);
    }
    else
    {
        dimStorage.removeDimensionAttribute(DimensionAttribute::findByName(dimName).RecId);
    }
    return dimStorage.save();
}

How to update worker dimension values

static void MSTA_HR_140610_UpdateEmplDim(Args _args)
{

    HcmWorker worker;
    HcmEmployment employment;
    #AviFiles
    SysOperationProgress    progressBar = new SysOperationProgress();

    // Initialising progress bar
    progressBar.setCaption("Printing in progress...");
    progressBar.setAnimation(#AviTransfer);

    ttsBegin;
    while select worker
    {
        progressBar.setText(strfmt("Employee %1", worker.name()));
        employment = HcmEmployment::getActiveEmploymentsByWorker(worker.RecId);
        employment.selectForUpdate(true);
        employment.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
        if(employment.DefaultDimension)
        {
            employment.DefaultDimension = Global::setDefaultDimensionValue( employment.DefaultDimension, "Contract", "None");
            employment.DefaultDimension = Global::setDefaultDimensionValue( employment.DefaultDimension, "ContractType", "None");
            employment.update();
            info(strFmt("%1, %2, Department Value: %3", worker.PersonnelNumber, worker.name(),
                getDefaultDimensionValue(employment.DefaultDimension, "Department")));
        }
    }
    ttsCommit;
}

How Can I use distinct / unique is X++ statements?
Use 'GroupBy'  in the select statement which field you want the distinct records.

A4 portrait and landscape paper size?
The paper size for A4 portrait is 8.27 * 11.69 inches and for Landscape is 11.69 * 8.27. Make sure that the page size is inclusive of the margins.
The paper size for A4 portrait is 210 * 297 mm and for Landscape is 297 * 210. Make sure that the page size is inclusive of the margins.


How to convert EDT to str to be used in dialog fields?
Use extendedTypeStr

How to shrink the database log files?
See names of the log file in DB
SELECT name, physical_name AS current_file_location
FROM sys.master_files

USE AdventureWorks2012;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE AdventureWorks2012
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (AdventureWorks2012_Log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE AdventureWorks2012
SET RECOVERY FULL;
GO

How to export to Excel?
static void SR_SysExcelWorksheetHelper(Args _args)
{
    CustTable               custTable;
    SysExcelWorksheetHelper worksheetHelper;
    SysExcelHelper          sysExcelHelper;
    SysExcelWorksheet       worksheet;
    int                     currentRow = 1;
    int                     sumRow;
    str                     worksheetName;
    int                     redColor = WinAPI::RGB2int(25500);
    SysExcelRange           range;
    COMVariant              cellValue = new COMVariant(COMVariantInOut::Out);
    str                     fileName;
    str attachmentPath      = "C:\\";

    // Sets the font color for a range of cells
    void setRangeFont(int _fromColumn, int _fromRow, int _toColumn, int _toRow, int _rgbIntColor)
    {
        range = worksheetHelper.getWorksheetRange(_fromColumn, _fromRow, _toColumn, _toRow);
        worksheetHelper.setFontColor(range, _rgbIntColor);
    }


    // Defines the columns of the spreadsheet
    #define.AccountNum(1)
    #define.Currency(2)
    #define.CustGroup(3)
    #define.BalanceMST(4)

    worksheetName = "@SYS135880";

    sysExcelHelper = SysExcelHelper::construct();

    sysExcelHelper.initialize();

    worksheet = sysExcelHelper.addWorksheet(worksheetName);

    worksheetHelper = SysExcelWorksheetHelper::construct(worksheet);

    // Populate the header row with the appropriate field labels and format the columns
    worksheetHelper.addColumnFromTableField(#AccountNum, tablenum(CustTable), fieldnum(CustTable, AccountNum));
    worksheetHelper.addColumnFromTableField(#Currency, tablenum(CustTable), fieldnum(CustTable, Currency));
    worksheetHelper.addColumnFromTableField(#CustGroup, tablenum(CustTable), fieldnum(CustTable, CustGroup));
    worksheetHelper.addColumn(#BalanceMST, "Balance MST", Types::Real);

    while select custTable
    {
        currentRow ++;
        worksheetHelper.setCellValue(#AccountNum, currentRow, custTable.AccountNum);
        worksheetHelper.setCellValue(#Currency, currentRow, custTable.Currency);
        worksheetHelper.setCellValue(#CustGroup, currentRow, custTable.CustGroup);
        worksheetHelper.setCellValue(#BalanceMST, currentRow, custTable.balanceMST());
    }
    if (currentRow > 1)
    {
        sumRow = currentRow + 2;

        worksheetHelper.setCellValue(#BalanceMST, sumRow, "@SYS58659");

        worksheetHelper.sumRange(worksheetHelper.getWorksheetRange(#BalanceMST, 2, #BalanceMST, currentRow), #BalanceMST, sumRow);

        setRangeFont(#BalanceMST, 2, #BalanceMST, currentRow, redColor);

        cellValue = worksheet.cells().item(sumRow, #BalanceMST).value();
        if (cellValue.currency() > 0)
        {
        setRangeFont(#BalanceMST, sumRow, #BalanceMST, sumRow, redColor);
        }
    }
    worksheetHelper.autoFitColumns();
    worksheetHelper.formatWorksheetTableStyle(sysExcelHelper.getOfficeVersion());

    // Generate the file using the current UTC date time (without the ‘:’ character)
    // since it is not allowed for file names.
fileName = strfmt("%1%2%3", WinApi::getTempPath(), strReplace(DateTimeUtil::toStr(DateTimeUtil::utcNow()), ":",""), sysExcelHelper.getFileExtension());

    sysExcelHelper.save(filename);
    sysExcelHelper.launchExcel();
}


How to get temporary Path in AX?
WinApi::getTempPath()

How to add a new Field in Managerial Hierarchy (Workflow Approval Limits)?
In order to add a new field in the managerial hierarchy either create a new HierarchyProvider or use WorkflowLimitHierarchyProvider class and add new fields in it.  Check the new method of WorkflowLimitHierarchyProvider  to get an overview.

Infolog system in Dynamics AX, how does it work?
setPrefix("Level 1");
Info("A");

Unbalanced TTS Begin
static void resetTTS(Args _args)
{
    while (appl.ttsLevel() > 0)
        ttsAbort;
}

How to check if Code is running in CIL?
Use if(xSession::isCLRSession()) {…}

Reflection: Traverse Projects AOT
static void MSTA_Utility_ExportAllProjects(Args _args)
{
    #aot
    #properties
    #AviFiles
    SysOperationProgress    progressBar = new SysOperationProgress();

    TreeNode _treeNode;
    TreeNode projectNode;
    TreeNodeIterator iterator;
    int i, a;
    // Initialising progress bar
    progressBar.setCaption("Export To Excel in progress...");
    progressBar.setAnimation(#AviTransfer);

    _treeNode = infolog.projectRootNode();
    _treeNode = _treeNode.AOTfirstChild();

    for(i = 0; i < 2; i++)
    {
        iterator = _treeNode.AOTiterator();
        projectNode = iterator.next();
        while (projectNode)
        {
            progressBar.setText(strfmt("Project %1", projectNode.treeNodeName()));
            if(String::beginsWith(projectNode.treeNodeName(), "MSTA"))
            {
                info(projectNode.treeNodeName());
            }
            projectNode = iterator.next();
            a++;
        }
        _treeNode = _treeNode.AOTnextSibling();
    }

}


Reflection: Traverse Classes AOT
//Traverse Class
static void FindClassStartsWithXXX(Args _args)
 {
   UtilIdElements utilId;
 ;
   while select utilId where utilid.recordType == UtilElementType::Class
   && utilId.name like 'XXX*'
   {
     print utilId.name;
   }
   pause;
 }

//Traverse Class
static void FindTablesStartsWithXXX(Args _args)
 {
   UtilIdElements utilId;
 ;
   while select utilId where utilid.recordType == UtilElementType::Table
   && utilId.name like 'MSTA*'
   {
       info(utilId.name);
   }
   pause;
 }


//Update Class Properties
static void RenameXXXObjectsToYYY(Args _args)
 {
   TreeNode  node = TreeNode::findNode(@'\Classes\XXXClass');
   str oldName;
   str newName;
   #Properties
   ;
   oldName = node.AOTgetProperty(#PropertyName);
   newName = strdel(oldName,1,3);
   node.AOTsetProperty(#PropertyName, "YYY"+newName);
   node.AOTsave();
   node.treeNodeRelease();
   node = null;
 }


How to add database log manually?

    DatabaseLog dblog;
   
    ttsBegin;
   
    dblog.logTable = tableNum(HcmWorker);
    dblog.LogType = DatabaseLogType::Delete;
    dblog.insert();
   
    ttsCommit;

Dynamics AX Collections
How to create a list of records and iterate them?
 AifAction aifAction;
    List actionsList = new List(Types::Record);
    ListEnumerator listEnum;
    ;

    if(_actionsList)
    {
        listEnum = _actionsList.getEnumerator();
        while(listEnum.moveNext())
        {
            aifAction = listEnum.current();
            if( aifAction.WebMethodEnabled == NoYes::No &&
                aifAction.WebSvcOutOfSync == NoYes::Yes &&
                aifAction.ErrorState == AifServiceGenerationErrorState::WebServiceOutOfSyncError &&
                aifAction.Intercompany == NoYes::No)
            {
                actionsList.addEnd(aifAction);
            }
        }
    }


How to convert real numbers to time format
public static str 5 num2Time(real _hours)
{

    int realPart;
    int decimalPart;
    real hours;
    str hoursStr;
    str minStr;
    int decimalLocation;
    str finalMinutes;
    ;
    try
    {
        hours = _hours;
        hoursStr = num2str(hours, 0, 2, 1, 0);
        decimalLocation = strfind(hoursStr, ".", 0, strlen(hoursStr));
        hoursStr = substr(hoursStr, 0, decimalLocation);
        hoursStr = trimString(hoursStr, ["."]);
        minStr = num2str(hours, 0, 2, 1, 0);
        minStr = substr(minStr, decimalLocation, strlen(minStr) - strlen(hoursStr));
        minStr = trimString(minStr, ["."]);
        realPart = str2int(hoursStr);
        decimalPart = str2int(minStr);
        finalMinutes = hoursStr + ":" + (int2str(60 * decimalPart / 100) == "0" ? "00" : int2str(60 * decimalPart / 100));
        return finalMinutes;
    }
    catch
    {
        return num2str(_hours, 0, 2, 1, 0);
    }
}

strFmt("%1:%2", hours div 1, strRfix(int2str(round(abs(hours)*60,1) mod 60),2,"0"))



SQL Server: Identifying and Killing Blocking Transactions

SELECT
db.name DBName,
tl.request_session_id,
wt.blocking_session_id,
OBJECT_NAME(p.OBJECT_ID) BlockedObjectName,
tl.resource_type,
h1.TEXT AS RequestingText,
h2.TEXT AS BlockingTest,
tl.request_mode
FROM sys.dm_tran_locks AS tl
INNER JOIN sys.databases db ON db.database_id =tl.resource_database_id
INNER JOIN sys.dm_os_waiting_tasks AS wt ON tl.lock_owner_address =wt.resource_address
INNER JOIN sys.partitions AS p ON p.hobt_id =tl.resource_associated_entity_id
INNER JOIN sys.dm_exec_connections ec1 ON ec1.session_id =tl.request_session_id
INNER JOIN sys.dm_exec_connections ec2 ON ec2.session_id =wt.blocking_session_id
CROSS APPLY sys.dm_exec_sql_text(ec1.most_recent_sql_handle) AS h1
CROSS APPLY sys.dm_exec_sql_text(ec2.most_recent_sql_handle) AS h2
GO

KILL

How to Assign temporary table to Grid?
Grid.setTmpData(temporaryTabeReference);


Lookups
How to create simple lookup?
Simple lookups can easily be created by adding a relation between the tables.

How to create a dynamic lookup?
In order to create a dynamic lookup there are two steps,
Step1: Create a lookup method in table or class
public static void lookupVendorByCurrency(
    FormControl _callingControl,
    CurrencyCode _currency)
{
    Query query;
    QueryBuildDataSource qbds;
    QueryBuildRange qbr;
    SysTableLookup lookup;
   
    query = new Query();
    qbds = query.addDataSource(tableNum(VendTable));
    qbr = qbds.addRange(fieldNum(VendTable, Currency));
    qbr.value(queryvalue(_currency));
    lookup = SysTableLookup::newParameters(tableNum(VendTable), _callingControl, true);
    lookup.parmQuery(query);
    lookup.addLookupField(fieldNum(VendTable, AccountNum), true);
    lookup.addLookupField(fieldNum(VendTable,Party));
    lookup.addLookupField(fieldNum(VendTable,Currency));
    lookup.performFormLookup();
}

Step2: Call the lookup method from the overridden lookup method on the data source field
public void lookup(FormControl _formControl, str _filterStr)
{
    VendTable::lookupVendorByCurrency(_formControl, CustTable.Currency);
}


Display Method Caching
Display methods must be written at table levels, in AX 2012 you can also use cache display method property of form controls.
CustTable_ds.cacheAddMethod(tableMethodStr(CustTable, name), false);

How to implement multi-threading in AX ?


How to Place a new line character in a Label?
Use  info(strFmtLB("@Label"));

How to change the splash screen for AX?

How to check configuration key?
if (isConfigurationkeyEnabled(configurationKeyNum('MSTARails')))
{

}

How to create a new number sequence in AX 2012?
1.  Create an edt : CarId .
AOT >> Extended Datatype
2. Write a code on lode module() on NumberSeqModuleProject
{
     datatype.parmDatatypeId(extendedTypeNum(Car Id));
     datatype.parmReferenceHelp(literalStr("@SYS334483"));
     datatype.parmWizardIsManual(NoYes::No);
     datatype.parmWizardIsChangeDownAllowed(NoYes::No);
     datatype.parmWizardIsChangeUpAllowed(NoYes::No);
     datatype.parmWizardHighest(999999);
     datatype.parmSortField(20);
     datatype.addParameterType(NumberSeqParameterType::DataArea, true, false);
     this.create(datatype);
}
3.Write a method on Projparameters Table
client server static NumberSequenceReference numRefcarId()
{
     return NumberSeqReference::findReference(extendedTypeNum(car Id));
}
4.Write a job and run that
static void Carid(Args _args)
{
    NumberSeqModuleProject  NumberSeqModuleProject = new NumberSeqModuleProject();
    ;
    NumberSeqModuleProject.load();
}
5. Then run the wizard
Organization Administration >> CommonForms >> Numbersequences>>Numbersequences>> Generate >> run the wizard.
6.Now we have to check the number sequence  is correctly working  for that write a job:
static void number(Args _args)
{
    NumberSeq  numberSeq;
    CarId num;
    ;
    numberSeq = NumberSeq::newGetNum(ProjParameters::numRefcarId());
    num = numberSeq.num();
    info(num);
}
Run the above job.We will find the generated Number     sequence.                                                    .
7. Now we want that Number Sequence in form level(Car Table):
Declare the number sequence On Form Declaration:
public class FormRun extends ObjectRun
{
    NumberSeqFormHandler numberSeqFormHandler;

}
8. Write the NumberSeqFormHandler() in form methods node.
NumberSeqFormHandler numberSeqFormHandler()
{
    if (!numberSeqFormHandler)
    {
        numberSeqFormHandler = NumberSeqFormHandler::newForm(ProjParameters::numRefcarId       ().NumberSequenceId,
                                                             element,
                                                             CarTable_DS,
                                                             fieldNum(CarTable, Car Id)
                                                            );
    }
    return numberSeqFormHandler;
}
9.Write the close() on the form methods node.
void close()
{
    if (numberSeqFormHandler)
    {
        numberSeqFormHandler.formMethodClose();
    }
    super();
}
10. Then final add the below methods on data source methods node
Create()
void create(boolean append = false,
            boolean extern = false)  // If created externally
{
    element.numberSeqFormHandler().formMethodDataSourceCreatePre();

    super(append);

    if (!extern)
    {
        element.numberSeqFormHandler().formMethodDataSourceCreate(true);
    }
}
Delete()
public void delete()
{
    element.numberSeqFormHandler().formMethodDataSourceDelete();
    super();
}
Write()
public void write()
{
    super();
    element.numberSeqFormHandler().formMethodDataSourceWrite();
}
Validate Write()
public boolean validateWrite()
{
    boolean         ret;
    ret = super();
    ret = element.numberSeqFormHandler().formMethodDataSourceValidateWrite(ret) && ret;
    if (ret)
    {
        CarTable.validateWrite();
    }
    return ret;
}
Link Active()
public void linkActive()
{
    ;
    element.numberSeqFormHandler().formMethodDataSourceLinkActive();
    super();
}
Now our numberseqence is generated .
*** Set the field or Tabpage Allowedit property to No.
***Check the continues on wizard.




74 comments:

  1. Thank you, very good information

    ReplyDelete
  2. This is awesome. Thank you.
    Did you ever get a chance to get an example of implementing multi-threading in AX?

    ReplyDelete
  3. Wow. great job! It's amazing, thank you so much for gathering all this information in one big post, it's very clever and will be extremely helpful for all people who use Microsoft Dynamics AX solution.

    ReplyDelete
  4. Microsoft Dynamics AX 2012 end-to-end solution is delivered by many development teams working inside Microsoft, in the Microsoft partner channel, and in end-user IT support organizations. The separation of concerns principle realized in the AX 2012 architecture makes this distributed development possible by separating the functional concerns of a solution into five globalized, secure layers. This separation reduces functional overlap between the logical components that each team designs and develops.

    ReplyDelete
  5. This is extremely great information for these blog!! And Very good work. It is very interesting to learn from to easy understood. Thank you for giving information. Please let us know and more information get post to link.

    mulesoft training bangalore

    ReplyDelete
  6. It's A Great Pleasure reading your Article, learned a lot of new things, we have to keep on updating it Learn Tibco Online Thanks for posting.

    ReplyDelete
  7. Very nice post here and thanks for it .I always like and such a super contents of these post.Excellent and very cool idea and great content of different kinds of the valuable information's.

    selenium Training in Chennai

    amazon web services Training in Chennai

    rpa Training in Chennai

    ReplyDelete
  8. It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command

    rpa Training in tambaram

    blueprism Training in tambaram

    automation anywhere training in tambaram

    iot Training in tambaram

    rpa training in sholinganallur

    blue prism training in sholinganallur

    automation anywhere training in sholinganallur

    iot training in sholinganallur

    ReplyDelete
  9. Some us know all relating to the compelling medium you present powerful steps on this blog and therefore strongly encourage contribution from other ones on this subject while our own child is truly discovering a great deal. Have fun with the remaining portion of the year.

    java training in marathahalli | java training in btm layout

    java training in jayanagar | java training in electronic city

    java training in chennai | java training in USA

    selenium training in chennai


    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete
  11. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    python training in pune
    python online training
    python training in OMR

    ReplyDelete
  12. The post is written in very a good manner and it entails many useful information for me. I am happy to find your distinguished way of writing the post. Now you make it easy for me to understand and implement the concept.
    Blueprism training in tambaram

    Blueprism training in annanagar

    Blueprism training in velachery

    ReplyDelete
  13. This is quite educational arrange. It has famous breeding about what I rarity to vouch. Colossal proverb. This trumpet is a famous tone to nab to troths. Congratulations on a career well achieved. This arrange is synchronous s informative impolite festivity to pity. I appreciated what you ok extremely here.
    Blueprism training in tambaram

    Blueprism training in annanagar

    Blueprism training in velachery

    ReplyDelete
  14. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.


    angularjs Training in chennai
    angularjs-Training in pune

    angularjs-Training in chennai

    angularjs Training in chennai

    angularjs-Training in tambaram

    ReplyDelete
  15. You are a great specialist on this topic! Congratulations on successful blog! Regards!


    ReplyDelete
  16. Really appreciate this wonderful post that you have provided for peoples. Its really good. Nice information.


    ExcelR Data Science Course in Bangalore

    ReplyDelete
  17. This is a wonderful article, Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more ... good luck.
    ExcelR Data science courses in Bangalore

    ReplyDelete


  18. I like viewing web sites which comprehend the price of delivering the excellent useful resource free of charge. I truly adored reading your posting. Thank you!

    data science course malaysia

    ReplyDelete


  19. Nice information, valuable and excellent design, as share good stuff with good ideas and concepts, lots of great information and inspiration, both of which I need, thanks to offer such a helpful information here.
    www.technewworld.in
    How to Start A blog 2019
    Eid AL ADHA

    ReplyDelete
  20. Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us
    you will get an introduction to the Python programming language and understand the importance of it. How to download and work with Python along with all the basics of Anaconda will be taught. You will also get a clear idea of downloading the various Python libraries and how to use them.
    Topics
    About ExcelR Solutions and Innodatatics
    Do's and Don’ts as a participant
    Introduction to Python
    Installation of Anaconda Python
    Difference between Python2 and Python3
    Python Environment
    Operators
    Identifiers
    Exception Handling (Error Handling)
    Excelr Solutions

    ReplyDelete
  21. Really impressed! Everything is very open and very clear clarification of issues. It contains truly facts. Your website is very valuable. Thanks for sharing.
    data science course

    ReplyDelete
  22. In our culture, the practice of treatment through various burn fat herbs and
    spices is widely prevalent. This is mainly due to the reason that different burn fat herbs grow in great abundance here. In addition to the
    treatment of various ailments these herbs prove beneficial in Healthy Ways To Lose Weight
    , especially for those who want to burn fat herbs

    we live in a world where diseases and their prevalence has gone off
    the charts. With the ever-growing incidences of illnesses and
    sufferings, one finds themselves caught up in a loop of medications
    and doctors’ visits. We, at https://goodbyedoctor.com/ , aim to find solutions for
    all your health-related problems in the most natural and harmless ways.
    We’re a website dedicated to providing you with the best of home
    remedies, organic solutions, and show you a path towards a healthy,
    happy life. visit https://goodbyedoctor.com/
    this site daily to know more about health tips and beauty tips.

    ReplyDelete
  23. I like you article. if you you want to saw Sufiyana Pyaar Mera Star Bharat Serials Full
    Sufiyana Pyaar Mera

    ReplyDelete
  24. This comment has been removed by the author.

    ReplyDelete
  25. - private detectives spain
    - private investigators in Spain at the best price. When you are obtaining the
    services offered to you by a private investigator.

    - private detective spain
    - Ways to choose private detectives spain safely | Do not make a mistake in hiring a
    private detective spain . In the regular course of your life.

    - private detectives in spain
    Ways to choose private detective in Spain safely | Do not make a mistake in hiring a
    private detective in Spain. In the regular course of your life,

    - private detective in spain
    Ways to choose private detective in spain safely | Do not make a mistake in ...
    not need to hire the professional services of a private detective agency.

    - detectives in spain
    - Ways to choose detectives in spain safely | Do not make a mistake in hiring
    a private detective in Spain. In the regular course of your life,

    - private detectives agency in spain
    - Ways to choose private detectives agency in spain safely | Do not make a mistake in hiring a
    private detective in Spain. In the regular course of your life,

    - private investigators spain
    private investigators spain at the best price. When you are obtaining the
    services offered to you by a private investigator, it is important.

    - private investigators madrid
    private investigators madrid in the Community of Madrid.
    Finding a detective in the Community of Madrid is an easy task.

    Hire private detectives from here.

    For More Info Check private investigator Here.

    ReplyDelete
  26. http://Mayapuri.net/-A 16+ year old Creative Media
    Solutions company.

    Engaged in Practical CreativityAdvertising agencies in chennai for its clients from India,Europe and the US.
    A provenTop Graphic design studios in chennai portfolio of work across
    diverse media for its clients from different domains.Corporate Film Makers in chennai
    An intricate fusion of insightful strategy,3D augmented reality cutting-edge
    ideas, and intelligent media integration is what we callBranding agency in chennai practical creativity.

    Check Our Website http://Mayapuri.net/.

    ReplyDelete
  27. http://karachipestcontrol. com/-Karachi Best Pest Control and Water Tank Cleaning Services.

    M/S. KarachiPestControl has very oldKarachi Pest Control Services Technical Pest Control workers
    thatfumigation services in Karachi live and add your space sevenfumigation in Karachi
    days every week.Pest services in karachiThis implies we are able toTermite Fumigation in Karachi
    be with you actuallytermite proofing in karachi quickly and keep our costs very competitive. an equivalent
    nativeUnique fumigation technician can see yourBed bugs fumigation in Karachi cuss management
    drawback through from begin to complete.Rodent Control Services Karachi Eco friendly technologies isWater tank cleaner in karachi
    also used.We are the firstWater Tank Cleaning Services in Karachi and still only professional water
    tank cleaning company in Karachi.With M/S. KarachiPestControlyou’re totallyBest Fumigation in karachi protected.


    Check Our Website http://karachipestcontrol. com/.

    ReplyDelete
  28. Gold and silver for life reviews.
    Thousands Across The Globe Using Mineshaft Bhindari gold and silver for life Training To Protect Their Wealth And Creating A Passive Income of 12% To 26.4% Per Year….


    Gold and silver for life reviews- How It Works?

    Minesh Bhindi created Gold and silver for life reviews because, after a long career in helping people grow their wealth through investment,
    he noticed something that he felt should benefit everyone. Since 2010, Gold and Silver for life has been helping people grow their wealth securely through strategic Investing in precious metals , gold and silver.
    As proud founder of Reverent Capital, a secure investment advisory firm, he consults with high net worth individuals from around the globe on the importance of secure
    investments in gold and silver

    Learn How to invest in gold from here kingsslyn.com now.

    ReplyDelete
  29. Weed Supermarket.
    Cannabis oil for sale, buy cannabis oil online, where to buy cannabis oil, cannabis oil for sale, buy cannabis oil online,
    cannabis oil for sale UK, cannabis oil for sale, where to buy cannabis oil UKBuy cbd oil, buying marijuana edibles online legal,
    online marijuana sales, buy cbd oil UK, best cbd oil UK, cheap cbd oil UK, pure thc for sale, cbd oil wholesale UK, cbd oil online buy UK
    Cbd flower for sale uk, cbd buds wholesale uk, cbd flower for sale uk, buy hemp buds uk, cheap cbd, flower uk, buy cbd buds online uk,
    cbd flowers buds uk, cbd buds for sale, cbd buds for sale uk, hemp, buds for sale uk, cbd flower for sale uk, high cbd hemp buds,
    cbd buds uk for sale, cbd buds online buy uk, hemp flowers wholesale uk, cheapest cbd flowers ukMarijuana weeds, buy marijuana weed online,
    marijuana weed in UK, marijuana weed for sale, where to order marijuana weed, cheap marijuana weed online, best quality marijuana weed,
    how to buy marijuana weed, marijuana hash, buy marijuana hash online, marijuana hash for sale, where to buy marijuana hash, buy marijuana hash online UK,
    buy marijuana hash in Germany, buy marijuana hash in Belgium, top quality marijuana hash, mail order marijuana hash, cheap marijuana hash
    You can buy Weed, Cannabis, Vape Pens & Cartridges, THC Oil Cartridges, Marijuana Seeds Online in the UK, Germany, France, Italy, Switzerland,
    Netherlands, Poland, Greece, Austria, Ukraine. We deliver fast using next Day Delivery.
    THC vape oil for sale, dank vapes for sale, buy dank vapes online, mario cartridges for sale, weed vape, thc vape, cannabis vape, weed vape oil,
    buy vape pen online, buy afghan kush online, blue dream for sale, marijuana edibles,

    Visit here https://www.dankrevolutionstore.com/ to know more.

    ReplyDelete
  30. Big Truck Tow: Heavy Duty towing service san jose
    We're rated the most reliable heavy duty towing san jose service & roadside assistance in San Jose!
    Call us now! We're ready to help you NOW!

    Since 1999, tow truck san jose has provided quality services to clients by providing them
    with the professional care they deserve. We are a professional and affordable Commercial
    Towing Company. BIG TRUCK TOW provides a variety of services, look below for the list of
    services we offer. Get in touch today to learn more about our heavy duty towing


    Click here to Find tow truck near me

    ReplyDelete
  31. Genuine Import Medicine.http://noelbiotech.com/Named Patient Medicine.Genuine Cancer Medicine.

    Noel Biotech is an Indian entity,Genuine Import Medicines in India facilitating access to Advanced Healthcare Solutions
    Genuine cancer medicinesrecommended for various nicheNamed Patient Medicines in India therapeutic segments. Driven by an unparallel commitment
    to assist IndianReference Listed Drugs Patients and Medical Fraternity, Noel has been consistent in its approach
    Gene Therapy Innovationsto channelize globally advanced and relevant solutions that are essential for the Indian
    scenario of Healthcare andGene Therapies for Cancer Care (Oncology) India Disease Management.

    Noel Biotech’s Brentuximab Vedotin costingvision is to enable Indian Patients to experience the Clinical
    BenefitsIpilimumab cost in India of novel medications form across the globe, anticipatingVentoclax cost in India
    Prolonged Survival with Better Quality of Life.

    Check our website-http://noelbiotech.com/

    ReplyDelete
  32. Keto Pills The Fastest Way to Get Into Ketosis?
    Keto diet pills reviews to let you know how to get into ketosis fast and feel
    young & energetic. These keto diet pills work wonders when taken as advised.
    Read This Informative article from top to bottom about Best Keto diet pills reviews & See
    Keto pills can help you to get into ketogenesis quickly and enjoy life-long benefits of
    maintaining healthy weight.our amazing Keto Diet Pills Recommendation at the end!
    How to get into ketogenesis ?
    If you Don’t know Where to buy keto diet pills click here.
    To Know More Information Click https://ketodietpillsinfo.com/ here.

    ReplyDelete
  33. crowdsourcehttp://www.incruiter.com recruitment agency.

    We ’incruiter’ provide a uniquerecruitment agencies platform to various committed professionals
    placement consultancyacross the globe to use their skills and expertise to join as a recruiter and
    interviewer to empower the industry with talented human resources.Searching for the right candidate is never easy.
    job consultancy We use crowdsource recruitment to find right talent pool at much faster pace.
    Our candidate search follows application of a rigorous methodology, and a comprehensive screening to find an individual
    whorecruitment consultants is not only skilled but is also the right culture fit for your organization.
    Our interviewers are best in the industry,staffing agencies being experts from various verticals to judge right
    candidate for the job. They interview candidates taking into account primarily defined job specification of our clients and targeting
    them for needs of the organization.Thinking about payment?placement agencies Don’t worry, you pay when you hire.
    Whether you are a startup or an established enterprise, join our 10x faster recruitment process that reduces your hiring process by 50% and give you
    manpower consultancyefficient results.

    check our website:http://www.incruiter.com.

    ReplyDelete
  34. Talk with Strangerstalk to strangers in Online Free Chat rooms where during a safe environment.
    Many users checking out free chat withomegle kids strangers look for their matches online on each day to day .Having an interview with
    strangers helps people overcome their anxiety, loneliness, and over-stressed lives.So as to
    speak with strangers, the users talk to strangersshould skills to protect themselves from online scams and frauds.
    Chat with random people online anonymously is becoming common as fast because the technology and
    web are advancing.Talking to strangerschat random and having random conversations with random people is great
    especially if it's no login and requires no check in chat in our international chat rooms.
    Our aim isfree chat to form your chatting experience as fast, easy and best by using our random text chat,
    as pleasant, fun and successful as possible.dirty chat Chat with random people online with none log in.

    ReplyDelete
  35. Great post i must say and thanks for the information. Education is definitely a sticky subject. However, is still among the leading topics of our time. I appreciate your post and look forward to more.thanks aa lot guys.
    Ai & Artificial Intelligence Course in Chennai
    PHP Training in Chennai
    Ethical Hacking Course in Chennai Blue Prism Training in Chennai
    UiPath Training in Chennai

    ReplyDelete
  36. ترفند برد و آموزش بازی انفجار آنلاین و شرطی، نیترو بهترین و پرمخاطب ‌ترین سایت انفجار ایرانی، نحوه برد و واقعیت ربات ها و هک بازی انجار در
    اینجا بخوانید
    کازینو آنلاین نیترو
    بازی حکم آنلاین نیترو
    بازی حکم آنلاین
    Introducing the Nitro Blast game site
    معرفی سایت بازی انفجار نیترو
    همان طور که می دانید بازی های کازینو های امروزه از محبوبیت ویژه ای برخودارند که این محبوبیت را مدیون سایت های شرط می باشند. با گسترش اینترنت این بازی ها محدودیت های مکانی و زمانی را پشت سرگذاشته و به صورت آنلاین درآمده اند.
    بازی انفجار نیترو
    بازی انفجار
    یکی از محبوب ترین بازی های کازینو، بازی انفجار می باشد که ساخته سایت های شرط بندی می باشد و امروزه از طرفداران ویژه ای برخودار است. با گسترش اینترنت سایت های شرط بندی مختلفی ایجاد شده اند که این بازی را به صورت آنلاین ساپورت می کنند. یکی از این سایت ها، سایت معتبر نیترو می باشد. در این مقاله قصد داریم به معرفی
    سایت بازی انفجار نیترو بپردازیم.
    سایت پیش بینی فوتبال نیتر
    سایت پیش بینی فوتبال
    بازی رولت نیترو
    کازینو آنلاین

    Visit https://www.wmsociety.org/
    here for more information

    ReplyDelete
  37. Generic Latisse : Eyelashes drops 3ml with Bimatoprost 3%

    Natural Ways to Encourage eyelashes growth , iBeauty Care offers a wide variety of natural products for skin care

    iBeauty Care offers a wide variety of natural products for skin care, eyelashes growth, acne and many other health problems. All products are with clinically proven effects and great therapeutic results.
    Visit https://www.ibeauty care.com/home/21-generic-latisse.html here to buy this ar low cost.
    or visit The home page https://www.ibeauty-care.com/.

    ReplyDelete

  38. Its as if you had a great grasp on the subject matter, but you forgot to include your readers. Perhaps you should think about this from more than one angle.
    machine learning courses in bangalore

    ReplyDelete
  39. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. This article inspried me to read more. keep it up.
    IELTS Coaching in chennai

    German Classes in Chennai

    GRE Coaching Classes in Chennai

    TOEFL Coaching in Chennai

    spoken english classes in chennai | Communication training

    ReplyDelete
  40. Some us know all relating to the compelling medium you present powerful steps on this blog and therefore strongly encourage contribution from other ones on this subject while our own child is truly discovering a great deal. Have fun with the remaining portion of the year.
    oracle training in bangalore

    hadoop training in bangalore
    oracle training

    oracle online training

    oracle training in hyderabad

    hadoop training in chennai

    ReplyDelete
  41. What a well written and compassionate article. I found your thoughts and wisdom to be encouraging and helpful. underground fat loss manual pdf

    ReplyDelete
  42. The way you write, you are really a professional blogger. https://ileanbellybreakthrough.com/

    ReplyDelete
  43. There is noticeably a bundle to know about this. I assume you made certain nice points in features also . https://unlockhipflexorsinfo.com/

    ReplyDelete
  44. Outstanding article! I want people to know just how good this information is in your article. Your views are much like my own concerning this subject. I will visit daily your blog because I know. It may be very beneficial for me. yoga-burn reviews

    ReplyDelete
  45. examresultub.com is an extensive educational portal. Students, parents,
    teachers and educational institute can get Board Exam Result,
    Admission, Academic Result, Career, Study Material for Assignments,
    Institutes and latest Educations News in Bangladesh.


    Exam Result:
    BPSC is published the bcs exam result 2021 on bpsc.gov.bd result website- https://examresulthub.com/

    The Ministry of Education has published hsc admission result 2021 for admission in higher secondary level in Bangladesh.


    Full Resources:
    https://examresulthub.com/sitemap/


    official website:
    examresulthub.com

    ReplyDelete
  46. Plumbing & HVAC Services San Diego
    Air Star Heating guarantees reliability and quality for all equipment and services.
    Air Star Heating is specializing in providing top-quality heating, ventilating, air conditioning, and plumbing services to our customers and clients.
    Our company is leading the market right now. By using our seamless and huge array of services. Our customers can now have the privilege of taking benefit from our services very easily and swiftly. To cope up with the desires and needs of our clients we have built an excellent reputation. We are already having a huge list of satisfied customers that seem to be very pleased with our services.

    Plumbing & HVAC Services in San Diego. Call now (858) 900-9977 ✓Licensed & Insured ✓Certified Experts ✓Same Day Appointment ✓Original Parts Only ✓Warranty On Every Job.
    Visit:- https://airstarheating.com

    ReplyDelete
  47. GST Admission Result has been published by the authority through https://gstadmission.ac.bd/. Guccho Admission Result 2020-2021 takes General, Science, and Technology students into consideration under 20 public universities.
    Full Source: www.jobnewsbd24.com/sitemap

    ReplyDelete
  48. I personally think your article is fascinating, interesting and amazing.I am telling you a International packers & movers available in gurgaon Fast go and visit our website.

    ReplyDelete
  49. There is noticeably a bundle to know about this. I assume you made certain nice points in features also. https://thejustreviews.com

    ReplyDelete
  50. What’s up, I wish for to subscribe for this website to get latest updates, therefore where can I do it please help out.

    ReplyDelete
  51. Nice post. I learned some new information. Thanks for sharing.

    AI Training in Hyderabad

    ReplyDelete
  52. "Great insights! Data science is an exciting field, and it's wonderful to see that there are excellent opportunities for learning in Kochi. If you're looking to enhance your skills, I highly recommend checking out the Data science courses in Kochi for more details. These courses provide valuable knowledge and hands-on experience that can help you build a successful career in data science."

    ReplyDelete
  53. Such an engaging and insightful read! Your blog is one of the best on the web.
    Data science Courses in London

    ReplyDelete
  54. This cheat sheet for AX 2012 development is pure gold! It’s concise, well-structured, and incredibly handy for developers. Thank you for putting this together—it’s an amazing reference that will save so much time.
    Data science courses in the Netherlands

    ReplyDelete
  55. This cheat sheet is a fantastic quick reference for AX 2012 developers working with X++. The examples are concise yet practical, covering scenarios like form field access and time-effective records. The inclusion of dialog creation is particularly handy for interactive applications. Great work sharing these tips—perfect for boosting productivity and tackling common tasks efficiently!
    Data science Courses in City of Westminster

    Neel KBH
    kbhneel@gmail.com

    ReplyDelete
  56. "Great resource for AX 2012 developers! This cheat sheet is perfect for quick reference and can really help streamline the development process. Thanks for sharing!"
    Data science Courses in Canada

    ReplyDelete