cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cchannon
Responsive Resident
Responsive Resident

pcf assign output params for canvas app operations

I am building a dataset type pcf specifically to embed in a powerapp. This control needs to perform limited API operations ("PUT") but since we don't have a webapi in pcf for canvas, that makes this part a bit tricky.

 

I want to be lazy about my coding and pass the operations back up to the containing powerapp so I can handle them there--where I don't need to handle my own authentication.

 

Is there a way to assign value to params of type "output" such that they can be picked up by a canvas app for OnChange events, or is my only real option here to import adal and use app authentication from inside pcf?

1 ACCEPTED SOLUTION

Accepted Solutions
cchannon
Responsive Resident
Responsive Resident

OK, I think I have it myself, at least partially...

 

part 1: define the output param in ControlManifest.Input.xml:
<property name="output" display-name-key="outputVal" description-key="Output from the conrol" of-type="SingleLine.Text" usage="output"/>

 

part 2: define the datatype of the output in manifesttypes.d.ts:
export interface IOutputs { output?: string; }

 

part 3: attach your own notifyoutputchanged event to the init param:
public init(context: ComponentFramework.Context<IInputs>, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container:HTMLDivElement)
{
this._notifyOutputChanged = notifyOutputChanged;
}

 

part 4: designate a return val for the type defined in manifesttypes:
public getOutputs(): IOutputs { return {output : "test"}; }

 

part 5: call your notifyoutputchanged event wherever in code you want the change recognized:
this._notifyOutputChanged();

 

part 6: in PowerApps, add your pcf control, then add a label valued as <controlname>.output

 

... All that still missed the onchange part, but I am sure I will figure that out eventually.

View solution in original post

2 REPLIES 2
cchannon
Responsive Resident
Responsive Resident

OK, I think I have it myself, at least partially...

 

part 1: define the output param in ControlManifest.Input.xml:
<property name="output" display-name-key="outputVal" description-key="Output from the conrol" of-type="SingleLine.Text" usage="output"/>

 

part 2: define the datatype of the output in manifesttypes.d.ts:
export interface IOutputs { output?: string; }

 

part 3: attach your own notifyoutputchanged event to the init param:
public init(context: ComponentFramework.Context<IInputs>, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container:HTMLDivElement)
{
this._notifyOutputChanged = notifyOutputChanged;
}

 

part 4: designate a return val for the type defined in manifesttypes:
public getOutputs(): IOutputs { return {output : "test"}; }

 

part 5: call your notifyoutputchanged event wherever in code you want the change recognized:
this._notifyOutputChanged();

 

part 6: in PowerApps, add your pcf control, then add a label valued as <controlname>.output

 

... All that still missed the onchange part, but I am sure I will figure that out eventually.

View solution in original post

Hi,

 

Thanks for your follow up. I am glad you were able to get this issue figured out. Thanks for the information, hopefully it can help future communities members with their issues in the future. 

 

Regards,

 

Alex

 

-------

 

Community Support Team _ Alex Rezac
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
User Groups Public Preview

Join us for our User Group Public Preview!

Power Apps User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (63,029)