Using Rollbase‘s triggers are a great way to interact with third party environments. However sometimes you may need to write a fair bit of code inside the trigger code editor to achieve this – what if you could reduce the amount of in-browser code needed?
In this series of articles, I am going to go through the process of building a Node.js platform to assist with interactions with a 3rd party system, in this case a CMIS compliant Document Management System (DMS) such as Alfresco.We will set up our Node.js environment, grab the already existing libraries that can assist, such as cmis.js and express.js, and then create an external REST API library for Rollbase to access, to reduce the amount of code you have to put into a trigger’s code editor.
We will build 6 triggers throughout the exercise:
- Create a folder in the DMS in a whenever you create an appropriate record in RB and store the ID of that folder in the Rollbase record.
- Create a document object in the DMS in a whenever you upload a document into an appropriate record in Rollbase and store the ID of that folder in the Rollbase record.
- Update folder details, such as the folder name, whenever the associated record name is changed in Rollbase.
- Update document details, including content, whenever a new version of a document is uploaded to an appropriate record in Rollbase.
- Delete a document when the related record is deleted from Rollbase
- Delete a folder when the relate record is deleted from Rollbase
Note that at the start I may not be doing much in the way of error checking, etc – I will be building a straight line path to begin with that will give us what we want – so I won’t yet be dealing with issues such as a folder of the same name already existing in the DMS. I will cover some of these in a final article around troubleshooting – and our REST API will be built in a way to easily allow for error checking to be including later.
Strap yourselves in. The next article in this series will be on the basic installation of Node.js and our required existing projects…