14 July 2023

Example – Delete an admissions programme

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

Use Power Automate to delete programmes 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 programme approval status is updated to Rejected. The key to the image is as follows:

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

  2. Details of the programme are retrieved.

  3. Approval status of the programme is checked and then actions taken to delete the programme 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 programme 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 programme 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, admissionsprogramme.

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

    Flow trigger
    Trigger for programme flow

  4. Add the action that retrieves the programme 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 programme is being updated. For example, Admissions.
    • Entity is the type of data being retrieved. For example, Admissions programme.

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

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

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

  5. Add a new step to check the approval status of the programme. 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 Programme approval status shows the approval status step in the flow.

    Programme 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 programme is being created. For example, Admissions.

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

    • ID is the unique identifier of the admissions programme, 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.