I have a power automate flow getting values from a SharePoint List. One of the column is a managed metadata column consisting of departments and sub departments. Department is the parent tag and subdepartment is the child department. E.g. Digital Technology and Innovation - Parent Tag - Main Department and has got IM Services - Child Tag - Subdepartment. End users can select both department and subdepartment in the column.
As soon as subdepartment is selected, only child tag appears on the list. (Even as a label on Power Automate).
The operation of power automate is to get input from this metadata column and put values on two text columns as output. e.g. if IM services is selected by the user column- 1 should display Main Department i.e. Digital Technology and Innovation and column- 2 should display IM Services
I know there can be multiple conditions can be put on power automate, say if IM serves is selected then department is equal to Digital Technology and Innovation (Hard coded on condition as a text).
Though is there any better/elegant way to code this?