# GraphQL: How to Create an Entity Customer with an Account / AccountId Automatically?

**URL:** <https://forum.sambapos.com/t/graphql-how-to-create-an-entity-customer-with-an-account-accountid-automatically/32240>\
**Category:** V5 Question\
**Created:** [August 21, 2026, 6:18pm UTC](https://forum.sambapos.com/t/graphql-how-to-create-an-entity-customer-with-an-account-accountid-automatically/32240 "2026-08-21T18:18:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![iamCeem](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/i/e495f1/32.png) [@iamCeem](https://forum.sambapos.com/u/iamCeem)\
**Post date:** [August 21, 2026, 6:18pm UTC](https://forum.sambapos.com/t/graphql-how-to-create-an-entity-customer-with-an-account-accountid-automatically/32240/1 "2026-08-21T18:18:46Z")

</div>

Hi everyone,

I’m working on an integration between our **Reservation Service and SambaPOS**.

The expected flow is:

1. Customer makes a reservation.

2. Customer pays a deposit (DP) in our Reservation Service.

3. Reservation Service creates the customer in SambaPOS.

4. SambaPOS creates an Account for that customer.

5. We post the deposit amount into the customer’s account.

Creating the customer through GraphQL works:

```auto
mutation {
  addEntity(entity: {
    entityType: "Customers",
    name: "Ceem",
    customData: [
      { name: "Phone", value: "1234567890" },
      { name: "Tanggal DP", value: "08/21/2026 12:00 am" },
      { name: "Booking Date & Time", value: "08/21/2026 12:00 am" }
    ]
  }) {
    id
    accountId
    type
    name
  }
}

```

The entity is successfully created, but `accountId` is `0`.

I checked the GraphQL schema for `EntityInputType` and it only contains:

```auto
entityType
name
customData

```

There is no `accountId` or `createAccount` field.

I also checked all available mutations through introspection and I couldn’t find any `createAccount` / `addAccount` mutation.

### What I tried with Automation

I created a SambaPOS script that calls:

```auto
api.Entity("Ceem").CreateAccount();

```

When I run/test this script directly from SambaPOS, it works correctly and the account is created.

I then created an Automation Rule:

```auto
Event:
Automation Command Executed

Automation Command:
Create Customer Account

Action:
Execute Script

```

If I trigger the rule from inside SambaPOS, it also works.

However, when I trigger the Automation Command through GraphQL:

```auto
mutation {
  executeAutomationCommand(
    name: "Create Customer Account"
    terminal: "Kasir"
    department: "DINE IN"
    user: "Administrator"
    ticketType: "Ticket"
  )
}

```

the mutation succeeds, but the expected account creation does not happen.

### GraphQL Parameters Issue

I also tried passing the customer name through `parameters`.

For example:

```auto
parameters: [
  { name: "CustomerName", value: "Ceem" }
]

```

but SambaPOS returns:

```auto
System.MissingMethodException:
No parameterless constructor defined for this object.

GraphQL.ObjectExtensions.ToObject(...)

```

I get the same error when trying `notifyEvent` with parameters.

Without `parameters`, `executeAutomationCommand` works.

I also tried `notifyEvent` with `AutomationCommandExecuted`, but using `parameters` results in the same `MissingMethodException`.

### What I’m trying to achieve

Ultimately I want this to happen without any manual action in SambaPOS:

```auto
Reservation Service
       |
       | Customer Paid Deposit
       v
SambaPOS GraphQL
       |
       +--> Create Customer Entity
       |
       +--> Create Customer Account
       |
       +--> Post Deposit to Customer Account

```

Currently the blocking part is:

```auto
Entity created successfully
        ↓
accountId = 0
        ↓
How can I create/link the account automatically?

```

Is there a supported way through GraphQL to:

1. Create an Entity and automatically create its Account?

2. Call something equivalent to `api.Entity(name).CreateAccount()`?

3. Trigger an Automation Rule from GraphQL in the same context as triggering it from SambaPOS?

4. Or is there another recommended approach for posting customer deposits from an external application?

The important requirement is that this needs to run **server-side automatically** , without someone having to open SambaPOS and manually create the account or enter the deposit.

Any guidance on the recommended SambaPOS approach would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![VehbiEmiroglu](https://forum.sambapos.com/user_avatar/forum.sambapos.com/vehbiemiroglu/32/64590_2.png) [@VehbiEmiroglu](https://forum.sambapos.com/u/VehbiEmiroglu)\
**Post date:** [August 22, 2026, 10:47am UTC](https://forum.sambapos.com/t/graphql-how-to-create-an-entity-customer-with-an-account-accountid-automatically/32240/2 "2026-08-22T10:47:10Z")

</div>

Please send me an email. I will help you. [vehbi@sambapos.com](mailto:vehbi@sambapos.com)

---

<div class="post-metadata">

**Author:** ![iamCeem](https://forum.sambapos.com/letter_avatar_proxy/v4/letter/i/e495f1/32.png) [@iamCeem](https://forum.sambapos.com/u/iamCeem)\
**Post date:** [September 17, 2026, 9:28am UTC](https://forum.sambapos.com/t/graphql-how-to-create-an-entity-customer-with-an-account-accountid-automatically/32240/3 "2026-09-17T09:28:59Z")

</div>

I have sent you an email , thank you
