Hello Guys,
I need your help to try to fix an error that last for a long time with my integration.
On my company I did the integration between CRM 2013 and NAV 2013 R2 (all on-promises).
I have created a custom integration between CRM opportunities and NAV Quotes, since our quotes are done on NAV, natively CRM opportunities don’t have number, so I’m using an auto-number solution for it thinking that using this new field could be common to create a bi-lateral sync.
In fact If I try to use this field the connector returns and error: “[0e55c2bc-6bfe-e511-9445-00155d003803] Opportunity to NAV Sales Quote Exception occurred in Microsoft Dynamics NAV” so I’m using the field “Opportunity” as integration ID.
The problem is that randomly there are a lot of duplicated records on NAV Quotes like I said is random sometimes it created 4/8 duplicated records on NAV then stops, other times I works fine, but If you set the opportunity to WON it start duplicating again.
This is my filter code:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Transformeb7a75affb264a05a829cfdd8b1ba162
{
using Microsoft.Dynamics.Integration.Transform;
using System.Collections.Generic;
public partial class Transformer : Microsoft.Dynamics.Integration.Transform.TransformBase, Microsoft.Dynamics.Integration.Transform.ITransform
{
public override object TransformObject(object source)
{
return this._(((System.Collections.Generic.Dictionary<string, object>)(source)));
}
private Microsoft.Dynamics.Integration.Filtering.FilterResult _(System.Collections.Generic.Dictionary<string, object> source)
{
Microsoft.Dynamics.Integration.Filtering.FilterResult _ = new Microsoft.Dynamics.Integration.Filtering.FilterResult();
_.PassedCriteria = Microsoft.Dynamics.Integration.Mapping.Helpers.LogicalMappingHelper.Or(Microsoft.Dynamics.Integration.Mapping.Helpers.LogicalMappingHelper.And(Microsoft.Dynamics.Integration.Mapping.Helpers.LogicalMappingHelper.EqualTo(( ((source != null)
&& (source.ContainsKey("new_criarpropostanav") == true)) ? ((System.Nullable<bool>)(source["new_criarpropostanav"])) ?? null : default(System.Nullable<bool>) ), true), Microsoft.Dynamics.Integration.Mapping.Helpers.DefaultValueLogicMappingHelper.DecimalDefaultEqualTo(Microsoft.Dynamics.Integration.Transform.TransformBase.NullableToNullable<decimal, int>(( (((source != null)
&& (source.ContainsKey("statuscode") == true))
&& ((((System.Collections.Generic.Dictionary<string, object>)(source["statuscode"])) != null)
&& (((System.Collections.Generic.Dictionary<string, object>)(source["statuscode"])).ContainsKey("Value") == true))) ? ((System.Nullable<int>)(((System.Collections.Generic.Dictionary<string, object>)(source["statuscode"]))["Value"])) ?? null : default(System.Nullable<int>) )), 1M)), false);
return _;
}
}
}
And this the transform code:
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Transform545c9d75575a455c9beb7de93c575e0e
{
using Microsoft.Dynamics.Integration.Transform;
using System.Collections.Generic;
public partial class Transformer : Microsoft.Dynamics.Integration.Transform.TransformBase, Microsoft.Dynamics.Integration.Transform.ITransform
{
public override object TransformObject(object source)
{
return this._(((System.Collections.Generic.Dictionary<string, object>)(source)));
}
private System.Collections.Generic.Dictionary<string, object> _(System.Collections.Generic.Dictionary<string, object> source)
{
System.Collections.Generic.Dictionary<string, object> _ = new System.Collections.Generic.Dictionary<string, object>();
_["Sell_to_Customer_No"] = ( ((source != null)
&& (source.ContainsKey("new_accountno") == true)) ? ((string)(source["new_accountno"])) : default(string) );
_["Sell_to_Contact"] = ( (((source != null)
&& (source.ContainsKey("parentcontactid") == true))
&& ((((System.Collections.Generic.Dictionary<string, object>)(source["parentcontactid"])) != null)
&& (((System.Collections.Generic.Dictionary<string, object>)(source["parentcontactid"])).ContainsKey("Name") == true))) ? ((string)(((System.Collections.Generic.Dictionary<string, object>)(source["parentcontactid"]))["Name"])) : default(string) );
_["Requested_Delivery_Date"] = Microsoft.Dynamics.Integration.Transform.TransformBase.NullableToValue<System.DateTime, System.DateTime>(( ((source != null)
&& (source.ContainsKey("new_datadeentregaacliente") == true)) ? ((System.Nullable<System.DateTime>)(source["new_datadeentregaacliente"])) ?? null : default(System.Nullable<System.DateTime>) ));
_["Estimated_Close_Date"] = Microsoft.Dynamics.Integration.Transform.TransformBase.NullableToValue<System.DateTime, System.DateTime>(( ((source != null)
&& (source.ContainsKey("estimatedclosedate") == true)) ? ((System.Nullable<System.DateTime>)(source["estimatedclosedate"]))
?? null : default(System.Nullable<System.DateTime>) ));
_["Manager"] = ( (((source != null)
&& (source.ContainsKey("new_gestor") == true))
&& ((((System.Collections.Generic.Dictionary<string, object>)(source["new_gestor"])) != null)
&& (((System.Collections.Generic.Dictionary<string, object>)(source["new_gestor"])).ContainsKey("Name") == true))) ? ((string)(((System.Collections.Generic.Dictionary<string, object>)(source["new_gestor"]))["Name"])) : default(string) );
_["Salesperson_Code"] = ( (((source != null)
&& (source.ContainsKey("ownerid") == true))
&& ((((System.Collections.Generic.Dictionary<string, object>)(source["ownerid"])) != null)
&& (((System.Collections.Generic.Dictionary<string, object>)(source["ownerid"])).ContainsKey("dynamics_integrationkey") == true))) ? ((string)(((System.Collections.Generic.Dictionary<string, object>)(source["ownerid"]))["dynamics_integrationkey"])) : default(string) );
_["Proposal_Owner"] = ( (((source != null)
&& (source.ContainsKey("new_proposal_owner") == true))
&& ((((System.Collections.Generic.Dictionary<string, object>)(source["new_proposal_owner"])) != null)
&& (((System.Collections.Generic.Dictionary<string, object>)(source["new_proposal_owner"])).ContainsKey("Name") == true))) ? ((string)(((System.Collections.Generic.Dictionary<string, object>)(source["new_proposal_owner"]))["Name"])) : default(string) );
_["CRM_Opportunity_No"] = ( ((source != null)
&& (source.ContainsKey("new_number") == true)) ? ((string)(source["new_number"])) : default(string) );
_["Oportunity_CRM"] = ( ((source != null)
&& (source.ContainsKey("name") == true)) ? ((string)(source["name"])) : default(string) );
_["Oportunity_Classification"] = ( (((source != null)
&& (source.ContainsKey("new_classificao") == true))
&& ((((System.Collections.Generic.Dictionary<string, object>)(source["new_classificao"])) != null)
&& (((System.Collections.Generic.Dictionary<string, object>)(source["new_classificao"])).ContainsKey("name") == true))) ? ((string)(((System.Collections.Generic.Dictionary<string, object>)(source["new_classificao"]))["name"])) : default(string) );
_["Inactive_Quote"] = Microsoft.Dynamics.Integration.Mapping.Helpers.LogicalMappingHelper.If(Microsoft.Dynamics.Integration.Mapping.Helpers.LogicalMappingHelper.EqualTo(( (((source != null)
&& (source.ContainsKey("statecode") == true))
&& ((((System.Collections.Generic.Dictionary<string, object>)(source["statecode"])) != null)
&& (((System.Collections.Generic.Dictionary<string, object>)(source["statecode"])).ContainsKey("Value") == true))) ? ((System.Nullable<int>)(((System.Collections.Generic.Dictionary<string, object>)(source["statecode"]))["Value"])) ?? null : default(System.Nullable<int>) ), 2), "1", "0");
_["Quote_Status"] = Microsoft.Dynamics.Integration.Mapping.Helpers.LogicalMappingHelper.If(Microsoft.Dynamics.Integration.Mapping.Helpers.LogicalMappingHelper.EqualTo(Microsoft.Dynamics.Integration.Transform.TransformBase.NullableToNullable<int, bool>(( ((source != null)
&& (source.ContainsKey("presentproposal") == true)) ? ((System.Nullable<bool>)(source["presentproposal"])) ?? null : default(System.Nullable<bool>) )), 0), "0", "1");
_["Bill_to_Contact"] = ( (((source != null)
&& (source.ContainsKey("parentcontactid") == true))
&& ((((System.Collections.Generic.Dictionary<string, object>)(source["parentcontactid"])) != null)
&& (((System.Collections.Generic.Dictionary<string, object>)(source["parentcontactid"])).ContainsKey("Name") == true))) ? ((string)(((System.Collections.Generic.Dictionary<string, object>)(source["parentcontactid"]))["Name"])) : default(string) );
_["Prices_Including_VAT"] = Microsoft.Dynamics.Integration.Transform.ConversionUtilities.SafeToString(( ((source != null)
&& (source.ContainsKey("presentproposal") == true)) ? ((System.Nullable<bool>)(source["presentproposal"])) ?? null : default(System.Nullable<bool>) ));
_["Ship_to_Contact"] = ( (((source != null)
&& (source.ContainsKey("parentcontactid") == true))
&& ((((System.Collections.Generic.Dictionary<string, object>)(source["parentcontactid"])) != null)
&& (((System.Collections.Generic.Dictionary<string, object>)(source["parentcontactid"])).ContainsKey("Name") == true))) ? ((string)(((System.Collections.Generic.Dictionary<string, object>)(source["parentcontactid"]))["Name"])) : default(string) );
_["Integration_ID"] = Microsoft.Dynamics.Integration.Transform.ConversionUtilities.SafeToString(( ((source != null)
&& (source.ContainsKey("opportunityid") == true)) ? ((System.Guid)(source["opportunityid"])) : default(System.Guid) ));
return _;
}
}
}
If you could help me with this I appreciate a lot since I’m feeling a bit lost in order to solve this issue.
Regards,