What command SaaS connector sends when account does not exist yet?

I would make sure that you are returning a valid account object back to IdN from your stdAccountCreate function.

I had originally added a check to mine as well

.stdAccountCreate(
            async (context: Context, input: StdAccountCreateInput, res: Response<StdAccountCreateOutput>) => {
                logger.info(`${input}`)
                let account

                //Checks to see if account already exists, in case it was created outside of IdN in between aggregations
                const account_query = await httpClient.queryAccount(input.attributes.email_address)
                if (account_query.data.header.dataRows > 0) {
                    account = await readAccount(account_query.data.user_id)
                    logger.info(`A new account for ${input.attributes.full_name} will not be created because
                    an existing account was found with the same email address - account id is ${account.attributes.user_id}`)
                }
                else {
                    const user = { ...input.attributes, ...{ groups: undefined } }
                    const account_response = await httpClient.createAccount(user)
                    account = await readAccount(account_response.data.user_id)
                    logger.info(`New Account Created for ${input.attributes.full_name} - account id is ${account.identity}`)
                }

                res.send(account)
            }
        )

The reason I put it there is that it’s possible for an account to be created directly in the system by another admin, so I wanted it to check first in case.

I found the issue was because I was returning the account Id back to IdN as an integer and not a string. Maybe that’s your issue?

1 Like