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

Notifications

Announcements

No record found.

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,100

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
    Inge M. Bruvik Profile Picture
    1,111 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,037 on at

    Hi,

    Pls refer the below code:

    pastedimage1663265498117v1.png

    Regards

    Amit Sharma

    www.erpconsultors.com

  • Suggested answer
    Inge M. Bruvik Profile Picture
    1,111 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,100 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,708 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,606

#2
YUN ZHU Profile Picture

YUN ZHU 931 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 773 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans