Google provisioning policy - Transform building JSON

Hi,

I am trying to create a Create Provisioning Policy for Google Workspace.
I am preparing a Transform that will create Complex Provisioning Policy Attributes. These attributes must be in JSON format eg…:
{“name”: “Sailpoint”, “title”: “SysAdmin”, “type”: “work”, “customType”:“”, “department”: “DP Operations”, “location”: “Pune”}.
https://documentation.sailpoint.com/connectors/g_suite/help/integrating_g_suite/complex_provisioning_pol.html

And question:
How to build something like this in Transform?
How to escape JSON elements like: {, ", :

JSON can be stored as a string by using escape characters wherever required
this json
{"address":"[email protected]","type":"other"}
will look like
"{\"address\":\"[email protected]\",\"type\":\"other\"}"
when stored as a string

2 Likes

Is there any good converter online for this? Always doing it manually right now…

2 Likes

Thank you, this looks obvious. Now :slight_smile:

Hi @iamology,
Unfortunately it doesn’t work, maybe there is something wrong in another part of transform

{
“name”: “relations”,
“transform”: {
“type”: “static”,
“attributes”: {
“managersMail”: {
“type”: “firstValid”,
“attributes”: {
“values”: [
“$identity.getManager().getStringAttribute(‘email’)”,
“no manager exists”
]
}
},
“value”: “{"value": "$managersMail","type": "manager"}”
}
},
“attributes”: {
“cloudDelimiter”: “,”,
“cloudRequired”: “true”
},
“isRequired”: false,
“type”: “string”,
“isMultiValued”: true
},
Error message:
400 Error - Invalid JSON payload received. Unexpected token. lations": [[{value: tomasz.iksinski@ ^

Hello Piotr Pacholski,

First of all, welcome to the SailPoint Developer Community.
Can you please share the whole transform?

1 Like

When I copied the contents from your post in Notepad++ this is what it showed

And had to be corrected as below:

Hope this helps you fix the issue

1 Like

I don’t know why it wasn’t backslashes in the code - i try markdown.
Attaching whole policy, but difference from default is only i one attribute:

{
    "name": "account",
    "description": null,
    "usageType": "CREATE",
    "fields": [
        {
            "name": "objectType",
            "transform": {
                "type": "static",
                "attributes": {
                    "value": "user"
                }
            },
            "attributes": {},
            "isRequired": false,
            "type": "string",
            "isMultiValued": false
        },
        {
            "name": "familyName",
            "transform": {
                "type": "identityAttribute",
                "attributes": {
                    "name": "lastname"
                }
            },
            "attributes": {
                "cloudRequired": "true"
            },
            "isRequired": false,
            "type": "string",
            "isMultiValued": false
        },
        {
            "name": "givenName",
            "transform": {
                "type": "identityAttribute",
                "attributes": {
                    "name": "firstname"
                }
            },
            "attributes": {
                "cloudRequired": "true"
            },
            "isRequired": false,
            "type": "string",
            "isMultiValued": false
        },
        {
            "name": "password",
            "transform": {
                "type": "rule",
                "attributes": {
                    "name": "Create Password"
                }
            },
            "attributes": {
                "cloudRequired": "true"
            },
            "isRequired": false,
            "type": "secret",
            "isMultiValued": false
        },
        {
            "name": "primaryEmail",
            "transform": {
                "type": "identityAttribute",
                "attributes": {
                    "name": "email"
                }
            },
            "attributes": {
                "cloudRequired": "true"
            },
            "isRequired": false,
            "type": "string",
            "isMultiValued": false
        },
        {
            "name": "relations",
            "transform": {
                "type": "static",
                "attributes": {
                    "managersMail": {
                        "type": "firstValid",
                        "attributes": {
                            "values": [
                                "$identity.getManager().getStringAttribute('email')",
                                "no manager exists"
                            ]
                        }
                    },
                    "value": "{\"value\": \"$managersMail\",\"type\": \"manager\"}"
                }
            },
            "attributes": {
                "cloudDelimiter": ",",
                "cloudRequired": "true"
            },
            "isRequired": false,
            "type": "string",
            "isMultiValued": true
        },
        {
            "name": "domainName",
            "transform": {
                "type": "static",
                "attributes": {
                    "value": ""
                }
            },
            "attributes": {},
            "isRequired": false,
            "type": "string",
            "isMultiValued": false
        },
        {
            "name": "projectId",
            "transform": {
                "type": "static",
                "attributes": {
                    "value": ""
                }
            },
            "attributes": {},
            "isRequired": false,
            "type": "string",
            "isMultiValued": false
        },
        {
            "name": "serviceAccountId",
            "transform": {
                "type": "static",
                "attributes": {
                    "value": ""
                }
            },
            "attributes": {},
            "isRequired": false,
            "type": "string",
            "isMultiValued": false
        },
        {
            "name": "displayName",
            "transform": {
                "type": "identityAttribute",
                "attributes": {
                    "name": "displayName"
                }
            },
            "attributes": {
                "cloudRequired": "true"
            },
            "isRequired": false,
            "type": "string",
            "isMultiValued": false
        }
    ]
}

OK, problem solved.
In my case working syntax is:
"value": "{'value': '$workPhone','type': 'work'}"

enyway thanks for help :slight_smile:

1 Like

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