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

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,
 
I have the same question (0)
  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 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,243 Super User 2025 Season 2 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

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 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans