14 July 2023

Example – Delete an admissions course

The following procedure describes how to build an automated flow in Power Automate to delete a course in Reference data if the course is not approved.

Use Power Automate to delete courses that have a status of rejected to keep reference data up to date.

How it works

The image Example flow shows a flow that runs when an admissions course approval status is updated to Rejected. The key to the image is as follows:

  1. Flow is triggered when an admissions course approval status is updated to Rejected.

  2. Details of the course are retrieved.

  3. Approval status of the course is checked and then actions taken to delete the course and post a notification to Microsoft Teams.

Example flow

Delete admissions programme flow

Build the flow

Build the flow as follows:

  1. Create the new flow on Power Automate. On Power Automate, in Flows, select Cloud flows and then New flow and then Automated cloud flow.

  2. On the flow designer, add a trigger to start the flow. Go to search search connectors and triggers and add Tribal - When an entity is created. Define the service and entity as follows:

    • Service is the service that the course is being updated. For example, Admissions.

    • Entity is the type of data being created. For example, Reference data.

  3. Add a filter to only trigger the flow when a new course is updated. Select Show advanced options and then define the following filters:

    • Filters entity -1 to filter the entities by Attribute type equals.

    • Filters value -1 to define the entity created that triggers the flow. For example, admissionscourse.

    The image Flow trigger shows the step for triggering the flow when a course is updated in Reference data.

    Flow trigger
    Trigger for programme flow

  4. Add the action that retrieves the course details from Admissions. On the flow builder, select + New step and then search for the Tribal - Read an entity action. Select the service and entity as follows:

    • Service is the service that the course is being updated. For example, Admissions.
    • Entity is the type of data being retrieved. For example, Admissions course.

    • ID is the GUID for the admissions programme, that is valueIdentifier.

    The image Retrieve course details shows the step for retrieving the details of the admissions programme that has been updated.

    Retrieve course details
    Read an entity step for the entity admissions programme

  5. Add a new step to check the approval status of the course. On the flow builder, select + New step and then select the Condition - Control action. On the condition define the value: approvalStatusCode is equal to R for rejected.

    The image Course approval status shows the approval status step in the flow.

    Course approved or rejected
    Programme rejected

  6. Define the actions for the Yes branch of the Condition - Control. Note that there are no actions to define for the No branch of the Condition -Control.

    Add an action to delete the entity and define the following values:

    • Service is the service that the course is being created. For example, Admissions.

    • Entity is the type of data being deleted. For example, Admissions course.

    • ID is the unique identifier of the admissions course, such as valueIdentifer.

    • Correlation ID is the eventCorrelationId that Admissions can correlate the actions performed as a consequence of the initial event that triggers the flow.

    Then, add an action to post a notification card to a Teams channel stating that the programme has been approved. On the flow builder, select + New action and then search for the Post a card in a chat or channel action.

    For example, the image Yes branch shows the action to delete the entity and post a notification to a Teams channel.

    Yes branch
    Programme delete and teams message

  7. Test the flow. You can test the flow manually by setting the approval status of an admissions programme or automatically when another member of staff sets the approval status of an admissions programme. Note that any errors with the flow are shown in Power Automate along with troubleshooting guidance.