pcf-webapi-ext
TypeScript icon, indicating that this package has built-in type declarations

1.0.16 • Public • Published

pcf-webapi-ext

An extension Node Package for PowerApps Component Framework. This package contains code for providing more complete Web API capabilities to PCF controls, such as API Functions and Actions. This code is still a very early work in progress, but in time will provide simplified interaction with Web API functions and actions from within a PCF control.

Installation

Install the package with npm:

npm install pcf-webapi-ext

Usage

Import the WebAPI class from the package and pass the constructor the context object from the PCF control:

import { WebAPIExt } from 'pcf-webapi-ext';
...
const webapi = new WebAPIExt(context);

Note: The context object is the execution context object passed to the PCF control. For pcf-webapi-ext to work, the context object must contain the webAPI property AND the utils property, so make sure these features are enabled in your Component Manifest!

Basic API Operations

Basic API CRUD Operations are functions defined in the Web API and can be called from youre PCF control. To call an basic CRUD operation, use the function members of the WebAPIExt class:

const result = await webapi.createRecord(entityName, record).then((result) => {
    console.log(result);
}).catch((error) => {
    console.error(error);
});

or

const result = await public associateRecords(entityReference, relationship, relatedEntityReference).then((result) => {
    console.log(result);
}).catch((error) => {
    console.error(error);
});

Functions and Actions

Named Functions and Actions from the platform are being implemented in the WebAPIExt class over time under the functions and actions properties. To call a function or action, use the function members of those properties:

const result = await webapi.functions.whoAmI().then((result) => {
    console.log(result);
}).catch((error) => {
    console.error(error);
});

Or

const result = await webapi.actions.addToQueue(queueId, target).then((result) => {
    console.log(result);
}).catch((error) => {
    console.error(error);
});

Package Sidebar

Install

npm i pcf-webapi-ext

Weekly Downloads

33

Version

1.0.16

License

ISC

Unpacked Size

64.5 kB

Total Files

6

Last publish

Collaborators

  • channon