• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Archive
  • About
  • Technical youtube Channel
  • Recommended Readings

Ali Raza Zaidi

A practitioner’s musings on Dynamics 365 Finance and Operations

X++

application cannot be started. Contact the application vendor – Workflow Dynamics 365 for finance and operations

August 17, 2019 by alirazazaidi

Hi all, today, while opening Workflow designer, I found following error

application cannot be started. Contact the application vendor

For this I have to clear the cache with following statement, in Command prompt

rundll32 dfshim CleanOnlineAppCache

If still problem remains, install click Once extension in Chrome.

Other wise use dynamics in Microsoft Edge. I tried on Microsoft Edge. It works perfectly fine.

Happy Daxing.

Data Manipulation in Dynamics Ax 2012- Array as Extended Data Type

July 2, 2018 by alirazazaidi

I found a array based field in TSTimesheetLineWeek table, Field TSWeeklyHours

Now challenge is to enabled field based on Array. For example need to disabled on day 6.

Following code snippet help me to enabled disabled fields generated on the base of array extended Type

TSTimesheetLineWeek_ds.object(fieldId2Ext(fieldNum(TSTimesheetLineWeek, Hours), 6)).allowEdit(false);

Reference :

https://msdn.microsoft.com/en-us/library/aa675074.aspx

https://docs.microsoft.com/en-us/previous-versions/dynamicsax-2009/developer/aa592700(v=ax.50)

Enum value to Table Insertion Dynamics Ax 2012 R3, D365 for operations

June 23, 2017 by alirazazaidi

Let me share you a small tip, During customization We extend out of box Enum for classification. Later client requirement is extensive usage of new Values for classification. For adding new values in enum results dependency on technical person . So we did customization and provide form and custom table so he can create number of values as he want. But now next challenge was, copy enum values and labels in Custom table, So He can use these value instead create again. I used following code snippet to copy data from Enum and insert into Custom table. Hopes this helps.

 

EnumId   enumId   = enumNum(LedgerPostingType);

DictEnum dictEnum = new DictEnum(enumId);

int      _NoOfValueInEnum = dictEnum.values();

int      counter;

CustomTable  _header;

delete_from _header;

for(counter = 0; counter < _NoOfValueInEnum; counter ++)

{

_header.ReportHeaderCode = dictEnum.index2Label(counter);

_header.Description = dictEnum.index2Label(counter);

_header.SortOrder=0;

_header.EnumValue = dictEnum.index2Value(counter);

_header.insert();

 

}

How to run RDP based report from X++ and passing parameter using Data contract.

July 19, 2016 by alirazazaidi

Interesting, I was modifying some RDP based report, I found that parameter was passed to report through custom table, As report will run form button, and based on current selected record. So former developer did that on pressing button, selected value inserted some custom table. When report run, query on table and fetch required value form custom table and whole report logic run on that value. That approach works fine, single user environment. Problem I found to send parameter to report through x++ code. I found SrsReportRunController works wonder here.

Suppose we are running some report for customer, And Report Name is customer Report and we have to pass current customer account on form as parameter. If you report is based on Report data provider than following code snippet works for you.

 

 

 

SrsReportRunController          controller = new SrsReportRunController();

CustomerReprtDC  rdpContract = new CustomerReprtDC  ();

SRSPrintDestinationSettings     settings;

super();

controller.parmReportName(ssrsReportStr(CustomerReport,CustomerCopy));

 

 

controller.parmShowDialog(false);

rdpContract.parmCustAccount(CustTable.AccountNum);

controller.parmReportContract().parmRdpContract(rdpContract);

controller.startOperation();

Unit Conversion Real world scenario, Dynamics Ax 2012 X++

April 26, 2016 by alirazazaidi

A few days ago, I got requirement, where I have to sum up the total quantity and amount of all Purchase line. Here we assume that All lines in Purchase order belongs to same set or convertible unit.

You can set these unit conversion settings at

Organization administration > Setup > Units > Unit conversions.

 

 

 

Public void SumQTYAndAmount(PurchTable  PurchTable)

{

PurchLine               line;

 

 

UnitOfMeasureSymbol     toSymbol ="Ranjah";

UnitOfMeasureSymbol     fromSymbol;

Qty                     SumQty=0;

AmountCur AmountPurch=0;

UnitOfMeasureRecId      fromRecid,toRecid;

;

 

 

 

select * from plan where plan.PurchTable == PurchTable.PurchId;

 

//  select sum(LineAmount), sum(QtyOrdered) from line where line.PurchId == PurchTable.PurchId;

while  select * from LineQty where LineQty.PurchId == PurchTable.PurchId

{

if ( LineQty.PurchUnit ==toSymbol)

{

SumQty +=LineQty.QtyOrdered;

amountQty+=LineQty.LineAmount;

}

else

{

fromSymbol = LineQty.PurchUnit;

toRecid =UnitOfMeasure::findBySymbol(toSymbol).RecId;

fromRecid =UnitOfMeasure::findBySymbol(fromSymbol).RecId;

landQty += UnitOfMeasureConverter::convert(landQty,fromRecid,toRecid,NoYes::Yes);

amountQty+=LineQty.LineAmount;

 

}

 

}

}

Custom lookup in reference group Dynamics Ax 2012

January 30, 2016 by alirazazaidi

Here is little tip regarding look up.
A few days ago, I have to take join with employee with my custom table. if you check that The primary key of HCMWORKER IS RecId.
So I have to create worker relation based on primary key i.e recid.\

2016-01-30_10-34-25

But when I drop the foreign key on form Grid. It creates reference group. And surprising this create out of the box lookup with similar to same based on alternative key.
2016-01-30_10-35-02

Now there is query appears that we have to filter it the workers of certain cariteria. for example you can certain designation or not terminate. now I face question how to add custom lookup in Reference group. Now there is no lookup function and same time if exists it will not work.
After searching I found referenceLookup method at data source field instead of grid text field. So Overwrite the method and similar code snippet creates the similar to out of the box lookup. You can extend it according to need.

2016-01-30_10-36-29

 

public Common lookupReference(FormReferenceControl _formReferenceControl)
{

HcmWorker HcmWorker;
Query query = new Query();
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;

SysReferenceTableLookup sysTableLookup = SysReferenceTableLookup::newParameters(tableNum(HcmWorker), _formReferenceControl, true);
;
sysTableLookup.addLookupField(fieldNum(HcmWorker, PersonnelNumber));
sysTableLookup.addLookupField(fieldNum(HcmWorker, Person));

queryBuildDataSource = query.addDataSource(tableNum(HcmWorker));

return sysTableLookup.performFormLookup();

}

Reference I used for this post, They help me during doing day to day task
http://devexpp.blogspot.com/2013/06/dynamics-ax-custom-reference-group.html
https://dynamicsaxposed.wordpress.com/2011/11/04/sysreferencetablelookup-class-for-reference-group/


Try catch and finally in new Dynamics Ax (aka AX7)

January 24, 2016 by alirazazaidi

Finally I found that in new Dynamics Ax finally statement introduce in exception handling statement.

try
{
}
catch
{
}
finally
{
}

It means, everything written in finally must be execute. For testing this functionality I just create a runnable class and written following code.

class HelloWorld

{

/// <summary>

/// Runs the class with the specified arguments.

/// </summary>

/// <param name = "_args">The specified arguments.</param>

public static void main(Args _args)

{

ColorDC dc = new ColorDC();

ColorSc Sc = new ColorSc();

 

try

{

dc.parmColorName("Red");

Sc.InsertColor(dc);

dc.parmColorName("Green");

Sc.InsertColor(dc);

} catch (Exception::Error)

{

info("error");

}

finally

{

info("finally");

}

 

 

}

 

}

 

When run the code.

I found Info box in browser as

2016-01-24_12-47-01

Process Indicator in Dynamics Ax 2012

March 3, 2015 by alirazazaidi

During one of my customization, I have perform a lengthy operation, during this process there is requirement to show process indicator, Code snippets I have found from

https://msdn.microsoft.com/en-us/library/aa841990.aspx

 

For this method I have to create a process helper class and add following snippet its static method

 

static void operationProgress_progressBars(Args _args)

{

#AviFiles

SysOperationProgress progress = new SysOperationProgress();

int i;

 

;

 

progress.setCaption(“File Transfer with Payment entries are in progess…”);

progress.setAnimation(#AviUpdate);

progress.setTotal(50000);

for (i = 1; i <= 50000; i++)

{

progress.setText(strfmt(“The value of i is %1”, i));

progress.setCount(i, 1);

}

}

 

 

For testing purpose I add a new form and on its button click, I added from following line code.

 

 

 

 

 

 

 

void clicked()

{

Args arg = new Args();

super();

 

startLengthyOperation();

 

ABCDHelper::operationProgress_progressBars(arg);

sleep(10000);

endLengthyOperation();

 

}

 

This progress operation must be run between two build in functions, that helps to cover the lengthy process in Dynamics Ax 2012.

3-3-2015 1-22-46 PM

split string in dynamics ax 2012

February 28, 2015 by alirazazaidi

During one of customization scenario, I have come across to field which contains comma separated values. In C# and VB.net string.split method return into array of string. But in X++  split method return list. Following simple tip helps me to check that my required value exists in comma separated value.

public boolean getValidateStudentName(String50 _splitString)

{

 

List strlist=new List(Types::String);

ListIterator    iterator;

str _Value;

boolean _NotFound=boolean::true;

;

strlist=strSplit(_splitString,”,”);

iterator = new ListIterator(strlist);

while(iterator.more())

{

_Value =iterator.value();

if (_Value ==”Ali”)

{

_NotFound=boolean::false;

}

if (_Value ==”Raza”)

{

_NotFound=boolean::false;

}

if (_Value ==”Zaidi”)

{

_NotFound=boolean::false;

}

if (_Value ==”Lahore”)

{

_NotFound=boolean::false;

}

if (_Value ==”Pakistan”)

{

_NotFound=boolean::false;

}

iterator.next();

}

return _NotFound;

}

Customer as offset account Dynamics Ax 2012 R3

February 23, 2015 by alirazazaidi

During one of my customization, I have to transfer customer balance from one customer to another, for this purpose

ledger entry for old customer as debit amount and other customer account set in offset account.

 

I used following code Snippet to achieve this functionality

LedgerJournalCheckPost  jourCheckPost;

LedgerJournalTable      jourTable;

 

AxLedgerJournalTable    header  = new AxLedgerJournalTable();

AxLedgerJournalTrans    trans   = new AxLedgerJournalTrans();

 

container               offsetDim;

LedgerJournalNameId     ledgerJournalNameId = “payment”;

LedgerJournalACType         accType, offsetAccType;

BankAccountTable            bankAccountTable;

accType         = LedgerJournalACType::Cust;

offsetAccType   = LedgerJournalACType::Cust;

 

header.parmJournalName(ledgerJournalNameId);

header.parmJournalType(LedgerJournalType::CustPayment);

header.save();

 

 

 

select firstOnly RecId from ToCustomer

where ToCustomer.DisplayValue == _ToAccount;

 

;

select firstOnly RecId from FromCustomer

where FromCustomer.DisplayValue == _OldAccount;

 

 

trans.parmLedgerDimension(ToCustomer.RecId);

trans.parmAmountCurCredit(PaymentAmount);

trans.parmOffsetAccountType(offsetAccType);

trans.parmOffsetLedgerDimension (FromCustomer.RecId);

trans.save();

 

 

 

 

The above mentioned code works 100 percent fine when I give offset account as ledger or bank ( did not try for vendor :)). When I used customer as offset I don’t know what reason it let offset account as empty. I debug  the code and watch windows show that valide value is parked at  trans.parmOffsetLedgerDimension

 

I don’t know it bug in Dynamics Ax 2012 R3, or some issue in my development environment, After 1 hours try and try, I decided to shift the code to enter data directly into table at line level. That works perfectly fine and entry is successfully parked and show on screen.

Only one extra line of code I need to add that is to set current currency code for ledger entry, which possibly set by default in  ABC classes

New code snippet is something similar at line level

 

LedgerJournalTrans  trans;

 

 

DimensionAttributeValueCombination  FromCustomer,ToCustomer;

 

LedgerJournalACType         accType, offsetAccType;

 

accType         = LedgerJournalACType::Cust;

offsetAccType   = LedgerJournalACType::Cust;

 

trans.AccountType = accType;

trans.OffsetAccountType =offsetAccType;

 

// ledger Header

trans.JournalNum = _JournalNum;

 

trans.CurrencyCode = Ledger::accountingCurrency(CompanyInfo::current());

 

trans.AmountCurDebit = PaymentAmount;

 

 

select firstOnly RecId from ToCustomer

where ToCustomer.DisplayValue == _ToAccount;

 

;

select firstOnly RecId from FromCustomer

where FromCustomer.DisplayValue == _OldAccount;

 

 

trans.LedgerDimension =FromCustomer.RecId;

trans.OffsetLedgerDimension = ToCustomer.RecId;

trans.insert();

 

Next Page »

Primary Sidebar

About

I am Dynamics AX/365 Finance and Operations consultant with years of implementation experience. I has helped several businesses implement and succeed with Dynamics AX/365 Finance and Operations. The goal of this website is to share insights, tips, and tricks to help end users and IT professionals.

Legal

Content published on this website are opinions, insights, tips, and tricks we have gained from years of Dynamics consulting and may not represent the opinions or views of any current or past employer. Any changes to an ERP system should be thoroughly tested before implementation.

Categories

  • Accounts Payable (2)
  • Advance Warehouse (2)
  • Asset Management (3)
  • Books (6)
  • Certification Guide (3)
  • Customization Tips for D365 for Finance and Operations (57)
  • D365OF (55)
  • Dynamics 365 (53)
  • Dynamics 365 for finance and operations (125)
  • Dynamics 365 for Operations (146)
  • Dynamics AX (AX 7) (133)
  • Dynamics AX 2012 (274)
  • Dynamics Ax 2012 Forms (13)
  • Dynamics Ax 2012 functional side (16)
  • Dynamics Ax 2012 Reporting SSRS Reports. (31)
  • Dynamics Ax 2012 Technical Side (51)
  • Dynamics Ax 7 (64)
  • Exam MB-330: Microsoft Dynamics 365 Supply Chain Management (6)
  • Favorites (12)
  • Financial Modules (6)
  • Functional (7)
  • Implementations (1)
  • Lifecycle Services (1)
  • Management Reporter (1)
  • MS Dynamics Ax 7 (64)
  • MVP summit (1)
  • MVP summit 2016 (1)
  • New Dynamics Ax (19)
  • Non Defined (9)
  • Power Platform (6)
  • Procurement (3)
  • procurement and sourcing (4)
  • Product Information Management (2)
  • Product Management (3)
  • Production Control D365 for Finance and Operations (9)
  • Sale Order Process (9)
  • Sale Order Processing (9)
  • Sales and Distribution (5)
  • Tips and tricks (275)
  • Uncategorized (165)
  • Upgrade (1)
  • Web Cast (7)
  • White papers (4)

Footer

Tags

Account receivable AIF Aif Services Apps for Dynamics 365 for Operations asp.net AX 7 BizTalk 2010 c# Customization in Dynamics 365 d d365 for finance and operations D365 for Operations Dynamic AX 2012 Dynamics 365 for finance and operations Dynamics 365 for Operations Dynamics Ax Dynamics Ax 7 Dynamics Ax 2012 Dynamics Ax 2012 development 2 Dynamics Ax 2012 functional side Dynamics Ax 2012 R3 Dynamics Ax 2012 Reporting SSRS Reports. Dynamics Ax 2102 Dynamics Ax tips and tricks ER Diagrams of Dynamics Ax 2012 tables Exam MB-330: Microsoft Dynamics 365 Supply Chain Management Excel Add ins financial Dimension Microsoft Dynamics 365 for Operations MSDYN365FO New Dynamics Ax Power BI Power BI tutorial procurement in dynamics ax 2012 Product Management Sales and distribution SQL Server 2008 SSRS Tips and tricks TSQL url regular expression Workflow WorkFlow in AX X++ X++ tips

Copyright © 2023 · Magazine Pro On Genesis Framework · WordPress · Log in