Specify Account ID upon Creation

Matt Glosson Updated by Matt Glosson

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.

To learn more about using GraphQL in Sonar, take a look at the How To Use GraphiQL to Understand the Sonar API article here.

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:

  1. You create a new account using the method below, specifying the ID as 20230001
  2. You then create another new account and don't specify the ID; that account will now get an ID of 20230002
You can create an account ID lower than the highest ID, but if subsequent account additions do not specify the ID, it will always be set to the next-highest number.

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
}
}
In the above GraphQL mutation example, you can change "Account XYZ" to the name you want for the account, and "Ms. Person" to the name of the account's primary contact.

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.

How did we do?

CPUC June 2021: Instructions for Sonar V2

Lead Intake Form Processing

Contact