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

Ability to add public methods or events to a PCF control

I am trying to build a PCF control that replaces the OOB Multi-select optionset control.  One of the things that I can't figure out is how to add public methods to my control such that a form script is able to interact with my PCF control.  For example, I need to be able to add the following methods (that the OOB control has):


It seems like it should be possible based on the response to a similar question here: 


However, I've created similar methods on my class that implements the `ComponentFramework.StandardControl` but it doesn't appear to work.  Is this possible?  If so, where should I be placing my methods?

Advocate V
Advocate V

I just a did test with a dropdown control we have on top of an custom option set control and the 'removeOption' method seems to work. Is it triggering the updateView of your control and is your control being re-rendered?

Helper I
Helper I

@skoofy5 - Thanks for the reply!  When I try the following in a form "onLoad" script with my custom PCF I get an error: "TypeError: control.removeOption is not a function"

let control = this._formContext.getControl("mrs_legs"); // My custom PCF control
control.removeOption(123); // Throws the exception: TypeError: control.removeOption is not a function


If I change the control back to the default then I don't receive that error.


My control is very basic at this point but here it is:

import * as React from "react";
import * as ReactDOM from 'react-dom';
import AdvancedMultiSelectControl, { IAdvancedMultiSelectProps } from "./AdvancedMultiSelectControl";
import { IInputs, IOutputs } from "./generated/ManifestTypes";

interface IAdvancedMultiSelectState extends ComponentFramework.Dictionary {


export class AdvancedMultiSelect implements ComponentFramework.StandardControl<IInputs, IOutputs> {
    _container: HTMLDivElement;
    _initialVisible: boolean;
    _initialDisabled: boolean;
    _optionSetMetadata: ComponentFramework.PropertyHelper.FieldPropertyMetadata.OptionSetMetadata;

    constructor() {


    public init(
        context: ComponentFramework.Context<IInputs>,
        notifyOutputChanged: () => void,
        state: IAdvancedMultiSelectState,
        container: HTMLDivElement): void {

        this._container = container;
        this._initialVisible = context.mode.isVisible;
        this._initialDisabled = context.mode.isControlDisabled;
        this._optionSetMetadata = context.parameters.controlProps.attributes!;

    public updateView(context: ComponentFramework.Context<IInputs>): void {
                values: [],
            } as IAdvancedMultiSelectProps),

    public getOutputs(): IOutputs {
        return {};

    public destroy = (): void => {}

    public clearOptions = () => {
        alert("Clear options");

    public getOptions = () => {
        alert("Get options called");

    public removeOption = (option: number) => {
        alert("Remove option");

    public addOption = (option: number) => {


Are you able to share the code from your control?  I must just be not understanding something correctly.  Thanks!

Super User
Super User

Just to get a little more precise @srasmussen .

I don't think that the PCFs have the possibility to define own methods.

On the roadmap is only the definition of custom events, similar to Canvas Components. That was announced for Wave 2, 2021 and hopefuly will be soon available:


The same as @skoofy5 checked, I could verify too that my ColorfulOptionset PCF does have the standard methods (like .getOptions()), exactly like the other standard methods like .setDisabled() and so on. But these are not methods defined inside the PCF, but methods defined for the base type of your PCF. 

These standard methods can be called from form scripting, and the result are the disabled state, or the options provided through the parameters,
For instance .removeOption(...) will call the updateView of your PCF , where context.parameters.optionsInput.attributes.Options doesn't have that option anymore.

Hope this helps!


Kind regards,
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."

Interestingly from that same article, @DianaBirkelbach 

"For model-driven apps, code components can be created for the simple lookup and Multi-select option set (Choices) type, and properties of these new types can also be added. These are top community requests. Additional framework APIs on the canvas apps will be added, which approaches model-driven app parity."


Does that mean support for multiselect isn't ready yet?

Super User
Super User

Hi @skoofy5 
I think it depends how you read the statement. I understand it just as "we can define these properties and use them".
It is confusing, indeed. Maybe I'm wrong.

In my opinion the lookup and multioptionsets are avaibale only for model-driven apps for now.

Even in model-driven apps, considering lookups there are still a lot of properties we need to get from the platform (like in this blog where all these properties for lookup are unsupported: Right now we have only the way to get or chnage the value for the lookup; I suppose there is still a lot to come. So no, it's not ready.


But I don't understand the statement above talking about custom methods for PCFs. As I said, could be just my opinion.




Kind regards,
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."

@DianaBirkelbach - That makes sense about the custom functions. Unfortunately, I'm still not able to take advantage of the OOB methods for a MuliSelectOptionSet (ie "addOption" etc).  Perhaps my manifest isn't setup properly or something?  I'm fairly new to PCF controls so that very well could be the issue. I've pushed my project to a Github repo here: 


If you have any further thoughts or can point to a repo with a working example it would be much appreciated.

Super User
Super User

The manifest is looking good, @srasmussen .

If the manifest would be the problem, you wouldn't be able to load the component on the form.

Maybe is really a bug with the MultiOptionSet ? I don't have one to try it out right now.
But you could try to register the sdk example for MultiOptionSet PCF: and check there if the methods are available.

Kind regards,
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."

@DianaBirkelbach - Thanks!  For some reason I missed that documentation.  I'll give it a try and post results here.

@DianaBirkelbach - Just deployed and tested the example PCF control and it unfortunately has the same problem 😞  So it appears that this is a genuine bug with the MultiSelectOptionSet control.  Do you have any ideas on how to report this to MS?  Do they monitor these forums at all?

Helpful resources

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 (1,446)