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.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,518)