Skip to main content
Represents a company.

Constructors

Company()

Initializes a new instance of the Company class.

Methods

checkFieldRights(String,String)

Checks if the current user has access to the field.
Returns: CRMScript.Global.Bool - True if the current user has access to the field; otherwise, false. Example:

checkTableRights(String)

Checks if the current user has access to this company.
Returns: CRMScript.Global.Bool - True if the current user has access to the company; otherwise, false. Example:

findFromDomain(String)

Find and load company object given a domain.
Returns: CRMScript.Global.Bool - True if successfully loaded; otherwise, false.

getFormattedAddress()

Gets the formatted company address.
Returns: CRMScript.NetServer.NSLocalizedField[][] - The formatted company address.

getValue(String)

Gets a String with the value of a given column.
Returns: CRMScript.Global.String - A string value of the given column.
Possible colNames:
  • id: Integer, The primary key (auto-incremented)
  • primContact: Integer, The ID of the customer who is the primary contact for this company customer.id
  • name: String, The name of the company
  • note: String, A freetext field for various notes about this company
  • phone: String, The company’s phone number
  • fax: String, The company’s faxnumber
  • adr: String, The company’s address
  • priority: Integer, The reference to the default priority for this company. NULL or -1 if not set. ticket_priority.id
  • deleted: Bool, A boolean telling if the company is deleted
  • language: Integer, The reference to the default customer language for this company. NULL or -1 if not set. cust_lang.id
  • ourContact: Integer, The customer’s primary contact ejuser.id
  • extTable: Integer, The reference to the external table if this is a cached entry. NULL or -1 if not. ext_table.id
  • extKey: String, The primary key for the cached entry in the external datasource.
  • extLastCached: DateTime, When the cached entry was last updated.
  • domain: String, A display version of the company_domain table for this company.
  • x_* The extrafield with the given database field name.
Example:

load(Integer)

Load object with values from company with given ID.
Returns: CRMScript.Global.Bool - True if successfully loaded; otherwise, false. Example:

loadFromAgentAndKey(Integer,String)

Loads a company based on agent ID and external key.
Returns: CRMScript.Global.Bool - True if successfully loaded; false if the company does not exist.
Loading might overwriting existing values.

save()

Saves the object and returns its ID.
Returns: CRMScript.Global.Integer - The company ID.

setFormattedAddress(NSLocalizedField[][])

Sets the formatted address for a company.
Returns: CRMScript.Global.Void

setValue(String,String)

Sets a value in a column of a company.
Returns: CRMScript.Global.Void
Possible column names
  • id: Integer, The primary key (auto-incremented)
  • primContact: Integer, The ID of the customer who is the primary contact for this company customer.id
  • name: String, The name of the company
  • note: String, A freetext field for various notes about this company
  • infoText: the same as note (From 7.x)
  • phone: String, The company’s phone number
  • phone/formattedNumber: String (From 7.x)
  • fax/formattedNumber: String (From 7.x)
  • fax: String, The company’s faxnumber
  • adr: String, The company’s address (From 7.x setting address with adr is no longer supported. Attempting to do so, will result in a GeneralException. Use NetServer instead)
  • priority: Integer, The reference to the default priority for this company. NULL or -1 if not set. ticket_priority.id
  • deleted: Bool, A boolean telling if the company is deleted
  • language: Integer, The reference to the default customer language for this company. NULL or -1 if not set. cust_lang.id
  • ourContact: Integer, The customer’s primary contact ejuser.id
  • ourSalesContact: Integer, The sales contact for this company. (From 7.x)
  • supportAssociateId: String, Set the support associate id. Supports both integer and the username. (From 7.x)
  • primContact: Integer, The customer’s primary contact customer.id
  • extTable: Integer, The reference to the external table if this is a cached entry. NULL or -1 if not. ext_table.id
  • extKey: String, The primary key for the cached entry in the external datasource.
  • extLastCached: DateTime, When the cached entry was last updated.
  • domain: String, A display version of the company_domain table for this company.
Example:

toParser(Parser)

Puts a lot of fields into the input parser.
Returns: CRMScript.Global.Void
Fields that will be loaded:
  • company.id: The ID
  • company.name: The name
  • company.note: The note
  • company.domain: The domain
  • company.phone: Phone number
  • company.fax: Fax number
  • company.adr: The address
  • company.ourContact: The ID of the user that is this company’s contact
  • company.primaryContact.id: The ID of the customer that is this company’s primary contact
  • company.primaryContact.email: The email address of the customer that is this company’s primary contact
  • company.extraFieldName: The name of the extrafield, (not x_fieldname)