Workflow - Patch role membership criteria

Hello all,

I am trying to set up a workflow to duplicate a role in order to test the update of the membership criteria without impacting end-users.

Current setup :

  1. I have a workflow that retrieve the information on Role-A through the GET /roles/:id API.
  2. Create a new role Role-B
  3. Patch Role-B with the membership from Role-A

Issue :
In my workflow, at the step 3), I got the following parsing error : “Unable to parse input as JSON, please ensure it is syntactically correct. (type: Error Parsing Input, retryable: false): invalid character ‘c’ after object key:value pair”

The hTTPRequest.body.membership return by default the Golang object so I tried using the .JSON() to format it properly but to no avail.

Do you have any insight on how to correct this ?

Kind regards,

Can you try patching the /membership rather than /description? Membership should accept the json format, but description is expecting a string.

Hello Edward,

Indeed there was a typo in my screenshot due to some testing, but I did try with the correct path (/membership).

I tried through Postman and it is working fine, but the same API call through the workflow doesn’t due the parsing error.

Here is the membership that I am using :

"membership": {
        "type": "STANDARD",
        "criteria": {
            "operation": "AND",
            "key": null,
            "values": null,
            "stringValue": null,
            "children": [
                {
                    "operation": "OR",
                    "key": null,
                    "values": null,
                    "stringValue": null,
                    "children": [
                        {
                            "operation": "EQUALS",
                            "key": {
                                "type": "IDENTITY",
                                "property": "cloudLifecycleState",
                                "sourceId": null
                            },
                            "values": null,
                            "stringValue": "active",
                            "children": null
                        },
                        {
                            "operation": "EQUALS",
                            "key": {
                                "type": "IDENTITY",
                                "property": "cloudLifecycleState",
                                "sourceId": null
                            },
                            "values": null,
                            "stringValue": "suspended",
                            "children": null
                        },
                        {
                            "operation": "EQUALS",
                            "key": {
                                "type": "IDENTITY",
                                "property": "cloudLifecycleState",
                                "sourceId": null
                            },
                            "values": null,
                            "stringValue": "onboarding2",
                            "children": null
                        }
                    ]
                },
                {
                    "operation": "OR",
                    "key": null,
                    "values": null,
                    "stringValue": null,
                    "children": [
                        {
                            "operation": "EQUALS",
                            "key": {
                                "type": "IDENTITY",
                                "property": "serviceId",
                                "sourceId": null
                            },
                            "values": null,
                            "stringValue": "100",
                            "children": null
                        },
                        {
                            "operation": "EQUALS",
                            "key": {
                                "type": "IDENTITY",
                                "property": "serviceId",
                                "sourceId": null
                            },
                            "values": null,
                            "stringValue": "S",
                            "children": null
                        }
                    ]
                },
                {
                    "operation": "OR",
                    "key": null,
                    "values": null,
                    "stringValue": null,
                    "children": [
                        {
                            "operation": "CONTAINS",
                            "key": {
                                "type": "IDENTITY",
                                "property": "localReference",
                                "sourceId": null
                            },
                            "values": null,
                            "stringValue": "de_DE",
                            "children": null
                        },
                        {
                            "operation": "CONTAINS",
                            "key": {
                                "type": "IDENTITY",
                                "property": "company",
                                "sourceId": null
                            },
                            "values": null,
                            "stringValue": "Doctolib Germany",
                            "children": null
                        },
                        {
                            "operation": "CONTAINS",
                            "key": {
                                "type": "IDENTITY",
                                "property": "countryName",
                                "sourceId": null
                            },
                            "values": null,
                            "stringValue": "Germany",
                            "children": null
                        }
                    ]
                },
                {
                    "operation": "EQUALS",
                    "key": {
                        "type": "IDENTITY",
                        "property": "idisexclude",
                        "sourceId": null
                    },
                    "values": null,
                    "stringValue": "no",
                    "children": null
                },
                {
                    "operation": "EQUALS",
                    "key": {
                        "type": "IDENTITY",
                        "property": "isidexternal",
                        "sourceId": null
                    },
                    "values": null,
                    "stringValue": "no",
                    "children": null
                }
            ]
        },
        "identities": null
    }

Remove the double quotes around the membership variable.

[{"op":"replace","path":"/membership","value":{{$.hTTPRequest.body.membership.JSON()}}}]

That was causing it to parse the JSON as a string.

Incorrect format:

[{"op":"replace","path":"/membership","value":"{"criteria":{"children":[{"children":null,"key":{"property":"attribute.cloudLifecycleState","sourceId":null,"type":"IDENTITY"},"operation":"EQUALS","stringValue":"active","values":null}],"key":null,"operation":"OR","stringValue":null,"values":null},"identities":null,"type":"STANDARD"}"}]

Correct format:

[{"op":"replace","path":"/membership","value":{"criteria":{"children":[{"children":null,"key":{"property":"attribute.cloudLifecycleState","sourceId":null,"type":"IDENTITY"},"operation":"EQUALS","stringValue":"active","values":null}],"key":null,"operation":"OR","stringValue":null,"values":null},"identities":null,"type":"STANDARD"}}]

Attaching example:

CopyRoleMembership20250415.json (2.3 KB)

That was it, thanks a lot Edward !

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.