Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

PCF is not working when form context is used

(0) ShareShare
ReportReport
Posted on by 125

Hi All,

I have build PCF using some of the deprciated Client APis lke

Xrm.Utility.getGlobalContext().getQueryStringParameters().pageType
and Xrm.Page
to get the related details. My problem is when I need to use it to build PCF as there is no way or atleast I can't  find a way to use formContext .
Here is the example of it, I tried to define a fuction and use form context but its giving error in PCF as its not accepting the formContext. Can you please tell me the way because I am afraid if its depricated completly, we need to rework again and if its depricated then what is the timeline for complete block of it???
account1 = Xrm.Page.getAttribute("account").getValue();
var userSettings = Xrm.Utility.getGlobalContext().userSettings;
var currentuserid = userSettings.userId;
if (Xrm.Utility.getGlobalContext().getQueryStringParameters().pageType=="quickcreate"){      
var userId=currentuserid.replace("{", "").replace("}", "");
var req = new XMLHttpRequest();
req.open("GET", Xrm.Utility.getGlobalContext().getClientUrl() + "/api/data/v9.2/systemusers(" + userId + ")?$select=productmarket", false);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,688 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,643 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans