I want my flow to update two text fields in my list to be empty if the user modifies a lookup field to make it empty.
In my first list (Address Change) list I have a lookup field (Approved School) that references a list of schools and their email addresses in a second list (School Email Address). When a user edits an item in Address Change and modifies the Approved School field value, a flow runs to update two other fields in Address Change:
- Populate ApprovedSchoolEmailH (text field) with the email address related to that school (from the School Email Address list)
- Populate ApprovedSchoolComp (text field) with the name of the school from the lookup field (Approved School) so I can use that as a reference for other calculated fields (I've also tried using the name of the school from the Address Change list, with no different results)
This works as expected if I change Approved School from NULL to having a value. It also works if I change it from one value to another different value. But it doesn't work when I remove the value from Approved School (choose "None" in the lookup). The flow runs, but it doesn't overwrite the existing values in ApprovedSchoolEmailH or ApprovedSchoolComp with NULL values.
I've even tried adding an entry in my School Email Address list with null values for both the SchoolName and School Email Address fields, hoping that I could still retrieve an empty SchoolName value and School Email value if High Schools is empty.
Here's the flow
First, when an item is modified in Address Change I retrieve that item:
Then I go to the School Email Address list to find the related email address:
Then, for each school email address (only one will be returned), I update ApprovedSchoolComp and ApprovedSchoolEmailH in my Address Change list to match the school that was chosen:
Here's the flow in action.
I select a new value for Approved School in Address Change:
The flow runs as expected, and updates the ApprovedSchoolComp and ApprovedSchoolEmailH fields accordingly in my Address Change list:
But if I change the value of Approved School to not have any school selected:
My ApprovedSchoolComp and ApprovedSchoolEmailH fields don't change:
The flow runs, seems to do the "Get Item" without any problems, but when it needs to run the Get Items to pull the email address related to the selected school (in this case, empty), it doesn't come back with anything. In the Get Items output, it shows the body value as a set of square brackets:
And though the Apply to Each action has a checkmark indicating that it ran without an issue, it didn't do the update item step:
How can I get the flow to insert NULL values into ApprovedSchoolEmailH and ApprovedSchoolComp when the user changes the value of Approved School to be empty?