cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FredericTerryn
Frequent Visitor

Acces organizationid within PCF

Hi 

 

I'm building some PCF's for Dynamics 365 CE. 
One of the issues I encountered is the need to acces the organizationId from where the pcf is currently running. 

I found it to be available inside the context-input : 

Context.mode.orgSettings._customControlExposedOrgSettings.organizationId

 

Will this be supported in the future? 

1 ACCEPTED SOLUTION

Accepted Solutions
DianaBirkelbach
Super User
Super User

Hi @FredericTerryn ,

I couldn't found the organizationid in the context, but you can still add the webAPI feature to your PCF and make a supported request for that:

context.webAPI.retrieveMultipleRecords("organization", "?$select=organizationid")
.then((resp) => resp.entities[0].organizationid)
.catch(console.error)

Best regards,

Diana 

Kind regards,
Diana
----------
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

4 REPLIES 4
DianaBirkelbach
Super User
Super User

Hi @FredericTerryn ,

I couldn't found the organizationid in the context, but you can still add the webAPI feature to your PCF and make a supported request for that:

context.webAPI.retrieveMultipleRecords("organization", "?$select=organizationid")
.then((resp) => resp.entities[0].organizationid)
.catch(console.error)

Best regards,

Diana 

Kind regards,
Diana
----------
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

@FredericTerryn 

I was able to find the organizationId here:

context.orgSettings._customControlExposedOrgSettings.organizationId

But as it is not documented and also the way it is named I don't think it will be supported in future. In case it gets exposed, most probably it will get refactored under some other property.


----
Danish Naglekar | Power Maverick
If this post helps, then please consider Accept it as the solution to help the other members.

  


Power Maverick | Microsoft Business Application MVP
rajyraman
MVP

@FredericTerryn- This works in model driven app.

Xrm.Utility.getGlobalContext().organizationSettings.organizationId

 

v-xida-msft
Community Support
Community Support

Hi @FredericTerryn ,

I agree with  @DianaBirkelbach 's thought almost. You could use the the context.webAPI.retrieveMultipleRecords() Client API could achieve your needs.

 
Please check the following article for more details:
 
In addition, I also find the orgSettings feature under the context, but the orgSettings feature is not released under PowerApps Component Framework currently.
 
Best regards,
Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,193)