Company Reference
Constructor
The companies array can contain multiple instances of the Company class. TheM.companies[0]
refers to the first company associated with the currently logged in user. If multiple companies exist, TheM.companies[0]
could be replaced by TheM.companies[1]
, TheM.companies[2]
, etc. Alternatively, you could reference the company based on the AFiCompanyId, replacing TheM.companies[0]
with TheM.companies['PUT_AFiCompanyId_HERE']
or TheM.companies.company('PUT_AFiCompanyId_HERE')
.
A new instance of the Company class is initialized when a modelBank company created
event occurs or when a new business user is onboarded (See the Onboarding Company Guide for an example). The properties and methods of the Company class can be referenced by specifying the company, followed by the property or method name, like TheM.companies['PUT_AFiCompanyId_HERE'].AFiCompanyId
//A new instance of the Company class is instantiated automatically when a `modelBank company created` event occurs or when a new business user is onboarded.
Example
Properties
Property table for Company
Property | Description | Required | Schema |
---|---|---|---|
AFiCompanyId | Gets (returns) the company ID in ampliFi. | Yes | { "title": "TheM.companies[0].AFiCompanyId", "type": "string", "description": "Gets (returns) the company ID in ampliFi.", "examples": [ "lyrej3zzfvfvpyjbntxuabqavlimiv" ], "nullable": false } |
CFiCompanyId | Gets (returns) the company ID in connectFi, if applicable. | No | { "title": "TheM.companies[0].CFiCompanyId", "type": "string", "description": "Gets (returns) the company ID in connectFi, if applicable.", "examples": [ "cstab_1zTdNR35ol9CrZt2qETi04" ], "nullable": true } |
companyIdBO | Gets (returns) the company ID in the back-office, if applicable. | No | { "title": "TheM.companies[0].companyIdBO", "type": "string", "description": "Gets (returns) the company ID in the back-office, if applicable.", "examples": [ "cstab_1zTdNR35ol9CrZt2qETi04" ], "nullable": true } |
name | Gets (returns) the name of the company. | Yes | { "title": "TheM.companies[0].name", "type": "string", "description": "Gets (returns) the name of the company.", "examples": [ "Company ABC2" ], "nullable": false } |
nameFull | Gets (returns) the full name of the company. | Yes | { "title": "TheM.companies[0].nameFull", "type": "string", "description": "Gets (returns) the full name of the company.", "examples": [ "Full Company ABC2" ], "nullable": false } |
ein | Gets (returns) the Employer Identification Number (EIN) of the company. | Yes | { "title": "TheM.companies[0].ein", "type": "string", "description": "Gets (returns) the Employer Identification Number (EIN) of the company.", "examples": [ "123456789" ], "nullable": false } |
users | Gets (returns) an array of users for the specified company. | No | { "title": "TheM.companies[0].users", "type": "array", "description": "Gets (returns) an array of users for the specified company.", "examples": [ [ { "AFiCompanyId": "lyrej3zzfvfvpyjbntxuabqavlimiv", "AFiUserId": "testaurlx8wfimcrw", "dtsModified": "2024-07-22T11:05:07.261Z", "faceImage": "Very_Long_Base64_Image_String", "firstName": "Suzy", "isSelf": true, "lastName": "Tester", "middleName": "Queue", "modifiedBy": "testaurlx8wfimcrw", "role": "admin" } ] ], "nullable": true } |
modifiedBy | Gets (returns) the ID of the admin who last modified this Company, if applicable. | No | { "title": "TheM.companies[0].modifiedBy", "type": "string", "description": "Gets (returns) the ID of the admin who last modified this Company, if applicable.", "examples": [ "testaurlx8wfimcrw" ], "nullable": true } |
toJSON | Gets (returns) the Company properties in a JSON formatted object. | Yes | { "title": "TheM.companies[0].toJSON", "type": "object", "description": "Gets (returns) the Company properties in a JSON formatted object.", "examples": [ { "AFiCompanyId": "lyrej3zzfvfvpyjbntxuabqavlimiv", "dtsCreated": "2024-07-22T11:05:07.261Z", "dtsModified": "2024-07-22T11:05:07.261Z", "ein": "123456789", "isActive": true, "isDeleted": false, "name": "Company ABC2", "nameFull": "Full Company ABC2", "usersRaw": { "testaurlx8wfimcrw": {} } } ], "nullable": false } |
isAdmin | Gets (returns) true if the currently logged in user has an admin role for the specified company. | Yes | { "title": "TheM.companies[0].isAdmin", "type": "boolean", "description": "Gets (returns) true if the currently logged in user has an admin role for the specified company.", "examples": [ true, false ], "nullable": false } |
isUser | Gets (returns) true if the currently logged in user has a user role for the specified company. | Yes | { "title": "TheM.companies[0].isUser", "type": "boolean", "description": "Gets (returns) true if the currently logged in user has a user role for the specified company.", "examples": [ true, false ], "nullable": false } |
dtsCreated | Gets (returns) the date that the company was created. | Yes | { "title": "TheM.companies[0].dtsCreated", "type": "Date", "description": "Gets (returns) the date that the company was created.", "examples": [ "Mon Jul 22 2024 07:05:07 GMT-0400 (Eastern Daylight Time)" ], "nullable": false } |
dtsModified | Gets (returns) the date that the company was last modified. | Yes | { "title": "TheM.companies[0].dtsModified", "type": "Date", "description": "Gets (returns) the date that the company was last modified.", "examples": [ "Mon Jul 22 2024 07:05:07 GMT-0400 (Eastern Daylight Time)" ], "nullable": false } |
Methods
Method Name | Parameter Descriptions | Description | Example |
---|---|---|---|
user | [ |
Returns the user object specified by givenAFiUserId, if it exists in the users array for this Company. | TheM.companies[0].user("testaurlx8wfimcrw"); |
doInviteUser | [ |
The doInviteUser method returns a promise that sends the specified user to the server to add to the Company. The currently logged in user must have an admin role in the specified company in order to invite another user to the Company. The email address of the invitee must be unique in the company. | TheM.companies[0].doInviteUser({); |
doReinviteToCompany | [ |
The doReinviteToCompany method returns a promise that sends another invitation to a user that was previouly added to the Company. The currently logged in user must have an admin role in the specified company in order to reinvite another user to the Company. | TheM.companies[0].doReinviteToCompany({); |
doModifyUser | [ |
Returns a promise that sends a request to the server to modify the specified user. An error will be returned if the currently logged in user does not have an admin role in the specified company. The user role may be modified or the isDeleted property may be toggled true/false. | TheM.companies[0].doModifyUser({); |
doSuspendUser | [ |
The doSuspendUser method returns a promise that sends a generic request to the server to suspend (or un-suspend) the specified user. Company cards for which the specified user is the cardholder will be toggled off if the user is being suspended and will be toggled on if the user is being un-suspended. The currently logged in user must have an admin role in the specified company in order to suspend another user. | TheM.companies[0].doSuspendUser({); |
doDeleteUser | [ |
Returns a promise that sends a generic request to the server to delete the specified user. The currently logged in user must have an admin role in the specified company in order to delete another user. | TheM.companies[0].doDeleteUser({); |