cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SP123456
Regular Visitor

PCF Control - Get Form name

Is it possible to get the form name which the PCF control is embedded within via the context object?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
DianaBirkelbach
Super User
Super User

HI @SP123456 , 

 

even if you get the name of the form somewhere in the PCF context, it would be unuspported.

 

The supported way would be to add a dummy field to your PCF (something like "formName") and use form scripting to grab the form name (as @MayankP suggested) and set that value for a dummy column associated with the PCF "formName" property.

 

 Hope this helps!

 

 

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
MayankP
Responsive Resident
Responsive Resident

Hi @SP123456 

you can get  FormContext from executioncontext ...

 

ExecutionContextObj.getFormContext()

 

and then many be get current form as below..

 

formItem = formContext.ui.formSelector.getCurrentItem();

 

and then can access form label like  formItem.GetLabel()

 

refer following article for more information 

https://docs.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/reference/formcont...

 

 

Hope this helps..

DianaBirkelbach
Super User
Super User

HI @SP123456 , 

 

even if you get the name of the form somewhere in the PCF context, it would be unuspported.

 

The supported way would be to add a dummy field to your PCF (something like "formName") and use form scripting to grab the form name (as @MayankP suggested) and set that value for a dummy column associated with the PCF "formName" property.

 

 Hope this helps!

 

 

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."

Thanks @MayankP 

Thanks for this @DianaBirkelbach, I will give it a go.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,274)