1.0.32 • Published 6 months ago

heflo-api v1.0.32

Weekly downloads
6
License
MIT
Repository
github
Last release
6 months ago

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.32

6 months ago

1.0.31

9 months ago

1.0.30

1 year ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.26

2 years ago

1.0.27

2 years ago

1.0.25

2 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.20

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.15

3 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

5 years ago

1.0.2

5 years ago

1.0.3

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago