service/core/SugarWebServiceImpl.php

Show: inherited
Table of Contents

Constants

Constant  sugarEntry = true

\SugarWebServiceImpl

Package:
Children
\SugarWebServiceImplv2_1
\SugarWebServiceImplv3
\SugarRestServiceImpl

Properties

Propertypublic  $helperObject= 'null'
static
Default valuenullDetails
Type
n/a

Methods

methodpublicget_available_modules( String $session ) : Array

Retrieve the list of available modules on the system available to the currently logged in user.

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

Returns
Type Description
Array 'modules' -- Array - An array of module names
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicget_document_revision( String $session, String $id ) : \new_return_document_revision

This method is used as a result of the .htaccess lock down on the cache directory. It will allow a properly authenticated user to download a document that they have proper rights to download.

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

$id String

-- ID of the document revision to obtain

Returns
Type Description
\new_return_document_revision - Array String 'id' -- The ID of the document revision containing the attachment String document_name - The name of the document String revision - The revision value for this revision String 'filename' -- The file name of the attachment Binary 'file' -- The binary contents of the file.
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicget_entries( String $session, String $module_name, Array $ids, Array $select_fields, Array $link_name_to_fields_array ) : Array

Retrieve a list of SugarBean's based on provided IDs. This API will not wotk with report module

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

$module_name String

-- The name of the module to return records from. This name should be the name the module was developed under (changing a tab name is studio does not affect the name that should be passed into this method)..

$ids Array

-- An array of SugarBean IDs.

$select_fields Array

-- A list of the fields to be included in the results. This optional parameter allows for only needed fields to be retrieved.

$link_name_to_fields_array Array

-- A list of link_names and for each link_name, what fields value to be returned. For ex.'link_name_to_fields_array' => array(array('name' => 'email_addresses', 'value' => array('id', 'email_address', 'opt_out', 'primary_address')))

Returns
Type Description
Array 'entry_list' -- Array - The records name value pair for the simple data types excluding link field data. 'relationship_list' -- Array - The records link field data. The example is if asked about accounts email address then return data would look like Array ( [0] => Array ( [name] => email_addresses [records] => Array ( [0] => Array ( [0] => Array ( [name] => id [value] => 3fb16797-8d90-0a94-ac12-490b63a6be67 ) [1] => Array ( [name] => email_address [value] => hr.kid.qa@example.com ) [2] => Array ( [name] => opt_out [value] => 0 ) [3] => Array ( [name] => primary_address [value] => 1 ) ) [1] => Array ( [0] => Array ( [name] => id [value] => 403f8da1-214b-6a88-9cef-490b63d43566 ) [1] => Array ( [name] => email_address [value] => kid.hr@example.name ) [2] => Array ( [name] => opt_out [value] => 0 ) [3] => Array ( [name] => primary_address [value] => 0 ) ) ) ) )
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicget_entries_count( String $session, String $module_name, String $query, int $deleted ) : Array

Retrieve number of records in a given module

Parameters
Name Type Description
$session String

session -- Session ID returned by a previous call to login.

$module_name String

module_name -- module to retrieve number of records from

$query String

query -- allows webservice user to provide a WHERE clause

$deleted int

deleted -- specify whether or not to include deleted records

Returns
Type Description
Array result_count - integer - Total number of records for a given module and query
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicget_entry( String $session, String $module_name, String $id, Array $select_fields, Array $link_name_to_fields_array ) : Array

Retrieve a single SugarBean based on ID.

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

$module_name String

-- The name of the module to return records from. This name should be the name the module was developed under (changing a tab name is studio does not affect the name that should be passed into this method)..

$id String

-- The SugarBean's ID value.

$select_fields Array

-- A list of the fields to be included in the results. This optional parameter allows for only needed fields to be retrieved.

$link_name_to_fields_array Array

-- A list of link_names and for each link_name, what fields value to be returned. For ex.'link_name_to_fields_array' => array(array('name' => 'email_addresses', 'value' => array('id', 'email_address', 'opt_out', 'primary_address')))

Returns
Type Description
Array 'entry_list' -- Array - The records name value pair for the simple data types excluding link field data. 'relationship_list' -- Array - The records link field data. The example is if asked about accounts email address then return data would look like Array ( [0] => Array ( [name] => email_addresses [records] => Array ( [0] => Array ( [0] => Array ( [name] => id [value] => 3fb16797-8d90-0a94-ac12-490b63a6be67 ) [1] => Array ( [name] => email_address [value] => hr.kid.qa@example.com ) [2] => Array ( [name] => opt_out [value] => 0 ) [3] => Array ( [name] => primary_address [value] => 1 ) ) [1] => Array ( [0] => Array ( [name] => id [value] => 403f8da1-214b-6a88-9cef-490b63d43566 ) [1] => Array ( [name] => email_address [value] => kid.hr@example.name ) [2] => Array ( [name] => opt_out [value] => 0 ) [3] => Array ( [name] => primary_address [value] => 0 ) ) ) ) )
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicget_entry_list( String $session, String $module_name, String $query, String $order_by, integer $offset, Array $select_fields, Array $link_name_to_fields_array, integer $max_results, integer $deleted ) : Array

Retrieve a list of beans. This is the primary method for getting list of SugarBeans from Sugar using the SOAP API.

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

$module_name String

-- The name of the module to return records from. This name should be the name the module was developed under (changing a tab name is studio does not affect the name that should be passed into this method)..

$query String

-- SQL where clause without the word 'where'

$order_by String

-- SQL order by clause without the phrase 'order by'

$offset integer

-- The record offset to start from.

$select_fields Array

-- A list of the fields to be included in the results. This optional parameter allows for only needed fields to be retrieved.

$link_name_to_fields_array Array

-- A list of link_names and for each link_name, what fields value to be returned. For ex.'link_name_to_fields_array' => array(array('name' => 'email_addresses', 'value' => array('id', 'email_address', 'opt_out', 'primary_address')))

$max_results integer

-- The maximum number of records to return. The default is the sugar configuration value for 'list_max_entries_per_page'

$deleted integer

-- false if deleted records should not be include, true if deleted records should be included.

Returns
Type Description
Array 'result_count' -- integer - The number of records returned 'next_offset' -- integer - The start of the next page (This will always be the previous offset plus the number of rows returned. It does not indicate if there is additional data unless you calculate that the next_offset happens to be closer than it should be. 'entry_list' -- Array - The records that were retrieved 'relationship_list' -- Array - The records link field data. The example is if asked about accounts email address then return data would look like Array ( [0] => Array ( [name] => email_addresses [records] => Array ( [0] => Array ( [0] => Array ( [name] => id [value] => 3fb16797-8d90-0a94-ac12-490b63a6be67 ) [1] => Array ( [name] => email_address [value] => hr.kid.qa@example.com ) [2] => Array ( [name] => opt_out [value] => 0 ) [3] => Array ( [name] => primary_address [value] => 1 ) ) [1] => Array ( [0] => Array ( [name] => id [value] => 403f8da1-214b-6a88-9cef-490b63d43566 ) [1] => Array ( [name] => email_address [value] => kid.hr@example.name ) [2] => Array ( [name] => opt_out [value] => 0 ) [3] => Array ( [name] => primary_address [value] => 0 ) ) ) ) )
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicget_module_fields( String $session, String $module_name, Array $fields = array() ) : Array

Retrieve vardef information on the fields of the specified bean.

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

$module_name String

-- The name of the module to return records from. This name should be the name the module was developed under (changing a tab name is studio does not affect the name that should be passed into this method)..

$fields Array

-- Optional, if passed then retrieve vardef information on these fields only.

Returns
Type Description
Array 'module_fields' -- Array - The vardef information on the selected fields. 'link_fields' -- Array - The vardef information on the link fields
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicget_note_attachment( String $session, String $id ) : Array

Retrieve an attachment from a note

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

$id String

-- The ID of the appropriate Note.

Returns
Type Description
Array 'note_attachment' -- Array String 'id' -- The ID of the Note containing the attachment String 'filename' -- The file name of the attachment Binary 'file' -- The binary contents of the file. String 'related_module_id' -- module id to which this note is related String 'related_module_name' - module name to which this note is related
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicget_relationships( String $session, String $module_name, String $module_id, String $link_field_name, String $related_module_query, Array $related_fields, Array $related_module_link_name_to_fields_array, \Number $deleted ) : Array

Retrieve a collection of beans that are related to the specified bean and optionally return relationship data for those related beans.

So in this API you can get contacts info for an account and also return all those contact's email address or an opportunity info also.

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

$module_name String

-- The name of the module that the primary record is from. This name should be the name the module was developed under (changing a tab name is studio does not affect the name that should be passed into this method)..

$module_id String

-- The ID of the bean in the specified module

$link_field_name String

-- The name of the lnk field to return records from. This name should be the name the relationship.

$related_module_query String

-- A portion of the where clause of the SQL statement to find the related items. The SQL query will already be filtered to only include the beans that are related to the specified bean. (IGNORED)

$related_fields Array
  • Array of related bean fields to be returned.
$related_module_link_name_to_fields_array Array
  • For every related bean returrned, specify link fields name to fields info for that bean to be returned. For ex.'link_name_to_fields_array' => array(array('name' => 'email_addresses', 'value' => array('id', 'email_address', 'opt_out', 'primary_address'))).
$deleted \Number

-- false if deleted records should not be include, true if deleted records should be included.

Returns
Type Description
Array 'entry_list' -- Array - The records that were retrieved 'relationship_list' -- Array - The records link field data. The example is if asked about accounts contacts email address then return data would look like Array ( [0] => Array ( [name] => email_addresses [records] => Array ( [0] => Array ( [0] => Array ( [name] => id [value] => 3fb16797-8d90-0a94-ac12-490b63a6be67 ) [1] => Array ( [name] => email_address [value] => hr.kid.qa@example.com ) [2] => Array ( [name] => opt_out [value] => 0 ) [3] => Array ( [name] => primary_address [value] => 1 ) ) [1] => Array ( [0] => Array ( [name] => id [value] => 403f8da1-214b-6a88-9cef-490b63d43566 ) [1] => Array ( [name] => email_address [value] => kid.hr@example.name ) [2] => Array ( [name] => opt_out [value] => 0 ) [3] => Array ( [name] => primary_address [value] => 0 ) ) ) ) )
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicget_report_entries( String $session, Array $ids, Array $select_fields ) : Array

Retrieve a list of Reports info based on provided IDs.

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

$ids Array

-- An array of Report IDs.

$select_fields Array

-- A list of the fields to be included in the results. This optional parameter allows for only needed fields to be retrieved.

Returns
Type Description
Array 'field_list' -- Array of Var def information about the returned fields 'entry_list' -- Array of the records that were retrieved
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicget_server_info( ) : Array

Gets server info. This will return information like version, flavor and gmt_time.

Returns
Type Description
Array - flavor - String - Retrieve the specific flavor of sugar. - version - String - Retrieve the version number of Sugar that the server is running. - gmt_time - String - Return the current time on the server in the format 'Y-m-d H:i:s'. This time is in GMT.
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicget_user_id( String $session ) : String

Return the user_id of the user that is logged into the current session.

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

Returns
Type Description
String -- the User ID of the current session
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicget_user_team_id( String $session ) : String

Return the ID of the default team for the user that is logged into the current session.

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

Returns
Type Description
String -- the Team ID of the current user's default team
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpubliclogin( \UserAuth $user_auth, String $application, array $name_value_list ) : Array

Log the user into the application

Parameters
Name Type Description
$user_auth \UserAuth

array $user_auth -- Set user_name and password (password needs to be in the right encoding for the type of authentication the user is setup for. For Base sugar validation, password is the MD5 sum of the plain text password.

$application String

-- The name of the application you are logging in from. (Currently unused).

$name_value_list array

-- Array of name value pair of extra parameters. As of today only 'language' and 'notifyonsave' is supported

Returns
Type Description
Array - id - String id is the session_id of the session that was created. - module_name - String - module name of user - name_value_list - Array - The name value pair of user_id, user_name, user_language, user_currency_id, user_currency_name
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpubliclogout( String $session ) : \Empty

Log out of the session. This will destroy the session and prevent other's from using it.

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

Returns
Type Description
\Empty
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicseamless_login( String $session ) : \1\0

Perform a seamless login. This is used internally during the sync process.

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

Returns
Type Description
\1\0 -- integer - if the session was authenticated-- integer - if the session could not be authenticated
methodpublicsearch_by_module( string $session, string $search_string, \string[] $modules, int $offset, int $max_results ) : Array

Given a list of modules to search and a search string, return the id, module_name, along with the fields We will support Accounts, Bug Tracker, Cases, Contacts, Leads, Opportunities, Project, ProjectTask, Quotes

Parameters
Name Type Description
$session string
  • Session ID returned by a previous call to login.
$search_string string
  • string to search
$modules \string[]
  • array of modules to query
$offset int
  • a specified offset in the query
$max_results int
  • max number of records to return
Returns
Type Description
Array 'entry_list' -- Array('Accounts' => array(array('name' => 'first_name', 'value' => 'John', 'name' => 'last_name', 'value' => 'Do')))
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicset_campaign_merge( String $session, Array $targets, String $campaign_id ) : \-

Once we have successfuly done a mail merge on a campaign, we need to notify Sugar of the targets and the campaign_id for tracking purposes

Parameters
Name Type Description
$session String

session -- Session ID returned by a previous call to login.

$targets Array

targets -- a string array of ids identifying the targets used in the merge

$campaign_id String

campaign_id -- the campaign_id used for the merge

Returns
Type Description
\- No output
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicset_document_revision( String $session, Array $document_revision ) : Array

sets a new revision for this document

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

$document_revision Array

-- Array String 'id' -- The ID of the document object String 'document_name' - The name of the document String 'revision' - The revision value for this revision String 'filename' -- The file name of the attachment String 'file' -- The binary contents of the file.

Returns
Type Description
Array - 'id' - String - document revision id
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicset_entries( String $session, String $module_name, Array $name_value_lists ) : Array

Update or create a list of SugarBeans

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

$module_name String

-- The name of the module to return records from. This name should be the name the module was developed under (changing a tab name is studio does not affect the name that should be passed into this method)..

$name_value_lists Array

-- Array of Bean specific Arrays where the keys of the array are the SugarBean attributes, the values of the array are the values the attributes should have.

Returns
Type Description
Array 'ids' -- Array of the IDs of the beans that was written to (-1 on error)
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicset_entry( String $session, String $module_name, Array $name_value_list ) : Array

Update or create a single SugarBean.

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

$module_name String

-- The name of the module to return records from. This name should be the name the module was developed under (changing a tab name is studio does not affect the name that should be passed into this method)..

$name_value_list Array

-- The keys of the array are the SugarBean attributes, the values of the array are the values the attributes should have.

Returns
Type Description
Array 'id' -- the ID of the bean that was written to (-1 on error)
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicset_note_attachment( String $session, Array $note ) : Array

Add or replace the attachment on a Note.

Optionally you can set the relationship of this note to Accounts/Contacts and so on by setting related_module_id, related_module_name

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

$note Array

'note' -- Array String 'id' -- The ID of the Note containing the attachment String 'filename' -- The file name of the attachment Binary 'file' -- The binary contents of the file. String 'related_module_id' -- module id to which this note to related to String 'related_module_name' - module name to which this note to related to

Returns
Type Description
Array 'id' -- String - The ID of the Note
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicset_relationship( String $session, String $module_name, String $module_id, String $link_field_name, array $related_ids, array $name_value_list, integer $delete ) : Array

Set a single relationship between two beans. The items are related by module name and id.

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

$module_name String

-- name of the module that the primary record is from. This name should be the name the module was developed under (changing a tab name is studio does not affect the name that should be passed into this method)..

$module_id String
  • The ID of the bean in the specified module_name
$link_field_name String

link_field_name -- name of the link field which relates to the other module for which the relationship needs to be generated.

$related_ids array

related_ids -- array of related record ids for which relationships needs to be generated

$name_value_list array

-- The keys of the array are the SugarBean attributes, the values of the array are the values the attributes should have.

$delete integer

-- Optional, if the value 0 or nothing is passed then it will add the relationship for related_ids and if 1 is passed, it will delete this relationship for related_ids

Returns
Type Description
Array - created - integer - How many relationships has been created - failed - integer - How many relationsip creation failed - deleted - integer - How many relationships were deleted
Details
Exception
'SoapFault' -- The SOAP error, if any  
methodpublicset_relationships( String $session, array $module_names, array $module_ids, array $link_field_names, array $related_ids, array $name_value_lists, array $delete_array ) : Array

Set a single relationship between two beans. The items are related by module name and id.

Parameters
Name Type Description
$session String

-- Session ID returned by a previous call to login.

$module_names array

-- Array of the name of the module that the primary record is from. This name should be the name the module was developed under (changing a tab name is studio does not affect the name that should be passed into this method)..

$module_ids array
  • The array of ID of the bean in the specified module_name
$link_field_names array

-- Array of the name of the link field which relates to the other module for which the relationships needs to be generated.

$related_ids array

-- array of an array of related record ids for which relationships needs to be generated

$name_value_lists array

-- Array of Array. The keys of the inner array are the SugarBean attributes, the values of the inner array are the values the attributes should have.

$delete_array array

int $delete_array -- Optional, array of 0 or 1. If the value 0 or nothing is passed then it will add the relationship for related_ids and if 1 is passed, it will delete this relationship for related_ids

Returns
Type Description
Array - created - integer - How many relationships has been created - failed - integer - How many relationsip creation failed - deleted - integer - How many relationships were deleted
Details
Exception
'SoapFault' -- The SOAP error, if any  
Documentation was generated by DocBlox 0.18.1.