usernameGenerator

Hi,

This is my Create Policy for webService connector. I receive below error for provisioning.

An unexpected error occurred: java.lang.NullPointerException: Cannot invoke "java.util.Map.entrySet()" because "table" is null

{

    "name": "Create Policy",

    "description": "Create Policy Description",

    "usageType": "CREATE",

    "fields": [

        {

            "name": "email",

            "transform": {

                "type": "identityAttribute",

                "attributes": {

                    "name": "email"

                }

            },

            "attributes": {},

            "isRequired": false,

            "type": "string",

            "isMultiValued": false

        },

        {

            "name": "firstName",

            "transform": {

                "type": "identityAttribute",

                "attributes": {

                    "name": "firstname"

                }

            },

            "attributes": {},

            "isRequired": false,

            "type": "string",

            "isMultiValued": false

        },

        {

            "name": "lastName",

            "transform": {

                "type": "identityAttribute",

                "attributes": {

                    "name": "lastname"

                }

            },

            "attributes": {},

            "isRequired": false,

            "type": "string",

            "isMultiValued": false

        },

        {

            "name": "userId",

            "transform": {

                "type": "usernameGenerator",

                "attributes": {

                    "sourceCheck": true,

                    "patterns": [

                        "$roleInitial.$fi$ln",

                        "$fi$ln",

                        "$roleInitial.$fi$ln${uniqueCounter}",

                        "$fi$ln${uniqueCounter}"

                    ],

                    "roleInitial": {

                        "type": "lookup",

                        "attributes": {

                            "input": {

                                "type": "identityAttribute",

                                "attributes": {

                                    "name": "businessUnit"

                                }

                            },

                            "table": {

                                "Administrators": "A",

                                "Build Team": "B",

                                "Call Center Team": "C",

                                "IT API & Data Validation Team": "D",

                                "Education Team": "E",

                                "Finance Team": "F",

                                "Home Trial Services": "H",

                                "Leadership": "L",

                                "CTM/PM": "P",

                                "Recruitment Team": "R",

                                "Site Users": "S",

                                "Testing": "T",

                                "Internal QA": "Q",

                                "VST Team": "V",

                                "default": "X"

                            }

                        }

                    },

                    "fi": {

                        "type": "upper",

                        "attributes": {

                            "input": {

                                "type": "substring",

                                "attributes": {

                                    "input": {

                                        "type": "identityAttribute",

                                        "attributes": {

                                            "name": "firstname"

                                        }

                                    },

                                    "begin": 0,

                                    "end": 1

                                }

                            }

                        }

                    },

                    "ln": {

                        "type": "replaceAll",

                        "attributes": {

                            "input": {

                                "type": "identityAttribute",

                                "attributes": {

                                    "name": "lastname"

                                }

                            },

                            "regex": "[^\\p{L}]",

                            "replacement": ""

                        }

                    }

                }

            },

            "attributes": {

                "cloudMaxUniqueChecks": "25",

                "cloudMaxSize": "100",

                "cloudRequired": "true"

            },

            "isRequired": false,

            "type": "string",

            "isMultiValued": false

        }

    ]

}

I checked the roleInitial as separate transform and it works. I even tired to reference that transform into the create policy, but it didnt work.

{

    "name": "Create Policy",

    "description": "Create Policy Description",

    "usageType": "CREATE",

    "fields": [

        {

            "name": "email",

            "transform": {

                "type": "identityAttribute",

                "attributes": {

                    "name": "email"

                }

            },

            "attributes": {},

            "isRequired": false,

            "type": "string",

            "isMultiValued": false

        },

        {

            "name": "firstName",

            "transform": {

                "type": "identityAttribute",

                "attributes": {

                    "name": "firstname"

                }

            },

            "attributes": {},

            "isRequired": false,

            "type": "string",

            "isMultiValued": false

        },

        {

            "name": "lastName",

            "transform": {

                "type": "identityAttribute",

                "attributes": {

                    "name": "lastname"

                }

            },

            "attributes": {},

            "isRequired": false,

            "type": "string",

            "isMultiValued": false

        },

        {

            "name": "userId",

            "transform": {

                "type": "usernameGenerator",

                "attributes": {

                    "sourceCheck": true,

                    "patterns": [

                        "$roleInitial.$fi$ln",

                        "$fi$ln",

                        "$roleInitial.$fi$ln${uniqueCounter}",

                        "$fi$ln${uniqueCounter}"

                    ],

                    "roleInitial": {

                        "type": "reference",

                        "name": "Role Initial Reference",

                        "attributes": {

                            "id": "Role Initial Lookup"

                        }

                    },

                    "fi": {

                        "type": "upper",

                        "attributes": {

                            "input": {

                                "type": "substring",

                                "attributes": {

                                    "input": {

                                        "type": "identityAttribute",

                                        "attributes": {

                                            "name": "firstname"

                                        }

                                    },

                                    "begin": 0,

                                    "end": 1

                                }

                            }

                        }

                    },

                    "ln": {

                        "type": "replaceAll",

                        "attributes": {

                            "input": {

                                "type": "identityAttribute",

                                "attributes": {

                                    "name": "lastname"

                                }

                            },

                            "regex": "[^\\p{L}]",

                            "replacement": ""

                        }

                    }

                }

            },

            "attributes": {

                "cloudMaxUniqueChecks": "25",

                "cloudMaxSize": "100",

                "cloudRequired": "true"

            },

            "isRequired": false,

            "type": "string",

            "isMultiValued": false

        }

    ]

}

Hi @Manju22 Not saying it is this, but you’ve got 2 patterns in your username generator that include {uniqueCounter}. This could be causing ISC not to parse the json correctly. You should only have one pattern containing {uniqueCounter} (and it should be the last)

@j_place Thanks, I have removed the additional ones, Still get the same error.

                    "patterns": [

                        "$roleInitial.$fi$ln",

                        "$roleInitial.$fi$ln${uniqueCounter}"

                    ],

The issue has been resolved.

It was caused by an incorrect transform type. I had configured “replaceAll” instead of “replace”, and since “replaceAll” expects a table input, it resulted in the error.

—-Updated transform —-
{
“name”: “Create Policy”,
“description”: “Create Policy Description”,
“usageType”: “CREATE”,
“fields”: [
{
“name”: “email”,
“transform”: {
“type”: “identityAttribute”,
“attributes”: {
“name”: “email”
}
},
“attributes”: {},
“isRequired”: false,
“type”: “string”,
“isMultiValued”: false
},
{
“name”: “firstName”,
“transform”: {
“type”: “identityAttribute”,
“attributes”: {
“name”: “firstname”
}
},
“attributes”: {},
“isRequired”: false,
“type”: “string”,
“isMultiValued”: false
},
{
“name”: “lastName”,
“transform”: {
“type”: “identityAttribute”,
“attributes”: {
“name”: “lastname”
}
},
“attributes”: {},
“isRequired”: false,
“type”: “string”,
“isMultiValued”: false
},
{
“name”: “userName”,
“transform”: {
“type”: “usernameGenerator”,
“attributes”: {
“sourceCheck”: false,
“patterns”: [
“$roleInitial.$fi$ln”,
“$roleInitial.$fi$ln${uniqueCounter}”
],
“ln”: {
“type”: “replace”,
“attributes”: {
“input”: {
“type”: “identityAttribute”,
“attributes”: {
“name”: “lastname”
}
},
“regex”: “[^\p{L}]”,
“replacement”: “”
}
},
“fi”: {
“type”: “upper”,
“attributes”: {
“input”: {
“type”: “substring”,
“attributes”: {
“input”: {
“type”: “identityAttribute”,
“attributes”: {
“name”: “firstname”
}
},
“begin”: 0,
“end”: 1
}
}
}
},
“roleInitial”: {
“type”: “lookup”,
“attributes”: {
“input”: {
“type”: “identityAttribute”,
“attributes”: {
“name”: “businessUnit”
}
},
“table”: {
“Administrators”: “A”,
“Build Team”: “B”,
“Call Center Team”: “C”,
“IT API & Data Validation Team”: “D”,
“Education Team”: “E”,
“Finance Team”: “F”,
“Home Trial Services”: “H”,
“Leadership”: “L”,
“CTM/PM”: “P”,
“Recruitment Team”: “R”,
“Site Users”: “S”,
“Testing”: “T”,
“Internal QA”: “Q”,
“VST Team”: “V”,
“default”: “X”
}
}
}
}
},
“attributes”: {
“cloudMaxUniqueChecks”: “25”,
“cloudMaxSize”: “100”,
“cloudRequired”: “true”
},
“isRequired”: false,
“type”: “string”,
“isMultiValued”: false
}
]
}