The Company Service provides you with a range of useful methods for integrating with 24SevenOffice. Most notably SaveCompanies, GetCompanies and DeleteCompanies. This is the service you use for information related to the CRM module and is used for all customer information. In the cases where you have to specify return properties, you will have to sent a string array with the names of the properties you want returned.
Specifying a Company ID
Please note that you cannot specify your own CompanyID since this is generated by the 24SevenOffice system. If you specify a CompanyId, this means you are updating an existing item. If you wish to specify your own Id you must use the ExternalId property. You can also use the methodSaveMaps if you wish to save an array of Id relations. This data is only accessible through the API (please see SaveMaps below for more information).
Saving a Company
In order to save a company, all you have to do is submit a Name and a Type. You probably want to add more information than that, but it will get you started. The Types you can choose from are: Lead, Consumer (also known as a private customer), Business and Supplier.
Below is a simple XML example for a request to SaveCompanies:
<companies> <Company> <Name>Test Name</Name> <Type>Business</Type> </Company> </companies>
If you wish to use an external ID in addition to the 24SevenOffice ID, you can use the CompanyMap data type that consist of MapType, ExternalId and CompanyId. You use MapType the specify a type of mapping. This is useful if you are mapping several external Id’s. ExternalId is the external Id and CompanyId is the 24SevenOffice Id. Please note that these mapping references are not visible in the 24SevenOffice user interface, but only on a programmatic level through the API.
|Method||Input type||Input name||Return type||Description|
|GetCompanies||CompanySearchParameters, String||searchParams,returnProperties||Company||Returns a list of companies based on the search parameters. You need to specify the return properties.|
|DeleteCompanies||Company||companies||Company||Deletes an array of companies and returns the ones where a delete error occured. Only the Id-property of Company is required to delete.|
|SaveCompanies||Company||companies||Company||Saves all the companies in the array. This method also returns all companies, now with the Id if it is a new company. Please see APIException property for any save errors.|
|SaveRelations||Relation||relations||Relation||Saves an array of relations and returns the ones where an error occured.|
|DeleteRelations||Relation||relations||Relation||Deletes an array of relations and returns the ones where an delete error occured.|
|SaveMaps||Map||maps||Map||Saves an array of maps and returns the ones where an error occured.|
|DeleteMaps||Map||maps||Map||Deletes an array of mapsand returns the ones where an delete error occured.|
|GetStatuses||KeyValuePair||Returns a KeyValuePair array of all CRM statuses. Key = StatusId, Value = StatusName|
|GetCategories||Category||Returns an array of all CRM categories.|
|SaveCategories||Category||Save an array of CRM categories.|
|GetIndustries||KeyValuePair||Returns a KeyValuePair array of all Industries. Key = Id, Value = Name|
|GetCustomerCategoryTree||KeyValuePair||Returns a KeyValuePair array of all Companies and their linked categories. Key = CategoryId, Value = CompanyId.|
|GetCustomerCategories||Int32||customerId||Int32||Returns an array of Category Ids linked to the specified customer|
|SaveCustomerCategories||KeyValuePair||customerCategories||APIException||BETA: Saves categories to customers (Key = CategoryId, Value = CompanyId) and returns a list of errors (if any)|
|DeleteCustomerCategories||KeyValuePair||customerCategories||APIException||Deletes categories from customers (Key = CategoryId, Value = CompanyId) and returns a list of errors (if any)|
|GetCRMGroups||Group||Returns a tree list of CRM Groups and sub groups|