Thursday, 1 October 2015

How to get/ fetch Sales Price (SalesPrice) from sales Trade agreement in AX 2012

Hi Guys,
Now a days I am working on Interfaces like Import order from xml into AX 2012 Sales order so here, I will share with you the logic for picking Sales price from trade agreement in ax 2012.

Firstly, I tested the values through a job, like:
static void priceFromAgreement(Args _args)
{
    PriceDiscTable      priceDiscTable;
    //PriceDiscAdmTrans   _trans;
    ItemId              itemRelation = "021-08221";
    CustAccount         accountRelation = "1652-000007";
    real                salesPrice1, salesPrice2, salesPrice3;
    PriceType           relation = PriceType::PriceSales;
    NoYes               _RelationExist = NoYes::No;

    /// First if  trade agreement exist for Item for customer
    select firstonly priceDiscTable
        where priceDiscTable.Relation           == relation
           && priceDiscTable.ItemCode           == TableGroupAll::Table
           && priceDiscTable.ItemRelation       == itemRelation
           && priceDiscTable.AccountCode        == TableGroupAll::Table
           && priceDiscTable.AccountRelation    == accountRelation;

    salesPrice1 = priceDiscTable.Amount;
    info(strFmt("salesPrice1: %1", salesPrice1));

    if (priceDiscTable !=null)
    {
        info(strFmt("found Price1: %1", priceDiscTable.Amount));
    }

    // trade agreement exist for particular item for particular customer
    select firstonly priceDiscTable
        where priceDiscTable.Relation           == relation
           && priceDiscTable.ItemCode           == TableGroupAll::Table
           && priceDiscTable.ItemRelation       == itemRelation
           && priceDiscTable.AccountCode        == TableGroupAll::GroupId
           && priceDiscTable.AccountRelation    == "ROC";

    salesPrice2 = priceDiscTable.Amount;
    info(strFmt("salesPrice2: %1", salesPrice2));

    if (priceDiscTable !=null)
    {
        info(strFmt("found Price2: %1", priceDiscTable.Amount));
    }

    // third possibility is that when Customer have to all product with same price of amount.
    select firstonly priceDiscTable
        where priceDiscTable.Relation           == relation
           && priceDiscTable.ItemCode           == TableGroupAll::Table
           && priceDiscTable.ItemRelation       == itemRelation
           && priceDiscTable.AccountCode        == TableGroupAll::All
           && priceDiscTable.AccountRelation    == " ";

    salesPrice3 = priceDiscTable.Amount;
    info(strFmt("salesPrice3: %1", salesPrice3));

    if (priceDiscTable !=null)
    {
        info(strFmt("found Price3: %1", priceDiscTable.Amount));
    }
}


Now testing is done, we can start our development, Steps are as:

Step-1: Create one method to find PriceDiscTable object

public static PriceDiscTable findPriceDiscTable(PriceDiscAccountCode        _accountCode,
                                                PriceDiscAccountRelation    _accountRelation,
                                                PriceDiscItemCode           _itemCode,
                                                PriceDiscItemRelation       _itemRelation)
{
    PriceDiscTable      priceDiscTable;
    InventSiteId        inventSiteId;
    PriceType           relation = PriceType::PriceSales;

    inventSiteId = InventDim::find(priceDiscTable.InventDimId).InventSiteId;

    select firstonly priceDiscTable
        where priceDiscTable.Relation           == relation
           && priceDiscTable.AccountCode        == _accountCode
           && priceDiscTable.AccountRelation    == _accountRelation
           && priceDiscTable.ItemCode           == _itemCode
           && priceDiscTable.ItemRelation       == _itemRelation
           && priceDiscTable.ToDate             == dateNull();

    return priceDiscTable;
}

Step-2: Create another method to specify scenarios (cases) which may be described and will run on the basis of that trade agreement. Create cases as required as:

public static PriceDiscTable checkPriceDiscTable(PriceDiscAccountRelation    _accountRelation,
                                                 PriceDiscItemRelation       _itemRelation)
{
    PriceDiscTable              priceDiscTableRec;
    TableGroupAll               accountCode, ItemCode;
    PriceDiscAccountRelation    accountRelation;
    PriceDiscItemRelation       itemRelation;

    int     totalcases = 3;
    int     prioritycase = 0;

    while(prioritycase < totalcases)
    {
        switch (priorityCase)
        {
            case 0:
                accountCode         = TableGroupAll::Table;
                accountRelation     = _accountRelation;
                itemCode            = TableGroupAll::Table;
                itemRelation        = _itemRelation;

                priceDiscTableRec = MSSalesInterfaceLaffvlo::findPriceDiscTable(accountCode, accountRelation,
                                                                                itemCode, itemRelation);
                if(priceDiscTableRec.recId)
                {
                    return priceDiscTableRec;
                }
                break;

            case 1:
                accountCode         = TableGroupAll::GroupId;
                accountRelation     = _accountRelation;
                itemCode            = TableGroupAll::Table;
                itemRelation        = _itemRelation;

                priceDiscTableRec = MSSalesInterfaceLaffvlo::findPriceDiscTable(accountCode, accountRelation,
                                                                                itemCode, itemRelation);
                if(priceDiscTableRec.recId)
                {
                    return priceDiscTableRec;
                }
                break;

            case 2:
                accountCode         = TableGroupAll::All;
                accountRelation     = " ";
                itemCode            = TableGroupAll::Table;
                itemRelation        = _itemRelation;

                priceDiscTableRec = MSSalesInterfaceLaffvlo::findPriceDiscTable(accountCode, accountRelation,
                                                                                itemCode, itemRelation);
                if(priceDiscTableRec.recId)
                {
                    return priceDiscTableRec;
                }
                break;
        }
        prioritycase++;
    }

    return priceDiscTableRec;
}


Step-3: Add logic in Insert method from where values are getting inserted....

public static void insertLaffvloLineData(Container _value, MSSalesTable _mSSalesTable)
{
    MSSalesLine         salesline;
    InventTable         inventTable;
    InventDim           inventDim, inventDimLoc;
    PriceDiscTable      priceDiscTable;

    salesline.ItemId        = conPeek(_value, 22);
    salesline.ProductId     = conPeek(_value, 22);
    salesline.ProductName   = conPeek(_value, 7);
    salesline.Qty           = conPeek(_value, 9);
    salesline.CurrencyCode  = _mSSalesTable.CurrencyCode;
    salesline.MSSalesTable  = _mSSalesTable.RecId;  
 
    inventTable             = InventTable::find(salesline.ItemId);
    inventDim.InventSiteId  = inventTable.inventItemSalesSetup().inventDim().InventSiteId;
    inventDimLoc            = InventDim::findOrCreate(inventTable.inventItemSalesSetup().inventDim());

    priceDiscTable = MSSalesInterfaceLaffvlo::checkPriceDiscTable(_mSSalesTable.CustAccount, salesline.ItemId);
    salesline.SalesPrice = priceDiscTable.Amount;
 
    /*salesline.SalesPrice   = conPeek(PriceDisc::findItemPriceAgreement(ModuleInventPurchSales::Sales,
                                        salesline.ItemId,
                                        inventdim,
                                        "EA",
                                        today(),
                                        salesline.Qty,
                                       _mSSalesTable.CustAccount,
                                        'USD',
                                        CustTable::find(_mSSalesTable.CustAccount).PriceGroup), 1);*/

    if (!salesline.SalesPrice)
    {
        salesline.SalesPrice = InventItemPrice::findCurrent(salesline.ItemId,
                                                            CostingVersionPriceType::Sales,
                                                            inventdim.InventDimId,
                                                            today(),
                                                            inventdim.InventSiteId).Price;

        if (!salesline.SalesPrice)
            salesline.SalesPrice = InventTable::find(salesline.ItemId).salesPcsPrice();
    }

    salesline.LineAmount = salesline.Qty * salesline.SalesPrice;

    salesline.insert();
}


Note: Yeah, let me clear you on the SalesPrice scenarios

  1. If Trade agreement is created what we need then it should be 1st priority to fetch price from there
  2. If not then SalesPrice should be picked from Costing Version
  3. If not then lastly, SalesPrice should be picked up from Item base price (Item master- released products)
I tried to clarify from my best.

Thanx.
Happy DAXing.....

Friday, 11 September 2015

Address Import in AX 2012

Here, I got the job for importing address masters like CountryId, State, ZipCode, City... I am sharing with DAX techies hope it will help you.

static void AddressImport(Args _args)
{
    SysExcelApplication               application;
    SysExcelWorkbooks               workbooks;
    SysExcelWorkbook                workbook;
    SysExcelWorksheets              worksheets;
    SysExcelWorksheet               worksheet;
    SysExcelCells                        cells;
    COMVariantType                  type;
    Name                                     name;
    FileName                               filename;
    InventPosting                         InventPosting;

    DimensionAttributeValueCombination DimensionAttributeValueCombination;

    int row =1;
    LogisticsAddressZipCode          zipCode;
    LogisticsAddressZipCodeId        zipCodeId;
    LogisticsAddressCity             city;
    LogisticsAddressStateId          stateId;
    LogisticsAddressState            state;
    LogisticsAddresssCity            cityRecord;
    LogisticsAddressCountyName       countyName;
    LogisticsAddressCountyId         countyId;
    LogisticsAddressCounty           county;

    boolean                          badRecord;
    int                              i=1;
    int                              numProcessedRecords=0;
    LogisticsAddressCountryRegionId  _countryRegionId;

    //LogisticsAddressStateId          stateId;
    //LogisticsAddressCountyId         countyId;
    //LogisticsAddressCountyName       countyName;
   
    application = SysExcelApplication::construct();
    workbooks   = application.workbooks();
   
    //specify the file path that you want to read
    filename    = "C:\\Users\\v-vimsin\\Documents\\Vimal\\DIXF\\LogisticsPostalAddress - Copy.xlsx";
    try
    {
        workbooks.open(filename);
    }
    catch (Exception::Error)
    {
        throw error("File cannot be opened.");
    }
   
    ttsbegin;
    workbook    = workbooks.item(1);
    worksheets  = workbook.worksheets();
    worksheet   = worksheets.itemFromNum(1); //Here 3 is the worksheet Number
    cells       = worksheet.cells();
   
    do
    {
        row++;
        zipCodeId        = cells.item(row, 4).value().bStr();
        if (zipCodeId == "")
            zipCodeId = int2str(cells.item(row, 4).value().double());
       
        stateId          = cells.item(row, 3).value().bStr();
        city             = cells.item(row, 2).value().bStr();
        _countryRegionId = cells.item(row, 1).value().bStr();
        countyId         = cells.item(row, 5).value().bStr();
       
        if (stateId != '')
            state= LogisticsAddressState::find(_countryRegionId, stateId);  
            if (!state.RecId)
            {
                state.CountryRegionId   = _countryRegionId;
                state.StateId           = stateId;
                state.insert();
            }
            // Check if county exists
            //if(countyId != '')
            county = LogisticsAddressCounty::find(_countryRegionId, stateId, countyId);
   
            if (city != '')
            {
                select firstonly cityRecord where
                    cityRecord.Name             == city &&
                    cityRecord.StateId          == stateId &&
                    cityRecord.CountryRegionId  == _countryRegionId &&
                    cityRecord.CountyId         == countyId;
            }

            if (!cityRecord.RecId)
            {
                cityRecord.CountryRegionId  = _countryRegionId;
                cityRecord.Name             = city;
                cityRecord.StateId          = stateId;
                cityRecord.CountyId         = countyId;
                cityRecord.insert();
            }

            select firstonly zipCode where
                zipCode.ZipCode         == zipCodeId &&
                zipCode.State           == stateId &&
                zipCode.County          == countyId &&
                zipCode.CountryRegionId == _countryRegionId &&
                zipCode.CityRecId       == cityRecord.RecId;

            if (!zipCode.RecId)
            {
                zipCode.ZipCode         = zipCodeId;
                zipCode.City            = city;
                zipCode.CityRecId       = cityRecord.RecId;
                zipCode.CountryRegionId = _countryRegionId;
                zipCode.State           = stateId;
                zipCode.County          = countyId;
                zipCode.insert();

                numProcessedRecords++;
            }

        type = cells.item(row+1, 1).value().variantType();
    }

    while (type != COMVariantType::VT_EMPTY);

    info(strFmt("%1 Inserted",numProcessedRecords));

    ttsCommit;

    application.quit();
}

Happy DAXing.....

Friday, 17 July 2015

Dynamics AX 2012 Workflow receives "Failed to find workflow" error

We have run across a few situations in Dynamics AX 2012 where the workflow batch job fails with the error "Failed to find workflow" message.  When the customer received this error it prevented the remaining workflow messages in the queue from being processed.  In order to process all of the items that were queued up we needed to complete the following steps:

1.  Identify the record(s) that are causing the batch to fail.
Select a.RECID from SYSWORKFLOWMESSAGETABLE a Where a.ROOTCORRELATIONID notin(Select b.ROOTCORRELATIONID from SYSWORKFLOWTABLE b)and a.MESSAGELIFECYCLESTATE = 1
2.  Dequeue the SYSWORKFLOWMESSAGETABLE records that do not have a corresponding SYSWORKFLOWMESSAGETABLE record.
Update SYSWORKFLOWMESSAGETABLE Set MESSAGELIFECYCLESTATE = 2 where RECID =<RECID returned from statement above>
The procedures above will dequeue the message causing the error and allow the batch to complete.

Note:  As always, ensure you do a proper backup of your existing SYSWORKFLOWMESSAGETABLE prior to attempting this fix.

Forms not opening in local client.

In support we have seen a number of cases described along the lines of “Forms opens on remote desktop client but not on local AX client.”
Or “Dialog boxes fail to open.“ Historically we have found that the forms that fail to open are not out of the box forms. Instead they are USR or ISV layer objects.

What we have found is that the “Slide open combo boxes” under Performance options needs to be checked.


On server operating systems this is not turned on by default.

You can find this setting by right clicking on Computer -> Properties -> Advanced system settings -> Performance -> Settings.

You receive the error: “The transactions on voucher xxxxxxx do not balance as per xx/xx/xxxx. (Company currency: -x.xx - secondary currency: x.xx)” when attempting to post an invoice proposal in Project management and accounting.

One possible cause of this issue is the duplication of number sequences.  In Project management and accounting, there are separate number sequence setups available for On-Account Invoice, Invoice, On-Account Credit Note and Credit Note document types.  If the number sequences are not uniquely defined, in the posting process, when the records are fetched from the projProposalJour\ProjInvoiceJour it is possible that posting a credit would fetch the corresponding invoice with the same number sequence and vice versa.  This would then result in a situation where the merger of the documents results in an out of balance transaction, and then you would receive the error: "The transactions on voucher xxxxxxx do not balance as per xx/xx/xxxx. (Company currency: -x.xx - secondary currency: x.xx)".
To resolve this issue, you have a few options:
  1. Uniquely define the number sequences with a character segment specific to each document type.
  2. Use the same number sequence for the document types.
  3. You could also resolve the error by bumping up the next number to something that would not be a duplicate.  However, this would be a temporary solution as you would likely run into the error in the future on other documents.

How to enable the setup for user specific font Settings in MS Dynamics AX 2012

Found the following way on how to customize user depended fonts for reports and forms in AX 2012 client:
(1) Open a new developer workspace
(2) Navigate in the AOT to forms, SysUserSetup, designs, design(sys), [tab:tab](sys)], right click [TabPage.Fonts] (sys) and select properties
(3) Set the property visible by default No to Yes
(4) Save and compiling you the form change.
(5) In the AX 2012 client you can now see menu file (Note: blue button top left), tools, options the fonts and set the setting there user specifically

How to force complete CIL recreation in MS Dynamics AX 2012

“Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability or fitness for a particular purpose. This mail message assumes that you are familiar with the programming language that is being demonstrated and the tools that are used to create and debug procedures.”
Prerequisite: Make sure that a full X++ compile was run without errors before

1) Stop all relevant AOS server(s)

2) On your relevant AOS server(s) navigate to the following folder (default) using Windows Explorer:
C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL

3) Make sure you create a safe copy of the XPPIL folder content to another new local folder on the AOS computer (example: C:\XPPIL_SAVE)

4) Now delete all folders and files inside the folder “C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin\XppIL” but keep the folder “XPPIL” itself.

5) Start all AOS server(s)

6) Run a full CIL creation from AOT. This will create a fresh rebuild of all files/ folders inside the XPPIL folder

Happy DAXing
.........

Importing a General Journal using Data Import/Export Framework AX 2012

Here is a tutorial on how to configure Dynamics AX 2012 to import a general journal from a CSV file. The steps below are using Contoso demo data.
  1. Create a new folder on the root of the C: Drive and name it “DIEF”:
  2. Navigate to Data import export framework | Setup | Data import export framework parameters. Click “Browse” next to “Shared working directory” and select the “DIEF” folder we created. Once selected, click “Validate”.
  3. Close the “Data import export framework parameters” form.
  4. Go to Data import export framework | Setup | Source data formats. Enter “GLJOURNAL” for the “Source name” and “Type” = “File. In the parameters on the right side, enter “File format” = “Delimited”, “First row header” = TRUE, “Row delimiter” = “{CR}{LF}”, “Column delimiter” = “Comma {,}”, “Text Qualifier” = “*”, and “Role separator” = “;”. Click “Application”, and then select “CostCenter”, “Department”, and “ExpensePurpose”. Enter “CostCenter-Department-ExpensePurpose” for the “Dimension format” value.

  5. Go to Data import export framework | Setup | Target entities. Click “New” and enter “Entity type” = “Entity”, “Entity” = “Custom”, “Entity name” = “GLJOURNAL”, “Staging table” = “DMFLedgerJournalEntity”, “Entity class” = “DMFLedgerBalanceEntityClass”, and “Target entity” = “DMFLedgerJournalTransEntity”. Close the “Target entites” form.
  6. Go to Data import export framework | Common | Processing group. Type “GLJOURNAL” for the “Group name”, Ctrl+S to save, and click “Entities”.
  7. On the “Select entities for processing group” form, enter “GLJOURNAL” for both the “Entity name” and the “Source data format”. Click “Generate source file”.
  8. On the “Wizard” form, click “Next”. For the “Display data” fields, select the following and put them in the following sequence: JournalName, JournalNum, LineNum, CurrencyCode, TransDate, Voucher, AccountType, LedgerDimension, AmountCurDebit, AmountCurCredit, OffsetAccountType, OffsetLedgerDimension. Click “Generate sample file”.
  9. A .txt file should open, and save it to the root of the C: drive.
  10. Click “Finish” on the “Wizard” form. Close the “Select entities for processing group” form. Close the “Processing group” form.
  11. Go to General ledger | Setup | General ledger parameters. Click “Number sequences”. Right-click “Gene_10” next to “Journal batch number” and click “View details”.
  12. Click “Edit”, change the “_010” to “JN”, and click “Move up”. Click the “General” fast tab and note the “Next” value, in my case “JN000421”.
  13. Close the “Number sequences” form and the “General ledger parameters” form.
  14. Navigate to General ledger | Setup | Journals | Journal names. Select “GenJrn” and right-click the “Acco_18” next to “Voucher series”, and then click “View details”.
  15. On the “Number sequences” form, click “Edit”. In the “Segments” fast tab, click “Add”, select “Constant” for the “Segment”, and type “VN” for “Value”. Move this new segment to the top by clicking “Move up”. Note the next number in the series. In my case, “VN00000038”.
  16. Close all forms.
  17. Open Excel. Click File | Open. Navigate to the C: drive and select the “GLJOURNAL.txt” file (You may need to change the drop menu to “All Files (*.*)”)
  18. On the “Text Import Wizard” form, click “Delimited” and click “Next”. Check the box for “Comma” and click “Finish”.
  19. In line 2, enter the following values for each header:
    1. JournalName = GenJrn
    2. JournalNum = JN000421 (Value from step 12)
    3. LineNum = 1
    4. CurrencyCode = USD
    5. TransDate = 8/19/2013
    6. Voucher = VN00000038 (Value from step 16)
    7. AccountType = Ledger
    8. LedgerDimension = 110180-OU_1-OU_3566-Training
    9. AmountCurDebit = 10
    10. OffsetAccountType = Ledger
    11. OffsetLedgerDimension = 110101-OU_1-OU_3566-Training
  20. Click File | Save As. Click “CSV (Comma delimited)” for the “Save as type” drop-menu.
  21. Close Excel.
  22. Go to Data import export framework | Common | Processing group. Select the line for “GLJOURNAL” and click “Entities”.
  23. Click the folder icon next to “Sample file path”, and select the .csv file from step 20. Click “Generate source mapping”. Close the infolog.
  24. Close the “Select entities for processing group” form.
  25. On the “Processing group” form, select the line for “GLJOURNAL” and click “Get staging data”.
  26. A form for “Create a job ID for the staging data job” should open and populate with a “Job ID”. Click “OK”.
  27. On the “Staging data execution” form, click “Preview”. Verify the columns are correct, and then click “Run”.
  28. Close the infolog.
  29. On the “Processing group” form, click “Copy data to target”. Select the “Job ID” created earlier, and click “OK”. On the “Target data execution” form, click “Run”, then click “OK”.
  30. Close the Infolog.
  31. Go to General ledger | Journals | General journal. Locate the imported journal, and click “Lines”.
  32. Notice the values imported properly, and click Post | Post. The journal posts successfully.
Happy DAXing
............

Dynamics AX Table Caching: Basic Rules

This post provides some basic general guidance to get you started on setting table caching for custom tables, bearing in mind there will be exceptions. This should generally be defined at design time to avoid costly round trips to the database. As explained by Bertrand Caillet from our PFE (Premier Field Engineering) team:
“This is one of the most fundamental feature of the product today. The three tiers architecture of Dynamics AX allows you to define caching on AOS and client. Not using caching properly is the first root cause for performance.”
http://blogs.msdn.com/b/axinthefield/archive/2014/02/18/top-10-issues-discovered-in-the-dynamics-ax-code-review.aspx
Essentially there are two types of table caching as explained on msdn:
Set based caching (AX 2012)
Single record caching (AX 2012)
In AX 2012, table caching is more advanced than in previous versions, including support for joins, unique indexes (as opposed to primary indexes only), cross company queries, etc. (under certain constraints as explained in the above links). So for AX 2009, please see the following links (which generally cover previous versions too):
Set Based Caching (AX 2009)
Single Record Caching (AX 2009)
Cache settings for a table can be found in the following location in the application:
AOT > Data Dictionary > Tables > [TableName] > Properties > CacheLookup
Changes like this should be made by a developer in accordance with best practice guidance.
You can use the script at the bottom of this post to check cache lookup settings for all tables using the “Performance Analyser 1.20 for Microsoft Dynamics” (DynamicsPerf) tool (partly based on the analysis scripts that come with this tool).
Set the appropriate table group depending on how the table is used; see the following article for further details for AX 2012 (for previous versions it is basically the same but with fewer table groups):

Table and table group reference [AX 2012]
http://technet.microsoft.com/en-us/library/gg731855.aspx
Following that, you can generally set table caching according to the table below, again bearing in mind there can be exceptions. Please refer back to the above links for an explanation of each cache lookup type.
Table GroupCache Lookup
Miscellaneous* See notes below
 Parameter EntireTable
 Group Found
 Main Found
 Transaction NotInTTS
 WorksheetHeader NotInTTS
 WorksheetLine NotInTTS
 Framework N/A
 Reference Found
 Worksheet NotInTTS
 TransactionHeader NotInTTS
 TransactionLine NotInTTS
 * All newly created tables default to a table group of Miscellaneous. Ideally don’t use this table group for custom tables.
Finally, bear in mind that in AX 2012, the cache limit is configurable for every table group in the server performance settings:
System Administration > Setup > System > Server Configuration > Performance optimisation tab
Entire table cache size determines in kilobytes how much data is cached in memory before spilling to disk. The defaults are 32KB for AX 2012 RTM and 96KB for AX 2012 R2/R3.
The record cache limits define (per table group) the number of records stored in the server side cache and the client record cache factor defines based on that the number records stored in client cache, e.g. server side cache of 2000 (default) and client record cache factor of 20 (default) means 100 records are stored in client cache. Each AOS server can have its own cache settings. The basic rule here it is to keep the defaults unless performance testing proves it addresses a specific issue.

Happy DAXing
........

Thursday, 16 July 2015

Customizing the system-generated query of the Invoice journal form

When creating a Sales order in Dynamics AX 2012, you can define both a "Customer account" and an "Invoice account". The Customer account identifies the customer for which the Sales order is being created, and the Invoice account references the account number of the customer to invoice, in case it is different.


If you open the Invoice journal form from the Customer list page, you see only the transactions that were created for the customer selected in the grid, and not the transactions that were invoiced to this customer:
1- Go to Accounts receivable > common > Customers > All customers
2- In the ribbon, click the Invoice tab
3- Click the Invoice journal button in the Journals button group




If you want to modify this behavior, you will need to modify the query that is executed when the CustInvoiceJournalform is opened.
This is a good example of customization that would require accessing and modifying the system-generated query of a form, like explained here: https://msdn.microsoft.com/en-us/library/aa659696.aspx.
Setting the AutoQuery property on a form data source to Yes - as in the case here - causes the system to automatically generate the query that retrieves data to display in the form.
In this scenario, modifying the system-generated query to display a different set of data can be done in the init method of the data source of the form (in bold below):
Form: CustInvoiceJournal
Data source: CustInvoiceJour
Method: init
public void init()
{
   QueryBuildDataSource   queryDataSourceLink;
   CustInvoiceJour              custInvoiceJourLoc;
   SalesTable                      salesTableLoc; 
   TAMDeduction           tamDeduction;
   CustTable              custTable;
   super();
   if (element.args().dataset() == tableNum(CustTable) && element.args().record().(fieldNum(CustTable, AccountNum)))
   {   
      custTable = element.args().record();
      this.query().dataSourceTable(tablenum(CustInvoiceJour)).clearDynalinks();    
      this.query().dataSourceTable(tableNum(CustInvoiceJour)).addRange(fieldNum(CustInvoiceJour, RecId)).value(strFmt('((OrderAccount == "%1") || (InvoiceAccount == "%1"))', custTable.AccountNum));
   }
(…)

I hope this is helpful!

Happy DAXing
..........