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

**URL:** <https://developer.sailpoint.com/discuss/t/what-command-saas-connector-sends-when-account-does-not-exist-yet/57844>\
**Category:** SHF Discussion and Questions\
**Tags:** sailpoint-identity-security\
**Created:** [May 23, 2024, 8:02pm UTC](https://developer.sailpoint.com/discuss/t/what-command-saas-connector-sends-when-account-does-not-exist-yet/57844 "2024-05-23T20:02:12Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![mcheek](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/mcheek/32/23705_2.png) [@mcheek](https://developer.sailpoint.com/discuss/u/mcheek)\
**Post date:** [May 28, 2024, 6:59pm UTC](https://developer.sailpoint.com/discuss/t/what-command-saas-connector-sends-when-account-does-not-exist-yet/57844/6 "2024-05-28T18:59:17Z")

</div>

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

```JavaScript
.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?

> [@Odd behavior between tenant and custom saas connector - is this normal?](https://developer.sailpoint.com/discuss/t/odd-behavior-between-tenant-and-custom-saas-connector-is-this-normal/36527):
>
> I have created a custom SaaS connector and I’m currently testing it out, but I have noticed some odd behavior that I do not see with VA-based OOB connectors. This post became very long so here are the different scenarios I’ve observed Access requests for identities without an account in the source send multiple duplicate provisioning requests to the connector after the original create/update request Access requests to revoke existing access get “thrown away” by the [create-access-request](https://developer.sailpoint.com/docs/api/v3/create-access-request) API e…

---

_[View the full topic](https://developer.sailpoint.com/discuss/t/what-command-saas-connector-sends-when-account-does-not-exist-yet/57844)._
