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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Same PCF control for p...
Power Apps
Answered

Same PCF control for portal, canvas app and model driven app

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I am building a PCF control targeting to portal, canvas app and model driven app.

 

One challenge I am facing with API call.

 

For portal app, I need to call custom api which will not work in canvas app I think. 

 

So my question is how my PCF control will identity in which environment the control is running like in portal app or canvas app or model driven app so that I can call different API according to the platform identification?

I have the same question (0)
  • Verified answer
    Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hi @Anonymous , 

     

    To detect where the PCF is running, I have an idea posted, maybe you want to vote it: https://powerusers.microsoft.com/t5/Power-Apps-Ideas/Runtime-possibility-to-detect-if-the-PCF-is-running-in/idi-p/500232

     

    Until not long ago, was not not possible to detect this, since the framework would show a message, if you call a context.webAPI function. But lately the error message is not shown anymore, so you can try with a "catch", and if it doesn't work, can go with the next way. That's actually what the SDK now says: https://docs.microsoft.com/en-us/powerapps/developer/component-framework/code-components-best-practices?WT.mc_id=BA-MVP-5004107#check-api-availability

     

    Hope this helps!

     

    Kind regards,

    Diana

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!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard