web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Dual Write error, map empty optionset values?

(2) ShareShare
ReportReport
Posted on by 24
Hi all,
 
When writing to the Customers table in F&O, I'm getting Dual Write error messages, see below. I think this is related due to a mapping between an Optionset field in F&O and in Dataverse. When this field in F&O is empty it is creating errors, when filled it is fine. How can I add an empty value in the Value map to prevent this?
 
Thanks for your help!
 

Unable to write data to entity accounts. Writes to CustCustomerV3Entity failed with error message Request failed with status code BadRequest and CDS error code : 0x80048419 response message: Error identified in Payload provided by the user for Entity ':'

For more information on this error please follow this help link

https://go.microsoft.com/fwlink/?linkid=2195293

 

----> InnerException :

Microsoft.OData.ODataException: Cannot convert the literal '' to the expected type 'Edm.Int32'.

---> System.FormatException: Input string was not in a correct format.

at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)

at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)

at System.String.System.IConvertible.ToInt32(IFormatProvider provider)

at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)

at Microsoft.OData.PayloadValueConverter.ConvertStringValue(Type targetType)

at Microsoft.OData.PayloadValueConverter.ConvertValue (…)

--- End of inner exception stack trace ---

at Microsoft.OData.PayloadValueConverter.ConvertValue (…)

at Microsoft.Dynamics.Ax.Metadata (…)

at Microsoft.Crm.Extensibility.ODataV4.Primitive (…)

at Microsoft.OData.JsonLight.ODataJsonLightReader (…)

at Microsoft.OData.JsonLight.ODataJsonLightReader (…)

(messageReaderSettings, Boolean validateNullValue, String propertyName)

Categories:
I have the same question (0)
  • Suggested answer
    Navneeth Nagrajan Profile Picture
    2,495 Super User 2026 Season 1 on at
    Hi @Henki,
     
    We have faced this issue one of the customers. Data transformations especially is a challenge with empty enum values and converting literals from dataverse to D365 Fo enums is tricky too.
     
    Suggestions and Approach:
    1. We assigned a default integer value because in D365 FO null values are read as 0.
    [ExtensionOf(tableStr(CustCustomerV3Entity))]
    final class CustCustomerV3Entity_Extension
    {
        public void initValue()
        {
            next initValue();

            // To Ensure numeric fields aren't empty strings
            if (this.<FieldName>== '')
                this.<FieldName>= '0';  // Or set to null if nullable
            // Similar for other fields like Amt etc.
        }
    }
    Recompile and start the Dual write map.
     
    2. The other option is to use System.String to convert the literal values into a string and then using implicit conversion methods like str2Enum (enumvalue enum, <stringtoconvert>) in X++ to convert the string values into literals (called as enums in X++) .
     
    Hope this helps. Happy to answer questions, if any.
  • Henki Profile Picture
    24 on at
    Thanks for your help! 
    I was hoping for an easier option, Dual Write self doesn't support this? It is not possible to do this without coding? 
  • Suggested answer
    Sagar121 Profile Picture
    1,151 Super User 2026 Season 1 on at

    Hi,

    This error will come whenever you are missing values of Enum datatype at F&O and Choice datatype at Dataverse side. I assume you will already have all enum values at F&O side.

    Go to dual write mapping page and click on the Transformation icon. There, you can set the default values ( value map).

    If the enum value it not available at dataverse side then you can extend your choice type and add the new value and do mapping. 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 586 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 311

#3
Diego Mancassola Profile Picture

Diego Mancassola 271

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans