Automating the boring stuff
Using the Mendix Platform and Model SDK to automate repetitive tasks. Presented by Alistair Crawford and Iain Lindsay at the Mendix Maker Meetup in London on 17th October 2019
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
Mendix Maker Meetup - London (2019-10-17)
1. Mendix Platform and Model SDK
Iain Lindsay (AuraQ) | Alistair Crawford (Mendix)
17 OCTOBER 2019
Automating the boring stuff
2. Optimising Business Performance
Introductions
SDK Overview
Core use cases
Getting Started
Samples / examples
o Analysing naming standards
o Changing colour of microflow activities
o Creating validation microflows
o Generating model documentation
| Agenda
3. Optimising Business Performance
| Introductions
Alistair
o https://github.com/mxcrawford
Iain
o https://github.com/lindski
LinkedIn
4. Optimising Business Performance
| SDK Overview
Two SDKs – Platform and Model
Platform provides access to model server
o Creating an app
o Creating a branch
o Opening a revision
Model provides access to the application model
o Retrieve information about all application objects
o Manipulate existing objects
o Create new objects
Typescript based SDKs
o Strongly typed javascript
5. Optimising Business Performance
| Core use cases
Migrate Analyse
Export Modify
Analyse your Mendix
applications. Identify
duplication, complexity, non
conformance to dev
standards.
Update your Mendix
applications. Automate
repetitive and/or time
consuming tasks
Export your Mendix
applications to code,
documentation or test
cases.
Convert legacy
applications into
Mendix applications.
7. Optimising Business Performance
| Basic Knowledge
TypeScript
when.js and Promises
o https://docs.mendix.com/apidocs-mxsdk/mxsdk/working-with-when.js-and-promises-in-typescript
Mendix documentation
o https://docs.mendix.com/apidocs-mxsdk/mxsdk/
o https://apidocs.mendix.com/modelsdk/latest/index.html
8. Optimising Business Performance
| Dev environment
Dependencies
Node + NPM
https://nodejs.org/en/download/
Typescript
npm install –g typescript
Initialising a new project
mkdir my-project
cd my-project
npm init --yes
npm install mendixmodelsdk
mendixplatformsdk when @types/when –save
tsc --init
12. Optimising Business Performance
|Understanding the metamodel
Reverse engineer an application
Recognisable objects are easier to understand
https://github.com/lindski/mx-sdk-modelexport
o Export objects as code functions.
o Builds on https://docs.mendix.com/apidocs-mxsdk/mxsdk/generating-code-from-the-model
14. Optimising Business Performance
| Analysing naming standards
Enforcing Best Practises
o Check your model against your team’s standards
Demo: Report on all Microflows that don’t
have an appropriate Prefix
https://github.com/mxcrawford/sdk-examples
17. Optimising Business Performance
| Changing colour of microflow activities
Make your model easy to identify
Demo: Make sure all Microflows are set to their correct colour based on the nature
of their action
Create Object Change Object Delete Object
https://github.com/mxcrawford/sdk-examples
20. Optimising Business Performance
| Creating validation microflows
Typical pattern for committing objects
o Main commit microflow
o Sub validation microflow
Auto creates validation microflows with basic rules
o Treats every supported attribute as required.
Stores microflows in separate folder
https://github.com/lindski/mx-sdk-validationcreator
21. Optimising Business Performance
| Generating model documentation
Generate documentation for your
application artefacts
Extend with custom documentation
o Enrich with Markdown
Generates documentation using
Docsify
o https://docsify.js.org/#/
Add your own documentation tool
o E.g. Confluence
https://github.com/AuraQ/MendixDocumenter
22. Optimising Business Performance
| Draw inspiration
Some of many existing examples to be found
o https://forum.mendixcloud.com/link/questions/12432
More ideas
o Enforcing Best practises and standards
e.g. check and alert for any commits in a loop
o Migrating over to Mendix
e.g. convert HTML page to Mendix page
o Accessibility
Make sure all pages have h1 widget
Make sure all Delete, New and Save buttons are correct “colour”
o Pure fun
e.g. Microflow Art by converting image to Microflow