Wednesday, March 28

AX 7 Recurring Data Job Process - Unauthorized issue while running DIXFSampleSolution

Following error will occur while running Microsoft DIXFSampleSoultion for recurring data job process used for Data Management import/export while connect with Azure Active Directory:

StatusCode: 401, ReasonPhrase: 'Unauthorized', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:

Solution:
<!-- Server side settings -->   
   
    <add key="Aad Tenant" value="systemsltd.com" />
    <add key="Azure Auth Endpoint" value="https://login.windows.net" />
    <add key="Azure Client Id" value="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" />
    <add key="Rainier Uri" value="https://usnconeboxax1aos.cloud.onebox.dynamics.com" />
    <add key="User" value="ali.azim@systemsltd.com" />
    <add key="Password" value="my_password" />


FIX:
There are two things you need to consider while defining "Rainier Uri"
  1. Keep the entire path in lower case.
  2. Eliminate any trailing slash in the "Rainier Uri" path in the App.config file.   
Incorrect: https://Usnconeboxax1aos.cloud.onebox.dynamics.com/
Correct: https://usnconeboxax1aos.cloud.onebox.dynamics.com
 

Friday, February 23

AX 2012: How to get Exchange Rate from sales Quotation Record.

There are many ways out there to find out the exchange rate of the current record in sales quotation form but below is the standard way to fetch the valid exchange rate amount with valid time frame.



static void GetSalesQuotationTableExhRate(Args _args)
{
    date      _date = systemDateGet();
    SalesQuotationTable tb = SalesQuotationTable::find("ISO-000081");
    CustExchRate    exchRate = 0;
    if (tb.SettleVoucher == SettlementType::SelectedTransact && SalesParameters::find().UseSettleExchRate)
    {
        exchRate = tb.settleExchRate(false);
    }
    if (!exchRate)
    {
        if (tb.FixedExchRate)
        {
            exchRate = tb.FixedExchRate;
        }
        else
        {
            exchRate = Currency::exchRate(tb.CurrencyCode, _date);
        }
    }
    info(strFmt("%3: %1 - %2",tb.CurrencyCode,exchRate/100,tb.QuotationId));
}

Monday, February 19

SSRS Report: Serial Number in Report Table in AX 2012

Serial number on detail level can be achieved by

Add a new column as 'S.No.' in SSRS report. Open Expression window of the column and enter below text:
=RowNumber("<Datasetname>")

E.g., If my dataset name is "MyData" then the command will be:
=RowNumber("MyData")


OR if nothing to used and need normal number count as 1,2,3,4....n used:
=RowNumber(nothing);

Serial Number in Report Group SSRS Dynamics Ax 2012

But serial number shown on Group level is tricky because RowNumber not works there. For example in above mention scenario, Client wants serial number on Customer Group instead of Customer at detail level.
I used following single line SSRS expression helps me to achieve this.
=Runningvalue(Fields!FieldName.Value,countdistinct,”Dataset1″)





Monday, January 15

AX 2012 - How to get Vendor contact information in primary to default sequences

Get the Vendor telephone number from dirPartyContactInfoView



static void SL_GetVendorContactInformation(Args _args)
{
    dirPartyContactInfoView        dirPartyContactInfoView;
    VendTable       vendor;
    logisticsElectronicAddress logisticsElectronicAddress;
 
    vendor = VendTable::find("‪‪‪VEND-0000331‬‬");
    select firstOnly Locator from dirPartyContactInfoView
        order by dirPartyContactInfoView.IsPrimary desc
            where dirPartyContactInfoView.Party == vendor.Party &&
                  dirPartyContactInfoView.Type == LogisticsElectronicAddressMethodType::Phone;

   info(strFmt("Address is %1", dirPartyContactInfoView.Locator));

}

Popular Posts