Power Automate does not offer out of the box actions to manage the Term store, by adding, updating or removing terms.
With experience in doing this task with PowerShell, I did some research and below is one of the solutions that I tested, and it works very well.
For this scenario, the requirements are:
The entire flow appears like this:
1. The trigger: WhenItemCreated-SharePointTermStore
2. Flow values: few compose actions to get the values used further in the flow.
Compose-ParentTermSetID
@{triggerOutputs()?['body/ParentSetName_x003a__x0020_TermS/Value']
Compose-TermName
@{triggerOutputs()?['body/Title']}
Compose-TermsetGUID
@{triggerOutputs()?['body/TermSet/TermGuid']}
Compose-TermSetLabel
@{triggerOutputs()?['body/TermSet/Label']}
3. Send an HTTP request to create the term using the REST API, POST method.
This command in the body, will create the item and also the synonym and the description.
(The synonym is not mandatory, but wanted to present the possibility to add synonyms.)
The details:
Method: POST
Uri: _api/v2.1/termStore/sets/@{outputs('Compose-ParentTermSetID')}/terms/@{outputs('Compose-TermsetGUID')}/children
Body:
{
"labels": [
{
"name": "@{triggerOutputs()?['body/Title']}",
"isDefault": true,
"languageTag": "@{triggerOutputs()?['body/Language']}"
},
{
"name": "@{triggerOutputs()?['body/Synonyms']}",
"isDefault": false,
"languageTag": "@{triggerOutputs()?['body/Language']}"
}
],
"descriptions": [
{
"description": "@{triggerOutputs()?['body/TermDescription']}",
"languageTag": "@{triggerOutputs()?['body/Language']}"
}
]
}
4. UpdateItem-Success
In case of success, in my scenario, I am updating the term in the list with the status of success.
5. UpdateItem-Error
In case of error, I am updating the list with the status of error.
For error, the parallel branch will start only if is not a success the previous action.
The Master list is like this:
The Termset column is Managed metadata column, where the user can select the terms where the new values will be added.
ParentSetName is a Lookup column in the TermSets list.
The term will appear in the term store:
Depending on the results, the items in the list will appear like this:
Thanks for reading this article!
EU Wasea 2022.
Hint:
You can remove this information by activating Premium Plan