Use this connector for writing Add-ins for Proffix Px5.
You can use the connector as ECMAScript-Module, per example in HTML:
<script type="module">
// Use connector as ES2015-module
import { Px5AddInConnector } from "https://px5addinconnector.proffix.app/1/px5-add-in-connector.min.js";
// Define your own message handler for answers from Px5
const messageHandler = function (message) {
console.log("🥳 %cMessage received in my own message handler", "color: darkgreen; font-weight: bold", message);
}
// Instantiate a new connector
const px5 = new Px5AddInConnector("My Add-in", "1.0", "My Company", messageHandler);
// Change value of input control in Px5
px5.changeInputValueInPx5("dfsName", "New Value");
// Trigger event "GetControlsFromPx5" for getting values from input control of Px5
px5.getControlsFromPx5();
// Trigger event "GetInfoFromPx5" for getting infos from Px5
px5.getInfoFromPx5();
// Perform action in Px5
px5.triggerActionInPx5("PerformButtonClick", "pbtOk");
</script>
This project follows SemVer. Every major version is deployed on a different URL: https://px5addinconnector.proffix.app/ combined with the major version number e.g. https://px5addinconnector.proffix.app/1
The following messages are possible from or to Px5.
Triggered on creating new Px5AddInConnector instance.
{
"connectorversion": "1.0.0",
"addin": { "name": "My Px5-AddIn", "version": "0.1", "developer": "My Company" },
"method": "RegisterAddin",
"payload": null
}
None, except in case of an error
Triggered on method changeInputValueInPx5
String Value:
{
"connectorversion": "1.0.0",
"addin": { "name": "My Px5-AddIn", "version": "0.1", "developer": "My Company" },
"method": "ChangeInputValueInPx5",
"payload": {
"controlname": "Px5Feldname_Text",
"value": "My new value"
}
}
Numeric Value:
{
"connectorversion": "1.0.0",
"addin": { "name": "My Px5-AddIn", "version": "0.1", "developer": "My Company" },
"method": "ChangeInputValueInPx5",
"payload": {
"controlname": "Px5Feldname_Numeric",
"value": 12.5
}
}
Boolean Value:
{
"connectorversion": "1.0.0",
"addin": { "name": "My Px5-AddIn", "version": "0.1", "developer": "My Company" },
"method": "ChangeInputValueInPx5",
"payload": {
"controlname": "Px5Feldname_Boolean",
"value": true
}
}
After changing the value on the Px5 form:
{
"currentpxform": "Px5 Form Name",
"currentpxtab": "Tab 1",
"method": "ValueChangedInPx5",
"payload": {
"controlname": "input1",
"value": "Value of input1",
"type": "pxText"
}
}
Error if input control doesn't exist:
{
"currentpxform": "Px5 Form Name",
"currentpxtab": "Tab 1",
"method": "MessageErrorInPx5",
"payload": {
"origin": "{\"currentpxform\":\"Px5 Form Name\",\"currentpxtab\": \"Tab 1\", ...",
"errortype": "NotFound",
"errormsg": "Human readable error message from Px5"
}
}
Error if value change of an input control is not allowed (e.g. it is readonly or disabled):
{
"currentpxform": "Px5 Form Name",
"currentpxtab": "Tab 1",
"method": "MessageErrorInPx5",
"payload": {
"origin": "{\"currentpxform\":\"Px5 Form Name\",\"currentpxtab\": \"Tab 1\", ...",
"errortype": "NotAllowed",
"errormsg": "Human readable error message from Px5"
}
}
Triggered on method getControlsFromPx5
{
"connectorversion": "1.0.0",
"addin": { "name": "My Px5-AddIn", "version": "0.1", "developer": "My Company" },
"method": "GetControlsFromPx5",
"payload": null
}
{
"currentpxform": "Px5 Form Name",
"currentpxtab": "Tab 1",
"method": "GetControlsFromPx5",
"payload": [
{ "controlname": "input1", "value": "Value of input1", "type": "pxText" },
{ "controlname": "input2", "value": "Value of input2", "type": "pxText" },
{ "controlname": "input3", "value": 12.5, "type": "pxCurrency" },
{ "controlname": "input2", "value": false, "type": "pxCheck" }
]
}
Triggered on method getInfoFromPx5
{
"connectorversion": "1.0.0",
"addin": { "name": "My Px5-AddIn", "version": "0.1", "developer": "My Company" },
"method": "GetInfoFromPx5",
"payload": null
}
{
"currentpxform": "Px5 Form Name",
"currentpxtab": "Tab 1",
"method": "GetInfoFromPx5",
"payload": {
"pxversion": "PxVersion",
"dbname": "DBName",
"dbpath": "DBPath",
"dbuser": "DBUser",
"loginuser": "LoginUser",
"logingroup": "LoginGroup",
"readonly": false,
"connectionstring": "ConnectionString",
"skin": "Skin",
"restapiurl": "RESTAPIURL",
"webservicepassword": "WebservicePassword",
"logintoken": "LoginToken"
}
}
Triggered on method triggerActionInPx5
Click on a button on Px5 form:
{
"connectorversion": "1.0.0",
"addin": { "name": "My Px5-AddIn", "version": "0.1", "developer": "My Company" },
"method": "TriggerActionInPx5",
"payload": {
"action": "PerformButtonClick",
"controlname": "Px5Control"
}
}
Disable control on Px5 form:
{
"connectorversion": "1.0.0",
"addin": { "name": "My Px5-AddIn", "version": "0.1", "developer": "My Company" },
"method": "TriggerActionInPx5",
"payload": {
"action": "DisableControl",
"controlname": "Px5Control"
}
}
Enable control on Px5 form:
{
"connectorversion": "1.0.0",
"addin": { "name": "My Px5-AddIn", "version": "0.1", "developer": "My Company" },
"method": "TriggerActionInPx5",
"payload": {
"action": "EnableControl",
"controlname": "Px5Control"
}
}
None, except in case of an error
Button for clicking not found:
{
"currentpxform": "Px5 Form Name",
"currentpxtab": "Tab 1",
"method": "MessageErrorInPx5",
"payload": {
"origin": "{\"currentpxform\":\"Px5 Form Name\",\"currentpxtab\": \"Tab 1\", ...",
"errortype": "NotFound",
"errormsg": "Human readable error message from Px5"
}
}
Enabling or disabling of a control not allowed (e.g. by default disabled controls can not enabled):
{
"currentpxform": "Px5 Form Name",
"currentpxtab": "Tab 1",
"method": "MessageErrorInPx5",
"payload": {
"origin": "{\"currentpxform\":\"Px5 Form Name\",\"currentpxtab\": \"Tab 1\", ...",
"errortype": "NotAllowed",
"errormsg": "Human readable error message from Px5"
}
}
Triggered on leaving a control input on Px5 form
{
"currentpxform": "Px5 Form Name",
"currentpxtab": "Tab 1",
"method": "ValueChangedInPx5",
"payload": {
"controlname": "input1",
"value": "Value of input1",
"type": "pxText"
}
}
Triggered on switching tab on Px5 form
{
"currentpxform": "Px5 Form Name",
"currentpxtab": "Tab 1",
"method": "TabSwitchedInPx5",
"payload": null
}
Triggered if Px5 receive an invalid message from add-in
{
"currentpxform": "Px5 Form Name",
"currentpxtab": "Tab 1",
"method": "MessageErrorInPx5",
"payload": {
"origin": ">>> not supported message <<<",
"errortype": "InvalidMessage",
"errormsg": "Human readable error message from Px5"
}
}
Triggered if Px5 reports an unspecified error
{
"currentpxform": "Px5 Form Name",
"currentpxtab": "Tab 1",
"method": "MessageErrorInPx5",
"payload": {
"origin": "{\"currentpxform\":\"Px5 Form Name\",\"currentpxtab\": \"Tab 1\", ...",
"errortype": "General",
"errormsg": "Human readable error message from Px5"
}
}