Skip to main content
Community site session details

Community site session details

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

Customization In Business central

(0) ShareShare
ReportReport
Posted on by 2,059

Hi All,

I want to create dimension values automatically when a new campaign is created on the campaign card. For this, I created a custom codeunit but it is not working as expected.

The problem is: When my codeunit trigger it will take only the first field from the campaign card and insert it into the dimension page, but what about the rest of the fields?

>>Below screen print for Custom Codeunit:

pastedimage1663245193918v1.png

>> Campagian Card:

pastedimage1663245254686v2.png

>>Dimenssion values: So After triggering codeunit this will insert only TEST as code and it will take description as blank. I need description too. please see the below screen print for the same.

pastedimage1663245460167v3.png

can anyone provide a solution for this?

It would be really appreciated.

  • Suggested answer
    Nitin Verma Profile Picture
    21,571 Moderator on at
    RE: Customization In Business central

    Yes, you can find the data with SystemID, but not sure what is the agenda behind.

    Thanks.

  • Inkey Solutions Profile Picture
    2,059 on at
    RE: Customization In Business central

    Hi All,

    Thank You for the prompt replies. I've changed the code a bit and it is now working very well.

    I have one query, see the below screen print, I've used the systemid to filter a record instead of a hardcoded text value, is it good?

    pastedimage1663323652413v1.png

    Thank you.

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,029 Moderator on at
    RE: Customization In Business central

    Just out of curiosity. Did you create the event trigger you are subscribing to?

    I can not find it in the standard system.

    You should drop your repeat statement. It is not needed in this case.

    pastedimage1663245193918v1.png

    recDimensionValue.reset();
    recDimensionValue.Setrange("Dimension Code",COSTCENTER');
    recDimensionValue.Strange(Code,rec".no.");

    If recDimensionValue.isempty then begin

    recDiemensionValue.init();

    Then fill in your line 18 to 20

    End;

  • Verified answer
    Amit Baru Profile Picture
    3,029 on at
    RE: Customization In Business central

    Hi,

    Pls refer the below code:

    pastedimage1663265498117v1.png

    Regards

    Amit Sharma

    www.erpconsultors.com

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,029 Moderator on at
    RE: Customization In Business central

    For handling dimensions in Business Central customization, i recommend you go through the functions in the DimensionManagement codeunit and make as little code as possible yourself.

    That way you make sure the Dissension sets and the related information is handled correctly.  

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans