Introduction
When a user completes a Web Form or chooses a Migration Slot on the self-scheduling web page it is often useful to automatically make some changes such as moving that user into a process or sub-process. This article shows how that can be achieved with ESM Plans.
The advantage of this approach is that more Plan Actions can be easily added to the ESM plan as the automation requirements become more advanced.
Use Cases
Use Case 1: Run automation for all form submissions
E.g. Migration Engineer clicks the Migrate button in a Portal Form to migrate a user -> Move the user to 5. Complete
Use Case 2: Conditional automation based on Pass/Fail
E.g. User passes/fails a Survey -> Move the user to 3. Validating\Survey Passed or 3. Validating\Survey Failed
Use Case 3: Conditional automation based on form field
E.g. User fills in a web form -> Depending on their response add them to a specific Azure Group
Use Case 4: Automation triggered when a self-scheduling slot is chosen
E.g. A user chooses a migration slot -> Move the user to 3. Scheduling\Scheduled
Use Case 1: Run automation for all form submissions
When a form has a single Save or Submit button (with no option for the form to be failed) an ESM Plan is called. E.g. Migration Engineer clicks the Migrate button in a Portal Form to migrate a user -> Move the user to a specific process and send them an email.
Method:
- Create an ESM Plan in the relevant module (e.g. Administration -> User Migrations -> ESM Plans)
- In this example the plan will be named SurveyAutomation
- Service Plan Rules (Evaluator) are not required as this Plan will run whenever the form is submitted
- Add as many Service Plan Actions as required, for example to move the User Migration to a specific process
- Navigate to Administration -> Portal Settings -> Portal Forms -> Select the Form
- Add the following line to the PS/CSS/JS tab, amending the name of the plan if required
Invoke-MSESMPlan -Module UserMigrations -Ids $ScriptArgs.Items -PlanName 'SurveyAutomation' -ResetPriorToRun
- When the Form is submitted, the ESM plan will be called and run for just that User Migration
Use Case 2: Conditional automation based on Pass/Fail
When a form has both Pass and Fail buttons, call different pass/fail ESM Plans. E.g. User passes/fails survey -> Move them to 3. Validating\Survey Passed or 3. Validating\Survey Failed.
Method:
- Create two ESM Plans in the relevant module (e.g. Administration -> User Migrations -> ESM Plans)
- In this example the plans will be named FormPass and FormFail
- Service Plan Rules (Evaluator) are not required as there are two separate plans for each outcome
- In each ESM plan add the required Service Plan Actions, for example to move the User Migration record to a process for each outcome (the example here shows an Action which could be used when the Form is passed)
- Navigate to Administration -> Portal Settings -> Portal Forms -> Select the Form
- Add the following to the PS/CSS/JS tab
If($ScriptArgs.EventArg1 -eq 'Passed') { Invoke-MSESMPlan -Module UserMigrations -Ids $ScriptArgs.Items -PlanName 'FormPass' -ResetPriorToRun } If($ScriptArgs.EventArg1 -eq 'Failed') { Invoke-MSESMPlan -Module UserMigrations -Ids $ScriptArgs.Items -PlanName 'FormFail' -ResetPriorToRun }
- When the Form is Passed/Failed, the corresponding ESM plan will be called and run for just that User Migration
Use Case 3: Conditional automation based on form field
When a Form has a single Save or Submit button, but different automation is required depending on the response within the Form. E.g. An engineer uses a Portal Form to trigger the migration of a user. The Form contains a radio button to state whether the user was showed up for the appointment or not. When the engineer clicks the Submit button the ESM plan should add them to a specific Azure Group if they were present. If they were not, they should be moved into a sub-process called "User No Show".
In this example the User Migration Discovery tab has a Custom Field called User Status which is filled in as part of the web form. The FieldID is 2677.
Method:
- Create two ESM Plans in the relevant module (e.g. Administration -> User Migrations -> ESM Plans)
- In this example the ESM plans will be named UserPresent and UserNoShow
- Service Plan Rules (Evaluator) are required to ensure that only the relevant plan is run
Rule for FormChoice1 plan: - In each ESM plan add the required Service Plan Actions
- Navigate to Administration -> Portal Settings -> Portal Forms -> Select the Form
- Add the following to the PS/CSS/JS tab
Invoke-MSESMPlan -Module UserMigrations -Ids $ScriptArgs.Items -PlanName 'UserPresent' -ResetPriorToRun Invoke-MSESMPlan -Module UserMigrations -Ids $ScriptArgs.Items -PlanName 'UserNoShow' -ResetPriorToRun
The Service Plan Rules ensure that only the relevant ESM plan will run for the user
Use Case 4: Automation triggered when a self-scheduling slot is booked
When a users chooses a migration slot in the Self-Scheduling web page, run an ESM plan to provide automation. E.g. User chooses slot -> Move the user to a specific process
Method:
- Create an ESM Plan in the relevant module (e.g. Administration -> User Migrations -> ESM Plans)
- In this example the plan will be named SlotBookedAutomation
- Service Plan Rules (Evaluator) are not required as this Plan will run whenever the form is submitted
- Add as many Service Plan Actions as required, for example to move the User Migration to a specific process
- Navigate to Administration -> Portal Settings -> Portal Forms -> Select the Form
- Add the following line to the PS/CSS/JS tab, amending the name of the plan if required
Invoke-MSESMPlan -Module UserMigrations -Ids $ScriptArgs.Items -PlanName 'SlotBookedAutomation' -ResetPriorToRun
- When the slot is booked, the ESM plan will be called and run for just that User Migration