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

Community site session details

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

Default Dimension update error

(0) ShareShare
ReportReport
Posted on by 6
Hi all, 
 
I'm working on a requirement to create and update records in the jobs and default dimension tables through an API page. I've created the api page, and tested out the insert (POST) method through postman and it successfully inserts the record into jobs table (Job no, description) and default dimension table (sales person) dimension. 
 
However, when I run the PATCH method through postman to update the job no I created above, the jobs table updates fine. But I'm facing an issue with the default dimension table. Instead of updating the records, it deletes the sales person dimension from the default dimension table for that job no. 

Below is the code. Could someone please advise what i'm missing here. 
 
 trigger OnModifyRecord(): Boolean
    var
        Job: Record Job;
    begin
        JobsSetup.Get();
 
        Job.GetBySystemId(Rec.SystemId);
 
        if Rec./No./ = Job./No./ then
            Rec.Modify(true);
 
        ModifyDefaultDimension(Rec./No./, 'salesperson', SalesPerson);
    end;
 
 local procedure ModifyDefaultDimension(JobNo: Code[20]; DimCode: Code[20]; DimValue: Code[20])
    var
        DefaultDimension: Record /Default Dimension/;
    begin
        DefaultDimension.Validate(/Table ID/, Database::Job);
        DefaultDimension.Validate(/No./, JobNo);
        DefaultDimension.Validate(/Dimension Code/, DimCode);
        DefaultDimension.Validate(/Dimension Value Code/, DimValue);
        DefaultDimension.Modify(true);
    end;
 
 
Thank you! 
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    94,506 Super User 2025 Season 2 on at
    Default Dimension update error
    Hi, a very simple question. For Job, you used GetBySystemId to get the record, but for Default Dimension, you just used Modify, and you haven't Get or Find it yet. The system doesn't know which record to modify.
     
    Hope this can give you some hints.
    Thanks
    ZHU
  • Community member Profile Picture
    6 on at
    Default Dimension update error
    Thank you! I'm new to business central. 
     
    I updated the modify logic as below, and as show in the postman output, the system picks up the values for the 3 primary keys with an error messaging saying the DD does not exist. However, when i go to the DD table to find the record, I see the record that i want to modify there. I'm not sure why it says the DD does not exist when it's there. 
     
     
     
    local procedure ModifyDefaultDimension(JobNo: Code[20]; DimCode: Code[20]; DimValue: Code[20])
        var
            DefaultDimension: Record "Default Dimension";
        begin
            if DefaultDimension.Get(Database::Job, JobNo, DimCode) then begin
                DefaultDimension.Validate("Dimension Value Code", DimValue);
                DefaultDimension.Modify(true);
            end;
        end;
    -----------------------------------------------------------------------postman output-------------------------------------------------------------------------------------------------------------------------------
     
    {
        "error": {
            "code": "Internal_RecordNotFound",
            "message": "The Default Dimension does not exist. Identification fields and values: Table ID='167',No.='FINALTEST12',Dimension Code='SALESPERSON'  CorrelationId:  e1db6f71-9183-4556-91ad-7d9407ad4d72."
        }
    }
     

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,907

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,169 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,977 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans