Repository navigation
Automation
In this solution, I have used multiple flows and I've set up a rather solid foundation for error handling and reporting. All flows have Try-Catch error handling and all of them call a catch flow which will gather information about the flow run and send a report of the error with flow name, error message and link to the flow run to a list of users set up in an environment variable.
This flow triggers on creation or update of Non-Conformity. It initializes variables, sets the title and body of the notification based on whether the record was update or created and sends the notification to the owner of the record with a link to the record.
This implementation counts with the owner of the non-conformity being a user but I am able to handle this functionality for teams of users also. However, it is a bit more complicated and time-consuming, so I have decided to reduce the complexity by counting with users only.
This flow triggers when an action is performed. In general I am not a fan of using a http trigger on flows because the call is not secured. Anyone knowing the URL can trigger the flow how many times they want so it is a security risk regarding DDOS attacks. If we trigger the flow on action (which is empty in this case) trigger, we can easily retrieve input parameters and have a secured way of direct triggering.
This flow retrieves data about all non-conformities concerning a building and fills in a Word template with them. Then converts this template into a PDF and sends the result PDF in an email to the user's personal email address. It could theoretically be downloaded directly into the user's system but the email seems just a bit more convenient.
Because of the limitation of my trial account (not having an Office 365 connection), I had to supplement one drive and outlook connections with my current work email.
Just a simple flow to showcase my ability to work with custom connectors. It only uses the mock endpoint.
The plugin assembly is set up using an EntityBase class and early bound definitions which are accessible in a shared project. All plugins are of course annotated by tracing.
This plugin runs on the PreOperation stage and directly edits the update object. It is filtered on the depth of 1 and runs only on create message and PreOperation stage.
This plugin retrieves an environment variable, increments it and saves the value back into the environment variable. It uses this value as an auto number for Non-Conformity.
The purpose of this action is to take input of ID of Non-Conformity and copy it and all its related entities only with an addition of copy in the name. Unfortunately due to it being more complicated then I've expected and due to time contraint I wasn't able to get this action running correctly.
I am not using any business rules in this solution. Business rules are useful for some simple FE manipulation and are useful because they run even outside of the bounds of forms but I generally don't like mixing them with client-side scripts. If an entity requires more then simple logic, it is recommended to remove all BRs and rewrite them into scripts.
All scripts are written in JavaScript. I am using generalisation and parameters where possible. The webresources are divided into folders and managed using Webresource Manager from XRMToolBox.
This library contains 2 simple functions to demonstrate my capability as a client-side scripts developer. ###editableOnCreate Takes executionContext and an array of fields that should be made editable if the form is a create form. From my experience very useful for fields that should keep constant value after creation. This script is triggered onLoad of building form on the field Completion of Construction and makes the field editable on create.
These two functions take executionContext and logical names of a start field and an end field. They binds these two fields together and throw inline validations and change values if they are invalid as start and end fields.
Just a simple function that shows a field based on optionset value.
Function that is used in the Copy ribbon button on Non-Conformity form. This script retrieves the entity ID from the primaryControl and calls a bound action.
Function that is used in the Generate Report ribbon button on Building form. This script retrieves the entity ID from the primaryControl and calls a bound action.
Very simple custom connectors using mock endpoint. I didn't have time nor need to create an Azure Function or Custom API to go with the connector. I am not very experienced in this but simple functions and connector wouldn't be a problem.