10.1.3 • Published 6 months ago

heflo-api-test v10.1.3

Weekly downloads
2
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);
  }
});
10.1.1

6 months ago

10.1.2

6 months ago

10.1.3

6 months ago

9.10.1

9 months ago

6.1.5

4 years ago

6.1.4

4 years ago

6.1.2

4 years ago

6.1.1

4 years ago

6.1.3

4 years ago

1.0.26

5 years ago

1.0.25

5 years ago

1.0.24

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.19-c

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago