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
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (3,742)