Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Validate Country/Region Code error

Posted on by 25

Hi,

i have written a code, which auto assign dimension value Customer."Country/Region Code" := DefaultDimension."Customer Country".

I have issue, that if i change Country/Region Code i got error, that in DefaultDimension already exist record assigned to this Customer No.

So how i can write code, which does if record already exist in the table, then modify, if not then create new one.

Thansk for help.

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,565 Super User 2024 Season 2 on at
    RE: Validate Country/Region Code error

    Hi, I answered a similar question once and hoped to give you some hints.

       

    Thanks.

    ZHU

  • Suggested answer
    Amit Baru Profile Picture
    Amit Baru 3,025 on at
    RE: Validate Country/Region Code error

    hi,

    pls send code.

    regards

    Amit Sharma

    www.erpconsultors.com

    www.linkedin.com/.../

  • Mai lah Profile Picture
    Mai lah 25 on at
    RE: Validate Country/Region Code error

    Unlucky it doesnt work :/

    My code which i tried to work with:

    DefDim.Reset;

    DefDim.Setrange(No., DefDim.No);

    DefDim.Setrange(Dimension Code, Dimension.Code);

    if DefDim.Findset then begin

    here modify if get,

    end else,

    here insert if not get.

    I doesn't get error, but it wont assign either.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Validate Country/Region Code error

    Hi, Please try below

    customer.get("CustomerNo.");

    Customer."Country/Region Code" := DefaultDimension."Customer Country";

    if customer.modify then;

  • Mai lah Profile Picture
    Mai lah 25 on at
    RE: Validate Country/Region Code error

    Any help?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans