web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PCF Control Lookup fie...
Power Apps
Unanswered

PCF Control Lookup field is getting update on the form

(0) ShareShare
ReportReport
Posted on by 24

Hi,

 

I am able to select an item from the lookup.  When I select an item my OnSelectItem event is working.

 

I can see the selected data to build the lookup.   But the form is not getting assigned the selected lookup.

public init(context: any, notifyOutputChanged: (value?: IOutputs) => void, state: any, container: HTMLDivElement): void {
        const onItemSelected = (selectedItem: any) => {
            console.log('onItemSelected event triggered');

            try {
                if (selectedItem) {
                    // Set the new value directly
                    const newValue: ComponentFramework.LookupValue[] = [{
                        entityType: "lfs_systemitemgroup",
                        id: selectedItem._lfs_systemitemgroupid_value,
                        name: selectedItem.lfs_systemitemgroupname
                    }];

                    notifyOutputChanged({ lfs_SystemItemGroupId: newValue });
                } else {
                    // Clear the value of the lookup field if nothing is selected
                    //context.parameters.lfs_SystemItemGroupId.raw.setValue(null);
                    notifyOutputChanged({ lfs_SystemItemGroupId: undefined });
                }
                if (selectedItem) {
                    alert("help");
                }
            } catch (error: any) {
                console.error("Error setting lookup field value:", error.message);
            }
        };
I have the same question (0)
  • Verified answer
    a33ik Profile Picture
    3,306 Most Valuable Professional on at

    NotifyOutputChange doesn't accept any parameters. You have to call it to notify that output changed and put the assigning of the new value to the getOutputs function. You can check an example exactly with the lookup in the following repository - https://github.com/AndrewButenko/LookupToOptionset/blob/main/LookupToOptionset/index.ts

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard