Power Automate Flow Error: The ‘inputs.parameters’ of workflow operation of type ‘OpenApiConnection’ is not valid. The API operation does not allow writing a value for parameter ‘item/YOUR_COLUMN_NAME[0]/Id’. This parameter is read only.

Error

The ‘inputs.parameters’ of workflow operation of type ‘OpenApiConnection’ is not valid. Error details: The API operation does not allow writing a value for parameter ‘item/YOUR_COLUMN_NAME[0]/Id’. This parameter is read only.

Motivo

Este error aparece cuando al intentar hacer un update con valores dinámicos, uno de los campos es multiselect. Si tratamos de incluir el mismo valor que hemos recibido de una query nos dará error porque contiene los ID de cada opción seleccionada, y debemos hacer el update solo con los Values. En una query en SharePoint, en una columna multiselect recibimos:

[
  {
    "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
    "Id": 0,
    "Value": "VALUE 1"
  },
  {
    "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
    "Id": 1,
    "Value": "VALUE 2"
  }
]

Y lo que la acción de UPDATE espera es esto:

[
  {
    "Value": "VALUE 1"
  },
  {
    "Value": "VALUE 2"
  }
]

Solución

Bastara con procesar el array que tenemos para que tenga el formato especificado en el bloque de código anterior. Por ejemplo podemos:

  1. Crear una variable de tipo Array.
  2. Utilizar el loop “Apply for each” para iterar sobre el campo multiselect recibido.
  3. Dentro del bucle, hacer un “Parse JSON” del objeto para obtener los valores.
  4. Hacer un “Append” al array creado en el punto 1 añadiendo el nuevo objeto solo con el campo “Value”.
  5. Añadir esta variable en el campo multiselect cuando hagamos el Update.

El Schema de cada objeto de la columna multivalue es:

{
    "type": "object",
    "properties": {
        "@@odata.type": {
            "type": "string"
        },
        "Id": {
            "type": "integer"
        },
        "Value": {
            "type": "string"
        }
    }
}

6 Responses

  1. Ingo D. says:

    Thanks a lot for this! It drove me nuts and I couldn’t find helpful advice on this anywhere else.

  2. Valery Moskalenko says:

    Thank you! You save my day!

    BTW, a built-in operator ‘Select’ is the best approach instead of loops.

  3. Juan says:

    Thanks this gave the the right direction.

    In my case, because I was updating a lookup value, instead of the “Value”, needed to pick the “Id”

    So in the step “Add value to array” the value was:

    { “Id”: “[…..Id…..]”}

  4. Thank you for this ! When using a multi-Choice Managed Metadata filed, it is the same approach but different parse JSON template, and we append the LABEL field rather than value.

Leave a Reply to Ingo D. Cancel reply

Your email address will not be published. Required fields are marked *