Specify Account ID upon Creation
Read Time: 2 mins
When creating an account in Sonar through the GUI, it is not currently possible to specify the account ID. However, there are some scenarios where you might want this functionality. For example:
- Every subscriber who signs up in a particular year should have an account ID that begins with that year (e.g., 2023xxxx).
- A third-party tool (e.g., Jira) is responsible for generating the account IDs that then need to match in Sonar.
If you find yourself in a similar scenario, you can use the GraphQL mutation explained below in order to specify the account ID upon creation.
Note that if the new account ID is the highest one currently in the system, Sonar will reset the pointer so that subsequent account IDs will increment from that number. For example:
- You create a new account using the method below, specifying the ID as 20230001
- You then create another new account and don't specify the ID; that account will now get an ID of 20230002
To specify the account ID (in this case 20230001), run this GraphQL mutation:
mutation {
createAccount(
input: {
id: 20230001,
name: "Account XYZ",
account_status_id: 2,
account_type_id: 1,
company_id: 1,
primary_contact: {
name: "Ms. Person"
}
}
) {
id
}
}Once the user is created, you can then open the account in Sonar through the GUI and make any needed adjustments to the account name, status, contact information, etc.