1.0.30 • Published 2 months ago
heflo-api v1.0.30
HEFLO API
API (Application Programming Interface) to handle customizations on HEFLO BPM using NodeJS and Typescript.
Installing
Using npm:
$ npm install heflo-api
Example
Performing an action on a task transition
app.post('/OnExecute', async (request, response) => {
try {
// Access all data of the process instance
let context = new Events.WorkItem.OnExecuteSequenceFlow(request);
// Your code here
// Finally, return unsaved data.
response.json(context.GetModifiedData());
} catch (err) {
response.status(500);
response.send("Error executing the request, details: " + err);
}
});
Changing the value of a field of a form
app.post('/onChanged', async (request, response) => {
try {
// Access all data of the process instance
let context = new Events.WorkItem.OnChanged(request);
// change another field
context.WorkItem.Set("OtherField", "Field changed");
// Finally, return unsaved data.
response.json(context.GetModifiedData());
} catch (err) {
response.status(500);
response.send("Error executing the request, details: " + err);
}
});
Performing the calculation of who will perform a task
app.post('/OnResourceCalculation', async (request, response) => {
try {
// Access all data of the process instance
let context = new Events.WorkItem.OnResourceCalculation(request);
// Your code here.
// Finally, return list of emails
response.json( [ "email1@mycompany.com", "email2@mycompany.com", ["name-of-department-or-group"] ] );
} catch (err) {
response.status(500);
response.send("Error executing the request, details: " + err);
}
});
Creating a new record of type Person
app.post('/OnExecute', async (request, response) => {
try {
// Access all data of the process instance
let context = new Events.WorkItem.OnExecuteSequenceFlow(request);
let person = await Person.NewAsync(context);
person.Name = context.WorkItem.Get("name_person");
person.Email = context.WorkItem.Get("email_person");
// save the record using async
await person.SaveAsync(context);
// No need to return modified data
response.json("{}");
} catch (err) {
response.status(500);
response.send("Error executing the request, details: " + err);
}
});
1.0.30
2 months ago
1.0.29
5 months ago
1.0.28
5 months ago
1.0.26
5 months ago
1.0.27
5 months ago
1.0.25
7 months ago
1.0.24
2 years ago
1.0.23
2 years ago
1.0.22
2 years ago
1.0.21
2 years ago
1.0.19
2 years ago
1.0.18
2 years ago
1.0.20
2 years ago
1.0.17
2 years ago
1.0.16
2 years ago
1.0.11
2 years ago
1.0.10
2 years ago
1.0.15
2 years ago
1.0.14
2 years ago
1.0.13
2 years ago
1.0.12
2 years ago
1.0.9
2 years ago
1.0.8
3 years ago
1.0.7
3 years ago
1.0.6
3 years ago
1.0.5
3 years ago
1.0.4
4 years ago
1.0.2
4 years ago
1.0.3
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago