December 16, 2021

[Issue Resolved]: "You must specify a value for this required field" error while updating a Multi Valued Managed Metadata column value in Power Automate

 

Introduction

Recently, we implemented an OOTB Document Approval process using Power Automate for a Postal and Parcel company based out of Melbourne, Victoria, Australia. The approval process was built using the "Start and wait for an Approval" action of Power Automate and based on the approver's response the Power Automate was updating the status and other metadata fields of the Document in the SharePoint Library.  So, here we encountered an issue while updating a multi-valued managed metadata column to the SharePoint Library and we resolved it by providing a valid expression value which we will explain in further process.


In this blog, we will learn about the "You must specify a value for a required field" issue and its solution that will help us to store its value in the document library.  

Issue

      • In Power Automate, we used an update item SharePoint action for a multi-valued managed metadata column. 
      • When we use the value of the trigger field it was not binding the value accordingly and the Update item action returns the error You must specify a value for this required field” message with 400 status code as shown below. 

      • We tried with the trigger values of the Category managed property but it was giving as invalid as shown below. 



      • We tried with other metadata properties also like the Category value but it was creating an Apply to each loop because it is a multi-value field and this loop updates the item multiple times with different category field values which was not the correct behavior. 

      Solution

        • When we use update item action, we have to provide all the required field values. 
        • If we do not provide a proper value, then update item action would return this type of error. 
        • As this column was a multi-valued managed metadata column, we have to create an array variable and store all the values in the array with a specific format for storing the value in a correct format to the library. 
        • First, we will create an array variable as shown below. 

        • Now we will store all the managed metadata values in the array inside the Append to array variable action. For that we will pass the expression value in format {item('Apply_to_each_3')?['Value']} as shown below. 











        • We will use the array in the Update item action as shown below.


        Hence, a multi-valued managed metadata column Category values will be stored in the library with the proper format.

        Conclusion

        This is how we can resolve the error with managed metadata multi-valued field in Power Automate. Hope this helps, good day! 

        If you have any questions you can reach out our SharePoint Consulting team here.

        No comments:

        Post a Comment