Skip to main content
A common issue inherited from Business NXT is that users forget to set the actualStartDate when they create a project, and when the project is concluded, they forget to set the actualEndDate. This trigger will automatically set the actualStartDate to the current date when the project is created and the actualEndDate to the current date when the project is concluded. In addition it will set the project department to the department of the user who created the project. TLDR Let’s create the trigger part by part.

Setup an ISV user

First we have to create an ISV user, so that we can use GraphQL to query the Business NXT API.
  1. Start by following Vismas guide on how to create an ISV user here. Make sure that the name of the user starts with nbt or nt in order to not acrue any extra costs for ignored events. The user name will be isv_nt_yourclientname.
  2. Add the ISV user to Business NXT by following the guide here.
  3. Take the credentials created for the ISV user and add them to the settings in NXT Triggers. It must be stored under VISMA_CLIENT_ID and VISMA_CLIENT_SECRET.

Starting with an empty trigger

Start by creating a new trigger in NXT Triggers and select the orgUnit2-table and ALL events. This will give you some sample code, but we’ll just remove all of that.

Getting the data we need

First we need to get the data we need to update the project. We need the orgUnit1, orgUnit2, orgUnitProcessing, actualEndDate, actualStartDate, changedDate, and the official-field from the project. To simplify creating the query, we can use the playground in Business NXT to create the query. The query will look like this:

The complete trigger