web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
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,116

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.

I have the same question (0)
  • Suggested answer
    IB-29041624-0 Profile Picture
    1,187 Moderator on at

    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.  

  • Verified answer
    Amit Baru Profile Picture
    3,043 on at

    Hi,

    Pls refer the below code:

    pastedimage1663265498117v1.png

    Regards

    Amit Sharma

    www.erpconsultors.com

  • Suggested answer
    IB-29041624-0 Profile Picture
    1,187 Moderator on at

    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;

  • Inkey Solutions Profile Picture
    2,116 on at

    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
    Nitin Verma Profile Picture
    21,812 Moderator on at

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

    Thanks.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,086 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,290 Super User 2026 Season 1

#3
AndrewThomas81 Profile Picture

AndrewThomas81 1,218

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans