Company

Overview

A company entity represents a business set up by a group of people. It can be the holder of a policy.

Example:

For a employees compensation product, the policy holder is a company entity and the insured could be an array of individual entities

Fields usually used

FieldsDescription
acceptsMarketingwhether or not the company is willing to receive marketing notification
associatedLoginthe login details of the company for authentication purpose
caseHolderOflist of cases which the company associated with, if any
createdAtthe timestamp when the company was created
eventsa list of change events happened to the company
fieldsdynamic fields associated with the company (usually in form of json)
holderOflist of policies which the company holds, if any
idthe id which was automatically generated when the company was created
notesadditional notes on the company with tile and content
namethe name of the company
notificationslist of notifications (email, sms) sent to the individual, if any
notificationListsimilar to notifications, but with totalCount available
stakeHolderslist of entities which the company is a stakeHolder (eg. an company can be a stakeHolder of another company)
subscriptionslist of topics that the company subscribed to
tagstags added to describe the company
relationshipListlist of links between entities added by mutation.addLink

To see a full list of fields please visit our Playground

Creating a Company

Query Examples

mutation createCompany(
  $input: createCompanyInput!
) {
  createCompany(
    createCompanyInput:$input
  ) {
    createdStatus { id ids } 
    errors 
    status
  }
}

Input:

{
  "input":{
    "registrationNumber": "BR123",
    "natureOfBusiness": "Medical",
    "email": "[email protected]",
    "nameFormat": "Test Company",
    "fields": "{\"address\":\"Unit 603, 6\/F, Tower 1, Admiralty Centre 18 Harcourt Road, Admiralty, Hong Kong\",\"phone\":\"+852 12345678\",\"companySize\":200}"
  }
}

Example Result:

{
  "data": {
    "createCompany": {
      "createdStatus": {
        "id": "661e3924-b2e2-4d07-887e-a35fbe73255d",
        "ids": null
      },
      "errors": null,
      "status": "success"
    }
  }
}

Querying Companies

Query Examples

query companies {
  companies {
    list {
      id 
      acceptsMarketing
      associatedLogin { id username email isEmailConfirmed }
      caseHolderOf { id name } 
      createdAt
      events { type } 
      fields
      holderOf { id }
      id
      name
      notes { title content }
      notifications { id }
      notificationList { list {id} }
      stakeholders { entity { id name }}
      subscriptions { id startDate endDate }
      tags
      relationshipList { list { type values { key value }} }
    }
  }
}

Example Results:

{
  "data": {
    "companies": {
      "list": [
        {
          "id": "661e3924-b2e2-4d07-887e-a35fbe73255d",
          "acceptsMarketing": null,
          "associatedLogin": null,
          "caseHolderOf": [],
          "createdAt": "2021-04-30T04:56:41.477Z",
          "events": [
            {
              "type": "creation"
            },
            {
              "type": "addContact"
            }
          ],
          "fields": "{\"address\":\"Unit 603, 6/F, Tower 1, Admiralty Centre 18 Harcourt Road, Admiralty, Hong Kong\",\"phone\":\"+852 12345678\",\"companySize\":200}",
          "holderOf": [],
          "name": "Test Company",
          "notes": [],
          "notifications": [],
          "notificationList": {
            "list": []
          },
          "stakeholders": null,
          "subscriptions": [],
          "tags": null,
          "relationshipList": {
            "list": null
          }
        }
      ]
    }
  }
}

For more details on how to create login for company, please refer to Login.