Tuesday, 23 June 2015

how to add the inventory dimesnions to customized form in ax 2012

I have found a very good link for   adding the inventory dimension in the customized form



https://daxbeginners.wordpress.com/2014/08/05/how-to-dynamically-display-inventory-dimension/

creating a fact box in ax 2012

Use the following step procedure to create a simple FactBox to display the
customer's pets. A FactBox uses a Query, which is similar to a View. It is used to
select data from one or more tables.

1. In the AOT, right-click the Queries node and select New Query.
Rename the new query to VetCustPetInfoPart.
2. In a second AOT, locate the VetCustPetTable table.
3. Drag the VetCustPetTable table to the DataSources node on the
VetCustPetInfoPart query.
4. Expand the VetCustPetTable_1 data source.
5. In the property sheet for the fields node set the Dynamic property to
Yes. This means all fields in the table will be included in the query.
6. In a second AOT, locate the VetBreedTable table.
7. Drag the VetBreedTable to the DataSources node on the
VetCustPetTable_1 datasource.
8. In the property sheet for the VetBreedTable_1 datasource, set the
Relations property to Yes.
9. In the property sheet for the fields node on the VetBreedTable_1
datasource, set the Dynamic property to Yes.
10. Save your changes to the VetCustPetInfoPart query.
11. Expand the Parts node in the AOT.
12. Right-click the Info Parts node and select New Info Part.
13. In the property sheet for the new info part, set the Name property to
VetCustPetTableInfoPart, set the Caption property to Pets, set the
Query property to VetCustPetInfoPart.
14. Right-click the Layout node in the info part, and select New Group.
15. In the property sheet for the group, set the Repeating property to
Yes.
16. Right-click the new group and select New Field.
17. In the property sheet for the new field, set the DataSource property
to VetCustPetTable_1, and the DataField property to Name.
18. Right-click the group and select New Field to create a second field.
19. In the property sheet for the second field, set the DataSource.
property to VetBreedTable_1 and the DataField property to Name
20. Save your changes to the VetCustPetTableInfoPart info part.

Procedure: Adding a FactBox to a List Page
Use the following step procedure to add the FactBox to the customer's list page.
1. Create a new menu item for the info part, by dragging the
VetCustPetTableInfoPart to the Menu Items > Display node in
the AOT.
2. Locate the VetCustPetTable table in the AOT.
3. Expand VetCustPetTable table.
4. Right-click the Indexes node and select New Index
5. Rename the index to CustIdx
6. From the fields node on the table, drag the CustAccount field to the
CustIdx index.
7. Save your changes to the table.
8. Locate the CustTableListPage form in the AOT.
9. Drag the VetCustPetTableInfoPart menu item to the Parts node.
10. In the property sheet for the new part reference, set the
DataSourceRelation property to
EDT.VetCustPetTable.CustAccount.
11. Save your changes to the CustTableListPage form.
12. Open the customer's list page and notice the new info part in the
FactBox section of the form.

Thursday, 18 June 2015

how to apply filter in a list page form

List page always extends to its listpage interaction class and if you go there in the respective list page interaction class you will find a method like

public void initializeQuery(Query _query)
{
    QueryBuildDataSource    qbds;
    ProjInvoiceTable        projInvoiceTable;

    if (this.listPage().listPageArgs() &&
             this.listPage().listPageArgs().externalRecord() &&
             this.listPage().listPageArgs().menuItemName() ==  menuitemDisplayStr(ProdTableListPage_Proj) &&
             this.listPage().listPageArgs().externalRecord().TableId == tableNum(ProjInvoiceTable))
    {
        projInvoiceTable = this.listPage().listPageArgs().externalRecord();
        qbds = _query.dataSourceTable(tableNum(ProdTable)).addDataSource(tableNum(ProjTable));
        qbds.relations(true);
        qbds.joinMode(JoinMode::ExistsJoin);
        qbds.addRange(fieldNum(ProjTable,ProjInvoiceProjId)).value(queryValue(ProjInvoiceTable.ProjInvoiceProjId));
    }

    super(_query);
}

here we can add our ranges and values to apply filter on the list page form.

Wednesday, 17 June 2015

how to add multiple ranges in a query for the enum

public void init()
{
    super();
    SalesQBR = this.query().dataSourceTable(tableNum(SalesTable)).addRange(fieldnum(SalesTable,SalesStatus));
    SalesQBR.value(strfmt("%1,%2",enum2str(SalesStatus::Canceled),enum2str(SalesStatus::Delivered)));
}

Tuesday, 9 June 2015

classes triggered while doing sale order journal posting in ax 2012

SalesInvoiceJournalPost - this is the class triggred when we invoice the sale order

MCRLedgerJournal_CustPayment - this is class for creation of journal in ax 2012 while we do sales invoice, here creation is done by the AX journal classes so only the insert method of the ledgerjournaltrans does not hit.

please note- first journal are posted and then sales order is invoiced

please note while debugging make sure that

tools>>options>>development>>execute  business logic is unchecked  so that this class will hit.

Monday, 8 June 2015

Workflow devlopment error

In this issue goona discuss something about work flow :

Say the development  of workflow is completed and still the workflow is not running and information bar is not comming to the form.

possible outcomes:

1. The cansubmit method in the table is not returning true
solution: put a debugger and open the form and check the outcome

2. the workflow is not attached properly in the form design

solution- form>>design

workflow enabled -yes
datasource- attach the table name
workflow type- attched the workflow type over there.

3. the work flow may not be created from the fron end worflow parameter

solution- create a new workflow  and give the proper workflow name like "Sales Order approval"  in the options , otherwise it will take thedefault  workflow name(XYZ_WorkflowSalesOrder) itself and will display it on the information(yellow bar).

Wednesday, 3 June 2015

How to get the previous field value in the modifiedField method of a Dynamic Ax table for form

In table we can use :

this.orig().(_fieldId)

and in form we can use like

x = Salesline.orig().lineAmount;

here x will return the last value before field was modified.

Tuesday, 2 June 2015

Simplest way to disable all the financial dimension on the CustTable form

In ax 2012 we may have many sitiuations where we need to disable one financial dimension or some or all of the dimension.

normal way we need to write some code here and there.

simplest way is to change just a condtion in the Custtable form and it will disable all the dimension.


Custtable>>init method(form)
normal code is :

 dimensionDefaultingController = DimensionDefaultingController::constructInTabWithValues(true, true, true, 0, this, tabFinancialDimensions, "@SYS138487");

change it to:

 dimensionDefaultingController = DimensionDefaultingController::constructInTabWithValues(true, true, false, 0, this, tabFinancialDimensions, "@SYS138487");

now all the financial dimensions will be disabled.

intercompany PO multiple product receipt by x++

public void processStampICPO(PackingSlipId _deliveryNote,                             Transdate _deliverydate,                             ...