Skip to content

Instantly share code, notes, and snippets.

@andrew-grischenko
Last active March 27, 2020 00:34
Show Gist options
  • Save andrew-grischenko/f0268ecbd957586e5988b85373379132 to your computer and use it in GitHub Desktop.
Save andrew-grischenko/f0268ecbd957586e5988b85373379132 to your computer and use it in GitHub Desktop.
Power Apps PCF - On events handling
...
const STATUS_NEW: string = "new";
const STATUS_ERROR: string = "error";
const STATUS_PROCESSING: string = "processing";
const STATUS_COMPLETED: string = "completed";
export class Payments implements ComponentFramework.StandardControl<IInputs, IOutputs> {
...
private transaction_status: string;
private _notifyOutputChanged: () => void;
...
public init(context: ComponentFramework.Context<IInputs>, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container:HTMLDivElement)
{
...
this.transaction_status = STATUS_NEW;
this._notifyOutputChanged = notifyOutputChanged;
...
}
public getOutputs(): IOutputs
{
//This is where we set the value on changes happened
return { PaymentStatus: this.transaction_status };
}
private processPayment( )
{
...
this.transaction_status = STATUS_COMPLETED;
this._notifyOutputChanged();
...
}
<manifest>
<control...>
<property name="TransactionStatus" display-name-key="TransactionStatus" description-key="Transaction status" of-type="SingleLine.Text" usage="bound" required="true" default-value="new"/>
...
</control>
</manifest>
OnChange:
If(PaymentWidget.TransactionStatus = "completed", Navigate(ReceiptScreen))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment