Version used 10.0.24
Dynamic AX 2012
Data Manipulation in Dynamics Ax 2012- Array as Extended Data Type
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)
Special character In Query range, Dynamics ax 2012 R3 and DFO 365 for operation.
Yesterday I got very interesting issue. So When put filter on color, config, style and size. A strange error occur. Filter works for 99% of records but on 1 percent time out occurs. When we dig deep into issue, we found that End user, used the special character ‘(‘ in style. And when we execute the filter on dim of special character reports goes toward timeout. It means some infinite loop occurs.
Our code snippet was
findOrCreateRange_W(query.dataSourceTable(tableNum(InventDim)), fieldNum(InventDim, InventStyleId)).value(InventDimParm.InventStyleId);
Later we found that queryValue is missing in our statement. That was the reason statement was goes into infinite loop.
The correct statement is below as.
findOrCreateRange_W(query.dataSourceTable(tableNum(InventDim)), fieldNum(InventDim, InventStyleId)).value(queryValue(InventDimParm.InventStyleId));
Data manipulation tip 1 In Dynamics ax 2012 and D365 Of Operations Data copy method.
Currently I am doing Report development project, I got some tips for Data manipulation , these tips I recently learned.
Copy data from one table buffer to other of same type.
During report development, We usually populate temp table with result of Query execution. Usually we need copy of same data for aggregate functions.
Instead map each field of buffer with each other. We can copy the whole data by using .data method.
Suppose we have custom temp table CustSaleQtyTmp which we need to copy from one buffer to other.
class DataManipulationJob
{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
CustSaleQtytmp _temp1,_temp2;
_temp1.IntQty=100;
_temp1.CustAccount =”Cust00001″;
_temp1.insert();
_temp1.IntQty=200;
_temp1.CustAccount =”Cust00002″;
_temp1.insert();
_temp1.IntQty=300;
_temp1.CustAccount =”Cust00003″;
_temp1.insert();
while select * from _temp1
{
// Instead copy like this we can use Data method
// _temp1.CustAccount = _temp2.CustAccount;
// _temp1.IntQty = _temp2.IntQty;
_temp2.data(_temp1);
_temp2.insert();
}
while select * from _temp2
{
info( ” _temp2 with ” + _temp2.CustAccount + ” ” + int2Str(_temp2.IntQty));
}
}
}
output like
Financial dimension for work position Dynamics Ax 2012.
I used following code snippet to get financial dimension attached with hcmposition
static void GetFinancialDimensionValue1(Args _args) { HcmPosition position; HcmPositionDefaultDimension positionDefaultDimention; DimensionAttributeValueSetStorage dimStorage; Counter i; select * from position join * from positionDefaultDimention where position.PositionId=="000001" && position.RecId == positionDefaultDimention.Position; dimStorage = DimensionAttributeValueSetStorage::find(positionDefaultDimention.DefaultDimension); for (i=1 ; i<= dimStorage.elements() ; i++) { info(strFmt("%1 = %2", DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name, dimStorage.getDisplayValueByIndex(i))); } }
Reference: https://jkmsdax2012.wordpress.com/2015/11/16/how-to-get-financial-dimensions-for-a-particular-customer-using-x-code-in-ax-2012/
Cannot edit a record .. An Update Conflict occurred due to … Dynamics Ax 2012 R3.
today I got this error while running a custom report.
Cannot edit a record in Table
An update conflict occurred due to another user process deleting the record or changing one or more fields in the record.
I found that this error occurs due to concurrent access to table is allowed. And we did not need concurrent access.
I change the ccEnabled to no
If this error occur on table that can be used on concurrent mode, then write tableBuffer.reread() before adding or modify data.
Reference: https://community.dynamics.com/ax/f/33/t/95177
water mark in SSRS report Dynamics Ax 2012.
Hi, all very small tip today, Recently I have to add water mark in one of custom report.
In SSRS for Dynamics Ax 2012, we can achieve water mark by adding background image in report body.
Water mark image should be small in size and used as background Image. If you use high in size image, Report will threw errors on deployed at server.
This water mark can hide and show with ssrs expression.
So complete real word requirement will be Print report with water mark if certain criteria meets, other wise print report normal report.
At SSRS side right right click on report Body and click on Body Properties.
From property window, select fill, select file the image source “embedded” and import file.
After import file will be shown as report explorer
Now add following expression to show report display water mark or not.
=IIf(Fields! DuplicateCopy.Value=1,”Duplicate3″,””)
How to run RDP based report from X++ and passing parameter using Data contract.
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();
No such host is known and AOS not reached SSRS Dynamics AX R3.
Yesterday I deployed the new SSRS customization to staging, so QA / Functional guy can test.
Client configured the AOS to Database server and Application server was moved for backup services.
Due to change in AOS server I have to face two issues.
“No Such Host is known.”
Whenever we run the report on staging server during report processing Error pop up appear with message “ Host not found “.
Modification in Windows Register, did not solve this problem. I have to reinstall the Reporting services extension form Dynamics Ax 2012 R3.
Second issue I faced that During installation of Reporting Extensions. Setup did complete and shows message about it did not locate the Required AOS. Interesting setup pointing to old server.
I solve this error by removing the credential save for Business connecter form Administration module for Dynamics AX. After rerun the reporting extension form AX Setup, Installation will complete successfully. Later deploy all reports and reports runs successfully.
‘Invalid enum value ‘GMTPLUS0500ISLAMABAD_KARACHI’ cannot be deserialized into type Dynamics Ax 2012 R3 WorkFlow Error.
Couple of months ago, I have to face a strange error and its very strange solution. So I decide to share it and document so it helps others as well as I remember if I face it again.
Error occur when we try to create, edit or delete workflow. This error is certainly because of time zone. And As we are in Pakistan so certainly the Legal entity have to use local time zone.
But interestingly Workflow works fine in all other legal entity with same time zone. So what is problem with certain legal entity.
Short detail of error is as follow
‘Invalid enum value ‘GMTPLUS0500ISLAMABAD_KARACHI’ cannot be deserialized into type ‘Microsoft.Dynamics.AX.Framework.Workflow.Model.AxWorkflowServiceReference.Timezone
This error occurs when following statement execute.
workflowConfiguration = Microsoft.Dynamics.AX.Framework.Workflow.Model.WorkflowModel::
Create(templateName, curext(), curUserId(), domainUser);
As per my understanding we cannot debug framework classes. So We cannot get understand what cause problem.
After efforts, I found that this error is caused by time zone set in legal entity’s primary Address instead of legal entity’ own time zone. I changed it to Central time zone US and Canada, Everything starts to working fine. I am surprised, what logic required to create Workflow based on Primary Address time zone.
The detail error message is looked like
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.ServiceModel.Dispatcher.NetDispatcherFaultException: The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org:response. The InnerException message was ‘Invalid enum value ‘GMTPLUS0500ISLAMABAD_KARACHI’ cannot be deserialized into type ‘Microsoft.Dynamics.AX.Framework.Workflow.Model.AxWorkflowServiceReference.Timezone’. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute.’. Please see InnerException for more details. —> System.Runtime.Serialization.SerializationException: Invalid enum value ‘GMTPLUS0500ISLAMABAD_KARACHI’ cannot be deserialized into type ‘Microsoft.Dynamics.AX.Framework.Workflow.Model.AxWorkflowServiceReference.Timezone’. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute.
If we see description that problem is conversion between two time Zone. On comparison
I found time zone enum “Microsoft.Dynamics.AX.Framework.WorkFlow.Model.AXWorkflowServiceReference.TimeZone” did not have GMTPLUS0500ISLAMABAD_KARACHI.