Tuesday, February 5, 2019

D365 F&O oData Post request Error "Cannot convert a value to target type 'Edm.Decimal' because of conflict between input format string/number and parameter 'IEEE754Compatible'"

Some times we will get the below error with oData post request to D365 F & O.
System.InvalidOperationException: Cannot convert a value to target type 'Edm.Decimal' because of conflict between input format string/number and parameter 'IEEE754Compatible' false/true. at Microsoft.Dynamics.Platform.Integration.Services.OData.AxODataEntityDeserializer.ReadODataBody[T](HttpRequestMessage request) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at Microsoft.Dynamics.Platform.Integration.Services.OData.AxODataEntityDeserializer.ReadODataBodyAsType(HttpRequestMessage request, Type clrType) at Microsoft.Dynamics.Platform.Integration.Services.OData.AxODataEntityDeserializer.ReadODataBodyAsDelta(HttpRequestMessage request, Type clrType) at Microsoft.Dynamics.Platform.Integration.Services.OData.AxODataController.ReadBodyAsDelta(EntityType entityType) at Microsoft.Dynamics.Platform.Integration.Services.OData.AxODataController.Post() at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayCl
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Solution is add to content type as "application/json;IEEE754Compatible=true"

Friday, January 11, 2019

HTTP Error 400. The request has an invalid header name - Post request to D 365 F&O oData service from Fiddler

An error "HTTP Error 400. The request has an invalid header name" comes when we do Post request to D 365 F&O oData service as below from Fiddler.

Request message:
POST https:axurl/data/XXX HTTP/1.1
Content-Type: application/json; charset=utf-8
Authorization: Bearer
Host: axurl
{
"@odata.type":"#Microsoft.Dynamics.DataEntities.XXX",
"dataAreaId":"YYY"
}

Error message:
HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
Date: Fri, 11 Jan 2019 14:54:42 GMT
Connection: close
Content-Length: 339

Bad Request

Bad Request - Invalid Header



HTTP Error 400. The request has an invalid header name.



The solution to resolve this error is just add extra space between header and body as below

POST https:axurl/data/XXX HTTP/1.1
Content-Type: application/json; charset=utf-8
Authorization: Bearer
Host: axurl

{
"@odata.type":"#Microsoft.Dynamics.DataEntities.XXX",
"dataAreaId":"YYY"
}

Thursday, July 26, 2018

Place a message to IBM MQ from AX

To place a message in IBM MQ from AX, we can use the library from IBM Bus, i.e., amqmdnet.

Create a Visual Studio project with the below code and add to AOT.

Hashtable connectionProperties = new Hashtable();

connectionProperties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);
 

connectionProperties.Add(MQC.HOST_NAME_PROPERTY, Connectionname);

connectionProperties.Add(MQC.CHANNEL_PROPERTY, Channel);

MQQueueManager queueManager = new MQQueueManager(QueueManager, connectionProperties);

int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;

MQQueue queue = queueManager.AccessQueue(QueueName, openOptions);

MQMessage queueMessage = new MQMessage();



queueMessage.CharacterSet = 1208;

queueMessage.WriteBytes(message);
 
MQPutMessageOptions queuePutMessageOptions = new MQPutMessageOptions();



queue.Put(queueMessage, queuePutMessageOptions);

Call the above code from X++ and pass the message, queue manager details to place the message in IBM MQ.

Wednesday, December 9, 2015

"Reporting framework error: Dynamic packed query not found"

When we run the report the error "Reporting framework error: Dynamic packed query not found." thrown.

Sol: Make sure the Business connector pointing to right AOS will fix this error.

Monday, December 7, 2015

"Parameter _reportName cannot be null or empty."

When any report opened in ax 2012 the below error message thrown.

"Parameter _reportName cannot be null or empty."
"The AssetBasisRdlContract.getAttributes() reflection API could not create and return the SrsReportNameAttribute object. Please check the parameters."


Solution: Compile the Application.

Tuesday, August 11, 2015

Navigate to a page in Ax 2012 Modern POS by using JS and Blank Operation

Follow the below steps to navigate to a page in AX 2012 Modern POS by using JS and Blank operation.
1. Create a Button grid and add a Button to it.
2. Select the button properties and set the operation as Blank operation and 
        Operation number as XXX. If required parameters also can be given. 
        Run the Distribution Schedule "Registers"(1090).
3. Open POS Client >windows> C1>POS solution in visual studio.
4. Open the POS.Js file and find for the Blank operation Case and add 
        the below code to navigate to Categories view.
                        
                        var parameters= actionProperty.split(";");
                         
                        if (parameters[0] == "XXX")
                            Commerce.ViewModelAdapter.navigate("CategoriesView");
                        return true;

5. Now create a package and install / execute the solution from Visual studio.
6. Click on the button created in 1st step it will redirect to Categories View page

Wednesday, August 5, 2015

AX 2012 Workflow Batch Job "Failed to find workflow" error

AX 2012 workflow batch job fails with the error "Failed to find workflow" message.

To resolve the error find the Record which is in queue and causing the issue and update MessageLifeCycleState to 2.

The below code will give you the record which is causing the error.
SYSWORKFLOWMESSAGETABLE SYSWORKFLOWMESSAGETABLE;
SYSWORKFLOWTABLE SYSWORKFLOWTABLE;

while Select RECID from SYSWORKFLOWMESSAGETABLE 
    Where SYSWORKFLOWMESSAGETABLE.MESSAGELIFECYCLESTATE == 1  && SYSWORKFLOWMESSAGETABLE.ROOTCORRELATIONID
notexists join SYSWORKFLOWTABLE 
    where SYSWORKFLOWMESSAGETABLE.RootCorrelationId == SYSWORKFLOWTABLE.RootCorrelationId
    {
        info(strFmt("%1",SYSWORKFLOWMESSAGETABLE.RecId));

    }