Choosing a Headless CMS? Here is Your Ultimate Checklist for Free Get it now
Agility provides extensibility layers to allow developers to build custom integrations with any system.
Depending on the type of integration you want for your solution, it may be split into two parts.
Some integrations do not require a CMS integration or may not require any Website/App integration. It all depends on what you are trying to do.
The Content Manager provides several different integration points:
onLoad
, onBeforeSave
, onAfterSave
, onBeforePublish
,onAfterPublish
via JavaScript and provide custom validation. For example, validating content or inserting content in a third-party service.Agility is a headless CMS, so it does not enforce any rules or restrictions in how you build your website or app. The way your integration works in your solution is entirely up to you.
A module has been developed that displays a listing of featured items that is sourced from an external database. The editor would like to be able to control exactly which of those items are displayed on the website.
A solution to this, was to create a Custom Field Type via JS that renders a Searchlistbox (search based on input and select) that uses AJAX and CORS to return a list of results from that external database. Now editors, are actually selecting real records from their database, saving the ID of the record on save and then in the module code, a database query is executed to retrieve those details.
A list of "Products" is maintained with AgilityCMS. Each product has a SKU field. The SKU field is used later to map and synchronize data with Microsoft Dynamics. It is imperative that the editor sets a valid SKU when they save a product in Agility.
A solution to this was to validate the SKU on the onBeforeSave
event using the Custom Events JS API. A controller action result was setup on the website to accept a SKU parameter and query Dynamics to see if that SKU exists and is active. Then, in Agility CMS every time a Product is saved, the onBeforeSave
event is called which executes a JS function. Code was implemented in the function to call the Dynamics SKU validation controller action via AJAX and CORS and await a response. If the SKU was valid, the Save was allowed to continue. If it wasn't valid, the save would be cancelled and the user was prompted to enter a valid SKU.
Are you working on an integration and thinking about the best way to tackle it? We'd love to hear from you and offer some guidance. Please contact us and we'd be happy to help!