Getting Started
Pepperi JS Client Side API {Beta} enables you to extend our Native and Web Apps. The run-time of the API is either from our Rule-Engine-based User Define Fields or from our Workflow's Custom Web Forms
Please note : Pepperi JS Client API is in Beta. Changes to the API may apply without any notification.

Namespace: pepperi.api

pepperi.api VS pepperi.app
    The pepperi.api namespace functions do not trigger any auto-calculation of the app's business logic (rule engine) for that purpose the namespace "app" should be used instead.
    Both "api" and "app" can be used inside a web custom form (visible or hidden) as a step in a workflow
    Only "api" functions can be called from the rule engine = calculated user defined fields
the only functions supported in the "app" namespace are:
    1.
    pepperi.app.accounts.update
    2.
    pepperi.app.activities.update
    3.
    pepperi.app.transactions.update
    4.
    pepperi.app.transactionLines.update
    5.
    pepperi.app.transactionScopeItems.update
    6.
    pepperi.app.transactions.addLines
    7.
    pepperi.app.transactions.removeLines

Async: Custom Web Forms VS calculated UDF (rule engine)

In web custom forms only - the Client API work Async - for all functions , so that 2 parameters are always added: responseCallback and requestID - requestID is optional - recommended to identify the request upon getting the Async response.
For example:
1
pepperi.api.activities.get({ key: {UUID: "aefb523e-74ac-4041-8bb1-a76a3b5e78d8"} ,
2
fields: [ "ExternalID" , "MyTSA"],
3
responseCallback: "<your_callback_function>" ,requestID: "<your_request_id>"} )
Copied!

Date and Time: UTC only

Date format in the API : Dates are retrieved and should be updated in UTC only, in the ISO 8601 format: 2018-12-18T12:29:02Z or 2018-12-18Z
Rule Engine Date format: dates are retrieved in the Rule Engine GetValueByAPIName function in the unix timestamp format - seconds since Jan 01 1970. (UTC) see here : https://www.unixtimestamp.com/ and therefor will need to be converted in order to change the field value and update it back through the API . code sample for the Rule Engine calculated fields :
1
var date = new Date(TSACaptureDateTime*1000); //first convert to seconds
2
var ret_object=pepperi.api.accounts.update({
3
objects: [{
4
UUID: GetValueByApiName("Account.UUID") ,
5
TSALastActiveDate:date.toISOString() // then update to UTC ISO format
6
}]
7
});
8
}
Copied!
Filters : Dates can be provided to the filter object in a non-UTC format, and the function will convert it internally to UTC.

Logs : send logs to our servers to track issues

On iOS and Android - the logs will be sent in case the app crashes - and on the web app logs are sent to our servers constantly in real-time
1
pepperi.log({ message: "<your message>", verbosity:"Low" });
Copied!
Verbosity' is optional. (Low, Medium , High ) default is 'Low'

Error Handling

On Error - all functions returns the same error object:
1
{ success:false, value:"", error:{ code:54, message :"<relevant error messagge>" } }
Copied!

Context : Run-time scope of data retrieval and data update

this function is more important for the web custom forms - since the code in the custom form is always a part of a workflow and therefore its important to be able to get it's run-time scope
1
pepperi.app.getContext({responseCallback: "mycallback"});
Copied!
This function also works in calculated fields.
1
var ret=pepperi.app.getContext({});
Copied!
Returns an object to the call back function:
1
{
2
"CPIDateTime": "2018-12-23T12:34:56Z",
3
"appVersion": "",
4
"appType": "web",
5
"OSType": "",
6
"OSVersion": "",
7
"company": {
8
"id": 30011895,
9
"name": "Regine_DO_NOT_CHANGE_ClientAPI"
10
},
11
"user": {
12
"id": 4492855,
13
"uuid": "d8ce933a-a0dd-4a9f-9b88-c83581180dc5",
14
"externalId": ""
15
},
16
"account": {
17
"id": 18163276,
18
"name": "Cat n Dog New",
19
"uuid": "67274419-7f66-46f6-847a-72aa19d3db8a"
20
},
21
"transaction": {
22
"id": -50,
23
"externalId": "",
24
"uuid": "131023c8-bbfd-4a15-ba4b-030fe7bdb44c"
25
}
26
}
Copied!

Filter object for the "search" functions

A "search" function is used all over the Client API to search for multiple objects.
Below is the most simple example for filter:
1
{ ApiName: "UnitPrice",
2
Operation : ">=",
3
Values : ["7"]}
Copied!
A filter can contain unlimited number of condition nodes, for example:
1
{ Operation : "AND",
2
LeftNode: {ApiName: "UnitPrice", Operation : ">",
3
Values : ["7"]},
4
RightNode:{ApiName: "Transaction.ActionDateTime",
5
Operation: "InTheLast", Values: ["4","Weeks"]}
6
}
Copied!
Operators supported grouped by Data Type :
1
{
2
"String": [
3
"Contains",
4
"StartWith",
5
"EndWith",
6
"IsEqual",
7
"IsNotEqual",
8
"IsEmpty",
9
"IsNotEmpty"
10
],
11
"Integer": [
12
">",
13
"<",
14
"=",
15
">=",
16
"<=",
17
"!=",
18
"Between",
19
"IsEmpty",
20
"IsNotEmpty"
21
],
22
"Real": [
23
">",
24
"<",
25
"=",
26
">=",
27
"<=",
28
"!=",
29
"Between",
30
"IsEmpty",
31
"IsNotEmpty"
32
],
33
"Boolean": [
34
"IsEqual"
35
],
36
"DateTime": [
37
"Today",
38
"ThisWeek",
39
"ThisMonth",
40
"Before",
41
"After",
42
"Between",
43
"On",
44
"InTheLast",
45
"NotInTheLast",
46
"DueIn",
47
"NotDueIn",
48
"IsEmpty",
49
"IsNotEmpty"
50
],
51
"File": [
52
"IsEmpty",
53
"IsNotEmpty"
54
],
55
"MultiDropDown": [
56
"IsEqual",
57
"IsNotEqual",
58
"IsEmpty",
59
"IsNotEmpty"
60
],
61
"PropertyMultiDropDown": [
62
"IsEqual",
63
"IsNotEqual",
64
"IsEmpty",
65
"IsNotEmpty"
66
],
67
"UsersSpecialMultiDropDown": [
68
"IsLoggedInUser",
69
"IsEqual",
70
"IsNotEqual",
71
"IsEmpty",
72
"IsNotEmpty"
73
]
74
}
Copied!
Last modified 9mo ago