Showing results for 
Search instead for 
Did you mean: 
Helper III
Helper III

Set Lookup Field Value from PCF

Hi Everyone,


I hope I have posted this in the correct place and hopefully this will be a simple thing for most. I am *very* new to PCF development (there is nobody else in our company to do it) and I'm looking to use a component to solve our addressing issues (seems to be a common theme too). I have used another component from the PCF Gallery to get the addressing details, but now I need to set the value of a couple of lookups (State and Country) to the values returned from the API. 


I've seen a lot of posts about creating custom lookup components, but I can't seem to find anything that relates to this slightly simpler task (or it seems simpler). Can anyone point me at any resources that might help me walk through this?




I'm afraid it won't work that way. You will have to create a PCF control of "Field" type and figure out how to work with the Grid.

According to the documentation it should be possible to bind it to pcf controls which are either of type dataset or field and model driven apps. If it's not supported I'll go the ugly way by creating a dummy field which gets populated onLoad.

Can you please point where it is said that "it is possible to bind it to pcf controls which are either of type dataset or field"?

Nowhere and it does not need because the manifest reference applies to both types or am I getting something wrong? Additionally, as I mentioned, I've tried it out. Building the manifest works as expected, I can even register the field to the property but then the PCF stops working and it won't be shown in the form options anymore until I upload the previous version. Let me check the pcf node module if there's an option not enable currently regarding the lookup property. -> Update: Checked featureFlag.json (pcf script node module) and the lookup datatype is now "fully supported". I don't see a reason why it shouldn't work for dataset. I can use an optionset already as an input parameter.

Anyway can you please elaborate why you suggest me to work with a pcf control of type "field" when it's easier to have a dummy control populated by client-side script and go along with the dataset? I totally forgot to ask you but also didn't mention that I've already a fully working generic editable grid developed with fluent ui detailslist. So this is no option.


Even the manifest structure is the same I believe that type of the control is dictated with the first thing referenced - if it is dataset - it will be obviously a dataset control.


Now second thing - just imagine this control is used not on the subgrid but for a regular view. The lookup field loses the context and sense. I believe this is what happens with your control. As far as I understood those "inputs" are available for configuration purposes only.


And now why I provide you this way with field and grid - because I'm confident it will work.


Summoning @HemantG  to the thread.

Power Apps
Power Apps

🙂 . Thanks @a33ik . Your understanding is correct, first one is taken as the type used for the control availability for that type and additional ones are just the configurable proeprties.



Thanks for your reply and elaboration @a33ik.

Thanks hemantg for joining this discussion.


What I don't understand is why is the optionset working as an input in my case? Context would be missing too if registered as a view control. And I believe the pcf developers would prevent building a dataset pcf control manifest if it contains something that isn't supported. We've seen before that building the manifest failed if we tried using unsupported types. I'm not giving up on this, yet. 🙂

Power Apps
Power Apps

@tvd_nzi are you saying that the option set as the first property with data set allows config to both data set and field but the same for lookup does not . This should not happen, can you share both manifests and I can take a look.  



Hemant is the Program Manager of the product group. I assure you, if he says this is how it works, there is no questioning it.

Might be that I get you wrong because of language barriers but what I've observed is that I can use the optionset Project Phase as an input:


<?xml version="1.0" encoding="utf-8" ?>
    <control namespace="tvd" constructor="EditableGrid" version="0.0.5" display-name-key="EditableGrid" description-key="EditableGriddescription" control-type="standard">
        <data-set name="checklist" display-name-key="Checklists subgrid" cds-data-set-options="displayCommandBar:true;displayViewSelector:true;displayQuickFindSearch:true">
        <property name="projectPhase" display-name-key="Project phase" description-key="Project phase" of-type="OptionSet" usage="input" required="true" />
        <!-- <property name="salesOrganization" display-name-key="Sales Organization" description-key="Sales Organization" of-type="Lookup.Simple" usage="input" required="true" /> -->
            <css path="css/ReactStandardControl.css" order="1" />
            <code path="index.ts" order="2"/>
            <resx path="strings/EditableGrid.1033.resx" version="1.0.0" />
      <uses-feature name="Utility" required="true" />
      <uses-feature name="WebAPI" required="true" />

  And get the value:

if (this._projectPhaseCode !== context.parameters.projectPhase.raw) {
            this._projectPhaseCode = context.parameters.projectPhase.raw;

 This is an editable grid I'm developing only for subgrids hence it's on a form and I would like to do everything in the pcf control. I've wrote a wrapper class for the WebApi.EntityRecord/DataSet.EntityRecord and a service to merge the dataset records and the retrieved task templates based on the project phase I'm getting. Now I would like to filter them also by the sales organization which is a custom lookup on the form.


What I've tried so far was adding the property salesOrganization of type Lookup.Simple as input and bound. Input shows up to configure in the form customizer but after publishing it'll pass the dataset as the salesOrganization property. And I can't reconfigure the properties in the form customizer anymore. I have to re-upload the previous manifest without the lookup property.


If that really doesn't work by design it's alright and I can understand but then the OptionSet shouldn't work also, correct?

Helpful resources

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.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (3,214)