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

GetDimensionSetID on ChangeCompany

(0) ShareShare
ReportReport
Posted on by 15

Hi all,

I have a situation where i have to get dimension values, names and codes and move them to other company's general journal. For this purpose i am using GetDimensionSetID method from Dimension Management code unit. I am facing issue as GetDimensionSetID is getting ID from same company instead of the change company. Here is the code:

DimVal1.Reset();
DimVal1.ChangeCompany(CompanyName);
DimVal1.SetFilter(DimVal1."Dimension Code", 'PROJECT');
DimVal1.SetFilter(DimVal1.Code, Project);
IF DimVal1.FindFirst() THEN begin
    ProjValID := DimVal1."Dimension Value ID";      //////////////////////Working fine here(getting dimension value from other company)
end;
dimSetTemp.ChangeCompany(CompanyName);
dimSetTemp.Reset();
dimSetTemp."Dimension Code" := 'PROJECT';
dimSetTemp."Dimension Value Code" := Project;
dimSetTemp."Dimension Value ID" := ProjValID;
dimSetTemp.Insert();
GenJnlLine."Dimension Set ID" := dimMgt.GetDimensionSetID(dimSetTemp);       //////////////////////Get id of same company instead of the other company.
Please help me how i can resolve this.
Regards,
 
  • Suggested answer
    Suresh Kulla Profile Picture
    50,280 Super User 2026 Season 1 on at

    How are you passing the CompanyName value?

  • SaghirLord Profile Picture
    15 on at

    CompanyName is a method's parameter.

  • Suggested answer
    Suresh Kulla Profile Picture
    50,280 Super User 2026 Season 1 on at

    I don't believe the change company will work on the temporary records. What is your requirement ?

  • Verified answer
    AlessandroC Profile Picture
    25 on at

    Hi Saghir,

    as best practice I usually use ChangeCompany only for read records.

    In your scenario (if you want to insert a new dimension in a different company) try to use a StartSession  in that company.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
11manish Profile Picture

11manish 9 Super User 2026 Season 2

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 1 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans