Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

text and code encoding formats

Posted on by 252
Hello everyone,
 
We want to extend the length of /Vendor Invoice No/ but don't know how to write the code, do we need to change it elsewhere(like Table Purch. Inv. Header in posted purchase invoice) ?
 
 
Besides, we want to know the encoding formats of text and code.
 
Much appreciate if someone can help!
Categories:
  • Suggested answer
    Govinda Kumar Profile Picture
    Govinda Kumar 2,201 Moderator on at
    text and code encoding formats
    Hi Charlotte,
     
    You can't simply change the length of the "Vendor Invoice No" field because BC doesn't allow you to modify the length of the field. Instead, you can create a new field with the desired length and replace it on the card page extension.. you can hide the old field and use the new one as an alternative.
     
    Regarding the error that your client is getting, it seems like it's not a standard issue... the out-of-the-box field has a length of 35 characters, and there's no built-in validation for it to be less than or equal to 20 characters. The error may be caused by a custom validation in one of your client's extensions.

    Best Regards
    Govinda Kumar
  • Suggested answer
    Kamal Khakhkhar Profile Picture
    Kamal Khakhkhar 242 on at
    text and code encoding formats
    Hii There,
    as i found this answer. you cann't able to extend the base table field length.
     
     
    you can Replace it by obsolate it and create new field in place of it and need to apply logic at all places. if any expert may give more accurate answer for it.
     
    Thank You.
    Kamal Khakhkhar.
  • Sally X Profile Picture
    Sally X 252 on at
    text and code encoding formats
    Hi Kamal,
     
    Thank you for your reply!
     
    One of our customer got the error "The length of the string is 35, but it must be less than or equal to 20 characters." when filled in Vendor Invoice No. in purchase invoice. 
     
    I think this is caused by their extension as I did not got the error in my standard env. So we think maybe we can extend the length of character in this field to eliminate the error. 
     
    Your comment is helpful but we would like to have more specific code about how to extend the length of Vendor Invoice No. (68, Code[35])
     
    Please kindly help!
     
  • Suggested answer
    Kamal Khakhkhar Profile Picture
    Kamal Khakhkhar 242 on at
    text and code encoding formats
    Hii There,
     
    As per your requirement you can increase the length of the field. there is no issue will be found . but if you decreases the length it will give runtime error. and not upload the extension. and give you error as per below mention.
     
    for your referance i give example using one field. You can use
    tableextension modify property for your task .
     
    /// Before Increment length
     
    field(50003; "Name"; Code[30]) { }
     
    /// After Increment Length.
    field(50003; "Name"; Code[50]) { }
     
    /// After Decrement Length.
    field(50003; "Name"; Code[40]) { }
    Error:- The field 'Name' has reduced the length of the data type from '50' to '40'. Reducing the length of the data type on fields is not allowed.
     
    hope you understand.
     
    Thank You.
    Kamal Khakhkhar.

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,252 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,089 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans