Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / error labelId: -is an ...
Finance forum
Unanswered

error labelId: -is an invalid character - Export DMF

Posted on by 242
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?
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,326 Super User 2024 Season 2 on at
    error labelId: -is an invalid character - Export DMF
    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.
     
     
  • DELDYN Profile Picture
    DELDYN 242 on at
    error labelId: -is an invalid character - Export DMF
    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
    André Arnaud de Cal... 290,326 Super User 2024 Season 2 on at
    error labelId: -is an invalid character - Export DMF
    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
    DELDYN 242 on at
    error labelId: -is an invalid character - Export DMF
    Any idea?
  • DELDYN Profile Picture
    DELDYN 242 on at
    error labelId: -is an invalid character - Export DMF
    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?
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,326 Super User 2024 Season 2 on at
    error labelId: -is an invalid character - Export DMF
    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
    DELDYN 242 on at
    error labelId: -is an invalid character - Export DMF
    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?
  • DELDYN Profile Picture
    DELDYN 242 on at
    error labelId: -is an invalid character - Export DMF
    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
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,326 Super User 2024 Season 2 on at
    error labelId: -is an invalid character - Export DMF
    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?

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,326 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,166 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans