Skip to main content

Notifications

Community site session details

Community site session details

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

Option Type

(0) ShareShare
ReportReport
Posted on by 4,824

Hi Expert, 

I created a new field which has several options (A,B,C,D) in the customer table.
If option is A then, change the salesperson code from x to  y.


"Account Type" := Customer."Account Type";

If "Account Type" := "Account Type":: A Then
xxxxx

The salesperson code has changed, but it also change the type which is B,C,D.

Please advise! Thank you

  • Suggested answer
    YUN ZHU Profile Picture
    82,997 Super User 2025 Season 1 on at
    RE: Option Type

    Hi, because of the limited information you have given, we may not be able to give the correct answer.

    From your code, this code can be placed in the OnValidate (Field) Trigger of "Account Type" field, please make sure it is in the right place.

    Hope this helps as well.

    Thanks.

    ZHU

  • snoppy Profile Picture
    4,824 on at
    RE: Option Type

    No, it does not work even though the line was removed. Thank you!

  • Suggested answer
    Nitin Verma Profile Picture
    21,546 Moderator on at
    RE: Option Type

    Hi,

    Please remove the below marked line from your code.

    "Account Type" := Customer."Account Type";

    If "Account Type" := "Account Type":: A Then

    xxxxx

  • Suggested answer
    YUN ZHU Profile Picture
    82,997 Super User 2025 Season 1 on at
    RE: Option Type

    Hi, please delete first line, "Account Type" := Customer."Account Type";

    And try the following.

    If Rec."Account Type" := Rec."Account Type":: A Then
    xxxxx

    Hope this helps.

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,025 Moderator on at
    RE: Option Type

    Then you have to put the code in the OnValidate trigger of your account type field.

    docs.microsoft.com/.../devenv-onvalidate-field-trigger

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 754

#2
YUN ZHU Profile Picture

YUN ZHU 698 Super User 2025 Season 1

#3
Mansi Soni Profile Picture

Mansi Soni 529

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans