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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

error labelId: -is an invalid character - Export DMF

(1) ShareShare
ReportReport
Posted on by 476
Hi,

I'm exporting lots of invoices at the same time using a batch. And some of those invoices might cause failure for the whole process because one of the fields have invalid characters.
So the field value might look like this and i will need to go and delete those characters for it to work.


However, when such error happens, it's very hard to detect which invoice is causing this:

1. Is there a way to detect which invoice is causing this error?
2. Is there a way to ignore those characters and allow export to proceed?
I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 Season 2 on at
    Hi,
     
    If you know what type of characters are used, you can probably write a runnable class that will check all invoices for these characters. 
    There is no option to ignore those characters. It is a system validation. 
     
    Do you know how these values came into the application? Probably using a particular import routine or copy and paste values?
  • DELDYN Profile Picture
    476 on at
    Hi Andre,

    I will check if I can ask what those invalid characters are exactly. But how can i look for them in the runnable class?
    For example could they be an emoji that's why they are appearing like this? if yes, how can i detect the emoji?

    And They come from copy paste
  • DELDYN Profile Picture
    476 on at
    Hi Andre,

    I pasted in Visual Studio, the different characters that appeared so far and this is how they look like

     
    what do you suggest, how can i detect those in the runnable class? and what if more came in the future?
  • André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 Season 2 on at
    Hi Deldyn,
     
    There can be various approaches. I will first share the link to all string functions. X++ string runtime functions - Finance & Operations | Dynamics 365 | Microsoft Learn
     
    One approach could be looping through the records and filling a string variable using the function StrKeep where you will provide a list with all allowed alpha characters. You can then compare the field value with the variable.
  • DELDYN Profile Picture
    476 on at
    Hi Andre,
     
    Can you please explain more?
    How can i provide a list of allowed characters? It seems, you somehow want me to do this
    strKeep(Table.Field, listOfAllowedCharacters)
    Then compare but i don't quite understand how will i do it. If u can please show me x++ code on how to do it.
     
    Also you suggested a runnable class? If i'm going to loop on all invoices they could be alot, even if i will put where condition for the current month. So isn't a menu item and running it as batch better? Or is runnable class still fine?
  • DELDYN Profile Picture
    476 on at
    Any idea?
  • André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 Season 2 on at
    Hi Deldyn,
     
    A list with allowed characters could be: "ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789". The allowed characters are not case-sensitive. You can add some other characters, like the percent, dollar, or hashtag when required.
     
    Suppose this is the list with allowed characters, you can set a string variable using the input from the table field and then compare like this:
    Str cleanStr;
    
    cleanStr = strKeep(table.field, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789');
    
    if (table.field != cleanStr)
    {
      // now there is a difference detected. Take your action.
    }
     
    About a runnable class versus a batch job... This depends on your exact requirements. In case you allow for the creation of data with the invalid characters, a batch job might be your choice. If you can block the data entry with invalid characters, then it could be a one-time job to run. I wonder how these characters appeared in your environment.
  • DELDYN Profile Picture
    476 on at
    Hi Andre,

    These characters appeared in the environment because it seems people are copying values from a certain documents and pasting them.
     
    1. You said in case i allow creation of invalid characters, then batch job is an option and I agree. However, you said if block the entry, then it will be a one time job, you mean to run the the runnable class for old records? Because if I block them, then there won't be a need for the runnable class.
     
    2. But how can i know what are the list of allowed characters? there could be alot other than the ones you mentioned like: "/ @ # ,  & ? ' " |  - . "    ..etc so wouldn't this be hard? i might miss something important, and when i run the batch job a big list will appear with alot of invoices, where the functionals will have to go through Loads of them even though there is nothing wrong

     
     
     
  • André Arnaud de Calavon Profile Picture
    300,911 Super User 2025 Season 2 on at
    Hi Deldyn,
     
    Maybe, you initially allow all characters available on the keyboard. However, this is not having all characters available, like the British pound symbol. In a test environment, you can first check what values will be left when you remove the known characters with the function strRem(). You can then check if there are some characters that needs to be added to the list of allowed characters.
     
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 549 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans