id
stringlengths 14
16
| text
stringlengths 33
5.27k
| source
stringlengths 105
270
|
---|---|---|
0419c92f8e19-0
|
SugarQuery Conditions
Overview
Learn about the various methods that can be utilized with SugarQuery to add conditional statements to a query.Â
Where Clause
Manipulating, the WHERE clause of a SugarQuery object is crucial for getting the correct results. To create a WHERE clause on the query, use the where() method on the SugarQuery object, as outlined in the SugarQuery documentation. Once you have the Where object, you can utilize the following methods on the Where object to add conditional statements.
equals() | notEquals()
Used to equate a field to a given value. Wildcards will not work with this function, as it is looking for an exact match.
//add equals
$SugarQuery->where()->equals('name','Test');
//add Not Equals
$SugarQuery->where()->notEquals('name','Tester');
Arguments
Name
Type
Required
Description
$field
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/SugarQuery_Conditions/index.html
|
0419c92f8e19-1
|
Arguments
Name
Type
Required
Description
$field
String
true
The field you are checking againstÂ
$value
String
true
The value the field should be equal to
Returns
SugarQuery_Builder_Where Object
Allows for method chaining on the Where object to add additional conditions.
equalsField() | notEqualsField()
Used to equate a field to another field in the result set.
//add an Equals Field statement
$SugarQuery->where()->equalsField('industry','account_type');
//add a Not Equals Field statement
$SugarQuery->where()->notEqualsField('name','account_type');
Arguments
Name
Type
Required
Description
$field
String
true
The field you are checking againstÂ
$field
String
true
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/SugarQuery_Conditions/index.html
|
0419c92f8e19-2
|
true
The field you are checking againstÂ
$field
String
true
The other field you want the first field to be equal to
Returns
SugarQuery_Builder_Where Object
Allows for method chaining on the Where object to add additional conditions.Â
isEmpty() | isNotEmpty()
Used to check if a field is or isn't empty.
//add an isEmpty statement
$SugarQuery->where()->isEmpty('industry');
//add an isNotEmpty statement
$SugarQuery->where()->isNotEmpty('name');
Arguments
Name
Type
Required
Description
$field
String
true
The field you are checking againstÂ
Returns
SugarQuery_Builder_Where Object
Allows for method chaining on the Where object to add additional conditions.Â
isNull() | notNull()
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/SugarQuery_Conditions/index.html
|
0419c92f8e19-3
|
isNull() | notNull()
Used to check if a field is or isn't equal to NULL.
//add an isNull statement
$SugarQuery->where()->isNull('industry');
//add a notNull statement
$SugarQuery->where()->notNull('name');
Arguments
Name
Type
Required
Description
$field
String
true
The field you are checking againstÂ
Returns
SugarQuery_Builder_Where Object
Allows for method chaining on the Where object to add additional conditions.Â
contains() | notContains()
Used to check if a field has or doesn't have a specified string in its value. Utilizes the LIKE statement, and wildcards on both sides of the provided string.
//add an isNull statement
$SugarQuery->where()->contains('name','Test');
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/SugarQuery_Conditions/index.html
|
0419c92f8e19-4
|
$SugarQuery->where()->contains('name','Test');
//add a notNull statement
$SugarQuery->where()->notContains('industry','Test');
Arguments
Name
Type
Required
Description
$field
String
true
The field you are checking againstÂ
$value
String
true
The string being searched for in the value of the field
Returns
SugarQuery_Builder_Where Object
Allows for method chaining on the Where Object to add additional conditions.Â
starts() | ends()
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/SugarQuery_Conditions/index.html
|
0419c92f8e19-5
|
starts() | ends()
Similar to the above contains() method, these methods use the LIKE statement in the SQL query and wildcards for searching for a specified string in the field's value. However, the starts() and ends() methods only wildcard the right side and the left side, respectively. The following example demonstrates searching for records where the Name field starts with A, and ends with E.
//add an starts and ends statement
$SugarQuery->where()->starts('name','A')->ends('name','e');
Arguments
Name
Type
Required
Description
$field
String
true
The field you are checking againstÂ
$value
String
true
The string being searched for in the value of the field
Returns
SugarQuery_Builder_Where Object
Allows for method chaining on the Where object to add additional conditions.Â
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/SugarQuery_Conditions/index.html
|
0419c92f8e19-6
|
Allows for method chaining on the Where object to add additional conditions.Â
in() | notIn()
Used to check if a field's value is or isn't one of a set of specified values. The following examples look for records where the industry field is in a list of values, and not in a separate list of values.
$values = array(
'Support',
'Sales',
'Engineering'
);
//add in statement
$SugarQuery->where()->in('industry',$values);
$values = array(
'Marketing',
'Accounting'
);
//add NotIn Statement
$SugarQuery->where()->notIn('industry',$values);
Arguments
Name
Type
Required
Description
$field
String
true
The field you are checkingÂ
$values
Array
true
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/SugarQuery_Conditions/index.html
|
0419c92f8e19-7
|
true
The field you are checkingÂ
$values
Array
true
The array of values which the field is being checked against
Returns
SugarQuery_Builder_Where Object
Allows for method chaining on the Where object to add additional conditions.Â
between()
Used primarily for numeric type fields, to check if the value is greater than the minimum number specified and less than the maximum number specified. The following code would check for records where the employees field is between 50 and 1000.
//add Between statement
$SugarQuery->where()->between('employees',50,1000);
Arguments
Name
Type
Required
Description
$field
String
true
The field you are checking againstÂ
$min
Number
true
The lowest number the field's value should be
$max
Number
true
The highest number the field's value should be
Returns
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/SugarQuery_Conditions/index.html
|
0419c92f8e19-8
|
$max
Number
true
The highest number the field's value should be
Returns
SugarQuery_Builder_Where Object
Allows for method chaining on the Where object to add additional conditions.Â
lt() | lte() | gt() | gte()
These methods are primarily for numeric fields, to check if a field's value is less than (<), less than or equal (<=), greater than (>), or greater than or equal (>=) to a specified value.
//Add Less Than Statement
$SugarQuery->where()->lt('gross_revenue',1000000);
//Add Less Than or Equal to Statement
$SugarQuery->where()->lte('net_revenue','500000');
//Add Greater Than Statement
$SugarQuery->where()->gt('gross_revenue',500000);
//Add Greater Than or Equal to Statement
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/SugarQuery_Conditions/index.html
|
0419c92f8e19-9
|
//Add Greater Than or Equal to Statement
$SugarQuery->where()->gte('net_revenue',100000);
Arguments
Name
Type
Required
Description
$field
String
true
The field you are checking againstÂ
$value
Number
true
The numeric value for comparisonÂ
Returns
SugarQuery_Builder_Where Object
Allows for method chaining on the Where object to add additional conditions.Â
dateRange()
Used to check if a field's value is between a preset date range from the current time. See the TimeDate documentation on the available date range keys.
//add DateRange statement
$SugarQuery->where()->dateRange('date_modified','last_30_days');
Arguments
Name
Type
Required
Description
$field
String
true
The field you are checking againstÂ
$value
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/SugarQuery_Conditions/index.html
|
0419c92f8e19-10
|
String
true
The field you are checking againstÂ
$value
String
true
The string specifying the date range key that will be used for comparison. Example 'next_7_days'
Returns
SugarQuery_Builder_Where Object
Allows for method chaining on the Where object to add additional conditions.Â
dateBetween()
To group the query on a field, you can use the corresponding groupBy() method. This method can be called multiple times, to add multiple fields to the grouping of the query.
//add group by
$SugarQuery->where()->dateBetween('date_created',array('2016-01-01','2016-03-01'));
Arguments
Name
Type
Required
Description
$field
String
true
The field you are checking againstÂ
$value
Array
true
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/SugarQuery_Conditions/index.html
|
0419c92f8e19-11
|
true
The field you are checking againstÂ
$value
Array
true
An array containing the minimum date in the first key, and the maximum date in the second.
Returns
SugarQuery_Builder_Where Object
Allows for method chaining on the Where Object to add additional conditions.Â
Combinations
Now that you have reviewed all of the available conditional statements for SugarQuery, you may want to combine them using AND and OR all within the same query. By default when the where() method is called, chained conditional methods will be added with AND to the where clause. You can specify an OR where clause on the main SugarQuery object by using the orWhere() method, which works the same as the where() method, just adds conditional statements with OR instead. The following methods allow for adding internal AND and OR logic to conditional statements on the Where object.
queryAnd()
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/SugarQuery_Conditions/index.html
|
0419c92f8e19-12
|
queryAnd()
To start a group of conditional statements that should all evaluate to True, use the queryAnd() method. For example, if you want to query for Accounts, where the name contains 'Test' AND description contains 'Test', you might use the following code:
$SugarQuery = new SugarQuery();
$SugarQuery->select(array('name'));
$SugarQuery->from(BeanFactory::newBean('Accounts'));
//Using queryAnd
$SugarQuery->where()->queryAnd()->contains('name','Test')->contains('description','Test');
The above use of queryAnd() method isn't entirely needed, as the main Where object would be using AND for all conditions anyway, but it does group the two conditions inside of their own parenthesis in the compiled query, as shown below, to demonstrate how it can be used for altering query logic.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/SugarQuery_Conditions/index.html
|
0419c92f8e19-13
|
SELECT accounts.name name FROM accounts WHERE accounts.deleted = 0 AND (accounts.name LIKE '%Test%' AND accounts.description LIKE '%Test%')
queryOr()
To start a group of conditional statements that should evaluate to true, if any condition is true, you can use the queryOr() method. For example, if you want to query for Accounts, where the name contains 'Test' or where the description contains 'Test', you might use the following code:
$SugarQuery = new SugarQuery();
$SugarQuery->select(array('name'));
$SugarQuery->from(BeanFactory::newBean('Accounts'));
//Using queryOr
$SugarQuery->where()->queryOr()->contains('name','Test')->contains('description','Test');
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/SugarQuery_Conditions/index.html
|
0419c92f8e19-14
|
This will group the two conditions inside of their own parenthesis in the compiled query. If either of the conditions is True, it will return a record. An example is shown below.
SELECT accounts.name name FROM accounts WHERE accounts.deleted = 0 AND (accounts.name LIKE '%Test%' OR accounts.description LIKE '%Test%')
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/SugarQuery_Conditions/index.html
|
552f00edfbe6-0
|
Advanced Techniques
Overview
Learn about some of the advanced methods that SugarQuery has to offer, that are not as commonly used.
Get First Record
Getting the first record in a result set, can be accomplished by using the limit() method. The getOne() method is similar in that it gets the first record, but it also returns the first piece of data for that record.Â
getOne()
Get the first piece of data on the first record returned by the generated query. In this example, we want the 'name' from the Account with a given ID.
$SugarQuery = new SugarQuery();
$SugarQuery->select(array('name'));
$SugarQuery->from(BeanFactory::newBean('Accounts'));
$SugarQuery->where()->equals('id',$id);
//Get the Name of the account
$accountName = $SugarQuery->getOne();
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-1
|
$accountName = $SugarQuery->getOne();
Aggregates
setCountQuery()
Currently, the only method available for creating an aggregate column, is the setCountQuery() method on the SugarQuery_Builder_Select Object. You can add this method to your select() method chain, to add count(0) as record_count to the SQL SELECT statement.
$SugarQuery = new SugarQuery();
$SugarQuery->select(array('name'))->setCountQuery();
$SugarQuery->from(BeanFactory::newBean('Accounts'));
$SugarQuery->groupByRaw('accounts.name');
The above example will output the following prepared statement when using compile():
SELECT accounts.name, COUNT(0) AS record_count FROM accounts WHERE accounts.deleted = ? GROUP BY accounts.name, accounts.name
Parameters
array (
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-2
|
Parameters
array (
[1] => 0
)
Arguments
No arguments
Returns
SugarQuery_Builder_Select Object
Allows for method chaining on the Select Object.
Joins
Joining to tables and joining via SugarBean relationships is outlined in the SugarQuery documentation, however the SugarQuery_Builder_Join Object has a few helpful methods not mentioned there.
joinName()
If you are not using a custom alias for the relationship or table, you may want to retrieve the generated name used by SugarQuery to add a conditions or join to.
$SugarQuery = new SugarQuery();
$SugarQuery->from(BeanFactory::getBean('Accounts'));
$contacts = $SugarQuery->join('contacts')->joinName();
$SugarQuery->select(array("$contacts.full_name"));
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-3
|
$SugarQuery->select(array("$contacts.full_name"));
$SugarQuery->where()->equals('industry', 'Media');
The above example will output the following prepared statement when using compile():
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-4
|
The above example will output the following prepared statement when using compile():
SELECT jt0_contacts.salutation rel_full_name_salutation, jt0_contacts.first_name rel_full_name_first_name, jt0_contacts.last_name rel_full_name_last_name FROM accounts INNER JOIN accounts_contacts jt1_accounts_contacts ON (accounts.id = jt1_accounts_contacts.account_id) AND (jt1_accounts_contacts.deleted = ?) INNER JOIN contacts jt0_contacts ON (jt0_contacts.id = jt1_accounts_contacts.contact_id) AND (jt0_contacts.deleted = ?) WHERE (accounts.industry = ?) AND (accounts.deleted = ?)
Parameters:
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-5
|
Parameters:
array (
[1] => 0
[2] => 0
[3] => Media
[4] => 0
)
Â
Arguments
No arguments
Returns
string
The name used in Query to identify the joined table
Unions
Unions allow joining multiple queries with the same selected fields to be combined during output. You can use Unions in SugarQuery by using the union() method.
union()
To add a union, you can use the corresponding union() method. The example below will join two SQL queries:
//Fetch the bean of the module to query
$bean = BeanFactory::newBean('Accounts');
//Specify fields to fetch
$fields = array(
'id',
'name'
);
//Create first query
$sq1 = new SugarQuery();
$sq1->select($fields);
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-6
|
$sq1 = new SugarQuery();
$sq1->select($fields);
$sq1->from($bean, array('team_security' => false));
$sq1->Where()->in('account_type', array('Customer'));
//Create second query
$sq2 = new SugarQuery();
$sq2->select($fields);
$sq2->from($bean, array('team_security' => false));
$sq2->Where()->in('account_type', array('Investor'));
//Create union
$sqUnion = new SugarQuery();
$sqUnion->union($sq1);
$sqUnion->union($sq2);
$sqUnion->limit(5);
The above example will output the following prepared statement when using compile():
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-7
|
The above example will output the following prepared statement when using compile():
SELECT accounts.id, accounts.name FROM accounts WHERE (accounts.account_type IN (?)) AND (accounts.deleted = ?) UNION ALL SELECT accounts.id, accounts.name FROM accounts WHERE (accounts.account_type IN (?)) AND (accounts.deleted = ?) LIMIT 5
Parameters:
array (
[1] => Customer
[2] => 0
[3] => Investor
[4] => 0
)
Arguments
Name
Type
Required
Description
$selectÂ
SugarQuery
true
The SugarQuery Object you wish to add to the UNION query
$all
Boolean
false
Whether to use UNION ALL or just UNION in the query. The default value is TRUE.
Returns
SugarQuery_Builder_Union Object
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-8
|
Returns
SugarQuery_Builder_Union Object
Allows for method chaining on the Union Object.
Having
When using aggregates in a query, you might want to filter out values based on a condition. SugarQuery provides the having() method for adding HAVING clause to the query.
having()
To use the having() method, you have to build a SugarQuery_Builder_Condition Object and set the field, operator, and value that condition is based on.
$SugarQuery = new SugarQuery();
$SugarQuery->from(BeanFactory::getBean('Accounts'));
$SugarQuery->join('contacts', array('alias' => 'industryContacts'));
$SugarQuery->join('opportunities', array('relatedJoin' => 'industryContacts', 'alias' => 'contactsOpportunities'));
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-9
|
$SugarQuery->select()->setCountQuery();
$SugarQuery->where()->equals('contactsOpportunities.sales_stage', 'closed');
$havingCondition = new SugarQuery_Builder_Condition($SugarQuery);
$havingCondition->setField('contactsOpportunities.amount')->setOperator('>')->setValues('1000');
$SugarQuery->having($havingCondition);
The above example will output the following prepared statement when using compile():
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-10
|
SELECT COUNT(0) AS record_count FROM accounts INNER JOIN accounts_contacts jt0_accounts_contacts ON (accounts.id = jt0_accounts_contacts.account_id) AND (jt0_accounts_contacts.deleted = ?) INNER JOIN contacts industryContacts ON (industryContacts.id = jt0_accounts_contacts.contact_id) AND (industryContacts.deleted = ?) INNER JOIN opportunities_contacts jt1_opportunities_contacts ON jt1_opportunities_contacts.deleted = ? INNER JOIN opportunities contactsOpportunities ON (contactsOpportunities.id = jt1_opportunities_contacts.opportunity_id) AND (contactsOpportunities.deleted = ?) WHERE
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-11
|
AND (contactsOpportunities.deleted = ?) WHERE (contactsOpportunities.sales_stage = ?) AND (accounts.deleted = ?) HAVING contactsOpportunities.amount > ?
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-12
|
Parameters:
array (
[1] => 0
[2] => 0
[3] => 0
[4] => 0
[5] => closed
[6] => 0
[7] => 1000
)
Arguments
Name
Type
Required
Description
$conditionÂ
SugarQuery_Builder_Condition
true
The conditional object used to generate the HAVING clause
Returns
SugarQuery_Builder_Having Object
Allows for method chaining on the Having Object to add additional conditions.
Raw Methods
The SugarQuery Object has a few helper methods that allow raw SQL statement parts to be passed into. This allows for more complex statements or edge case scenarios where a helper function may not have met the requirements for the query.Â
whereRaw()
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-13
|
whereRaw()
To add to the WHERE clause of SugarQuery Object with raw SQL syntax, you can utilize the whereRaw() method. This method will append the specified statement, to the WHERE clause using an AND operator, and will wrap the entire statement in parenthesis. The following is an example use with the output:
$SugarQuery = new SugarQuery();
$SugarQuery->select(array('name'));
$SugarQuery->from(BeanFactory::newBean('Accounts'));
$SugarQuery->whereRaw("name LIKE '%T%'");
The above example will output the following prepared statement when using compile():
SELECT accounts.name FROM accounts WHERE (name LIKE '%T%') AND (accounts.deleted = ?)
Parameters:
array (
[1] => 0
)
Arguments
Name
Type
Required
Description
$sql
String
true
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-14
|
)
Arguments
Name
Type
Required
Description
$sql
String
true
The WHERE clause SQL to be appended to the where clause on the SugarQuery object. All conditions passed in are wrapped in parenthesis and appended using AND (if other conditions exist on where clause).
Returns
SugarQuery_Builder_Where Object
Allows for method chaining on the Where object.
groupByRaw()
To add multiple fields to the GROUP BY statement on the SugarQuery Object, it may be easiest to use the groupByRaw() method.
$SugarQuery = new SugarQuery();
$SugarQuery->select(array('account_type', 'industry'));
$SugarQuery->from(BeanFactory::newBean('Accounts'));
$SugarQuery->groupByRaw("accounts.account_type,accounts.industry");
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-15
|
The above example will output the following prepared statement when using compile():
SELECT accounts.account_type, accounts.industry FROM accounts WHERE accounts.deleted = ? GROUP BY accounts.account_type,accounts.industry
Parameters:
array (
[1] => 0
)
Arguments
Name
Type
Required
Description
$sql
String
true
The GROUP BY statement, without the GROUP BY keyword.Â
Returns
SugarQuery Object
Allows for method chaining on the SugarQuery Object.
orderByRaw()
Using the oderBy() method only allows for adding a single field to the SugarQuery object at a time. In some cases, you might consider using the orderByRaw() method to add multiple fields or the entire ORDER BY statement to the SugarQuery object.Â
$SugarQuery = new SugarQuery();
$SugarQuery->select(array('name'));
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-16
|
$SugarQuery->select(array('name'));
$SugarQuery->from(BeanFactory::newBean('Accounts'));
$SugarQuery->orderByRaw("accounts.name DESC, accounts.date_modified");
The above example will output the following prepared statement when using compile():
SELECT accounts.name FROM accounts WHERE accounts.deleted = ? ORDER BY accounts.name DESC, accounts.date_modified DESC, accounts.id DESC
Parameters:
array (
[1] => 0
)
Arguments
Name
Type
Required
Description
$sql
String
true
The ORDER BY statement, without the ORDER BY keyword.
Returns
SugarQuery Object
Allows for method chaining on the SugarQuery Object.
havingRaw()
Using the havingRaw() method allows for adding a having statement to the SugarQuery object.Â
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-17
|
$SugarQuery = new SugarQuery();
$SugarQuery->from(BeanFactory::getBean('Accounts'));
$SugarQuery->join('contacts', array('alias' => 'industryContacts'));
$SugarQuery->join('opportunities', array('relatedJoin' => 'industryContacts', 'alias' => 'contactsOpportunities'));
$SugarQuery->select()->setCountQuery();
$SugarQuery->where()->equals('contactsOpportunities.sales_stage', 'closed');
$SugarQuery->havingRaw("contactsOpportunities.amount > 1000");
The above example will output the following prepared statement when using compile():
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-18
|
SELECT COUNT(0) AS record_count FROM accounts INNER JOIN accounts_contacts jt0_accounts_contacts ON (accounts.id = jt0_accounts_contacts.account_id) AND (jt0_accounts_contacts.deleted = ?) INNER JOIN contacts industryContacts ON (industryContacts.id = jt0_accounts_contacts.contact_id) AND (industryContacts.deleted = ?) INNER JOIN opportunities_contacts jt1_opportunities_contacts ON jt1_opportunities_contacts.deleted = ? INNER JOIN opportunities contactsOpportunities ON (contactsOpportunities.id = jt1_opportunities_contacts.opportunity_id) AND (contactsOpportunities.deleted = ?) WHERE
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-19
|
AND (contactsOpportunities.deleted = ?) WHERE (contactsOpportunities.sales_stage = ?) AND (accounts.deleted = ?) HAVING contactsOpportunities.amount > 1000
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
552f00edfbe6-20
|
Parameters:
array (
[1] => 0
[2] => 0
[3] => 0
[4] => 0
[5] => closed
[6] => 0
)
Arguments
Name
Type
Required
Description
$sql
String
true
The HAVINGÂ statement, without the HAVINGÂ keyword.
Returns
SugarQuery Object
Allows for method chaining on the SugarQuery Object.Â
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/SugarQuery/Advanced_Techniques/index.html
|
215dc5710dcf-0
|
DBManager
Overview
The DBManager Object provides an interface for working with the database.
Instantiating the DBManager Object
The DBManagerFactory class, located in ./include/database/DBManagerFactory.php, can help instantiate a DBManager object using the getInstance() method.
$db = \DBManagerFactory::getInstance();
For best practices, we recommend using the global DBManager Object:
$GLOBALS['db']
Querying The Database
Sugar supports prepared statements. The following sections outline the legacy usage and the newly prepared statement usage.
SELECT queries
For select queries that do not have a dynamic portion of the where clause, you can use the query()Â method on the DBManager object. For queries that are accepting data passed into the system in the where clause, the following examples demonstrate how best utilize the new Prepared Statement functionality.
Legacy:
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/DBManager/index.html
|
215dc5710dcf-1
|
Legacy:
$id = '1234-abcde-fgh45-6789';
$query = 'SELECT * FROM accounts WHERE id = ' . $GLOBALS['db']->quoted($id);
$results = $GLOBALS['db']->query($query);
Best Practice:
Use the getConnection() method to retrieve a Doctrine Connection Object which handles prepared statements.
$id = '1234-abcde-fgh45-6789';
$query = 'SELECT * FROM accounts WHERE id = ?';
$conn = $GLOBALS['db']->getConnection();
$result = $conn->executeQuery($query, [$id]);
In the case that query logic is variable or conditionally built then it makes sense to use Doctrine QueryBuilder directly.
Legacy:
$query = 'SELECT * FROM accounts';
if ($status !== null) {
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/DBManager/index.html
|
215dc5710dcf-2
|
$query = 'SELECT * FROM accounts';
if ($status !== null) {
$query .= ' WHERE status = ' . $GLOBALS['db']->quoted($status);
}
$results = $GLOBALS['db']->query($query);
Best Practice:
Use the getConnection() method to retrieve the Doctrine Connection Object, and then use the createQueryBuilder() method on the Connection Object to retrieve the QueryBuilder Object.
$builder = $GLOBALS['db']->getConnection()->createQueryBuilder();
$builder->select('*')->from('accounts');
if ($status !== null) {
$builder->where('status = ' . $builder->createPositionalParameter($status));
}
$result = $builder->executeQuery();
Retrieving Results
Legacy:
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/DBManager/index.html
|
215dc5710dcf-3
|
}
$result = $builder->executeQuery();
Retrieving Results
Legacy:
After using the query() method, such as in the Legacy code examples above, you can use the fetchByAssoc() method to retrieve results. The query() method will submit the query and retrieve the results while the fetchByAssoc() method will iterate through the results:
$sql = "SELECT id FROM accounts WHERE deleted = 0";
$result = $GLOBALS['db']->query($sql);
while($row = $GLOBALS['db']->fetchByAssoc($result) )
{
//Use $row['id'] to grab the id fields value
$id = $row['id'];
}
Best Practice:
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/DBManager/index.html
|
215dc5710dcf-4
|
$id = $row['id'];
}
Best Practice:
When using Prepared Statements, both the Doctrine Query Builder and the Doctrine Connection Object will return a Doctrine\DBAL\Result Object to allow iterating through the results of the query. You can use the fetchNumeric() , fetchAssociative() or fetchAllNumeric() or fetchAllAssociative() methods to retrieve results.
fetchAllAssociative() Example
The fetchAllAssociative() method will return the entire result set as an associative array, with each index containing a row of data.
$conn = $GLOBALS['db']->getConnection();
$result = $conn->executeQuery("SELECT * FROM accounts");
foreach ($result->iterateAssociative() as $row) {
$name = $row['name'];
// do something
}
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/DBManager/index.html
|
215dc5710dcf-5
|
$name = $row['name'];
// do something
}
iterateAssociativeIndexed() Example
The iterateAssociativeIndexed() method executes the query and iterate over the result with the key representing the first column and the value is an associative array of the rest of the columns and their values:
$query = 'SELECT id, name FROM accounts';
$conn = $GLOBALS['db']->getConnection();
foreach ($conn->iterateAssociativeIndexed($query) as $id => $data) {
// ...
}
Retrieving a Single Result
To retrieve a single result from the database, such as a specific record field, you can use the getOne() method for Legacy query usage.
$sql = "SELECT name FROM accounts WHERE id = :id";
$conn = $GLOBALS['db']->getConnection();
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/DBManager/index.html
|
215dc5710dcf-6
|
$conn = $GLOBALS['db']->getConnection();
$row = $conn->fetchAssociative($sql, ['id' => $id]);
// alternative
$sql = "SELECT name FROM accounts WHERE id = '{$id}'";
$name = $GLOBALS['db']->getOne($sql);
Limiting Results
To limit the results of a query, you can add a limit to the SQL string or for legacy query usage you can use the limitQuery() method on the DBManager Object:
Legacy:
$sql = "SELECT id FROM accounts WHERE deleted = 0";
$offset = 0;
$limit = 1;
$result = $GLOBALS['db']->limitQuery($sql, $offset, $limit);
while($row = $GLOBALS['db']->fetchByAssoc($result) )
{
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/DBManager/index.html
|
215dc5710dcf-7
|
{
//Use $row['id'] to grab the id fields value
$id = $row['id'];
}
Prepared Statements:
When using the Doctrine Query Builder, you can limit the results of the query by using the setMaxResults() method.
$builder = $GLOBALS['db']->getConnection()->createQueryBuilder();
$builder->select('*')->from('accounts');
if ($status !== null) {
$builder->where('status = ' . $builder->createPositionalParameter($status));
}
$builder->setMaxResults(2);
$result = $builder->executeQuery();
INSERT queries
INSERT queries can be easily performed using DBManager class.
Legacy:
$query = 'INSERT INTO table (foo, bar) VALUES ("foo", "bar")';
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/DBManager/index.html
|
215dc5710dcf-8
|
$GLOBALS['db']->query($query);
Best Practice:
$fieldDefs = $GLOBALS['dictionary']['table']['fields'];
$GLOBALS['db']->insertParams('table', $fieldDefs, ['foo' => 'foo','bar' => 'bar']);
UPDATE queries
When updating records with known IDs or a set of records with simple filtering criteria, then DBManager can be used:
Legacy:
$query = 'UPDATE table SET foo = "bar" WHERE id = ' . $GLOBALS['db']->quoted($id);
$GLOBALS['db']->query($query);
Best Practice:
$fieldDefs = $GLOBALS['dictionary']['table']['fields'];
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/DBManager/index.html
|
215dc5710dcf-9
|
$GLOBALS['db']->updateParams('table', $fieldDefs, ['foo' => 'bar',], ['id' => $id]);
For more complex criteria or when column values contain expressions or references to other fields in the table then Doctrine QueryBuilder can be used.
Legacy:
$query = 'UPDATE table SET foo = "bar" WHERE foo = "foo" OR foo IS NULL';
$GLOBALS['db']->query($query);
Best Practice:
$query = 'UPDATE table SET foo = ? WHERE foo = ? OR foo IS NULL';
$conn = $GLOBALS['db']->getConnection();
$rowCount = $conn->executeStatement($query, ['bar', 'foo']);
Generating SQL Queries from SugarBean
To have Sugar automatically generate SQL queries, you can use the following methods from the bean class.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/DBManager/index.html
|
215dc5710dcf-10
|
Select Queries
To create a select query you can use the create_new_list_query() method:
$bean = BeanFactory::newBean($module);
$order_by = '';
$where = '';
$fields = array(
'id',
'name',
);
$sql = $bean->create_new_list_query($order_by, $where, $fields);
Count Queries
You can also run the generated SQL through the create_list_count_query() method to generate a count query:
$bean = BeanFactory::newBean('Accounts');
$sql = "SELECT * FROM accounts WHERE deleted = 0";
$count_sql = $bean->create_list_count_query($sql);
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Database/DBManager/index.html
|
1a48afb368db-0
|
Subpanels
Overview
For Sidecar, Sugar's subpanel layouts have been modified to work as simplified metadata. This page is an overview of the metadata framework for subpanels.Â
The reason for this change is that previous versions of Sugar generated the metadata from various sources such as the SubPanelLayout and MetaDataManager classes. This eliminates the need for generating and processing the layouts and allows the metadata to be easily loaded to Sidecar.
Note:Â Modules running in backward compatibility mode do not use the Sidecar subpanel layouts as they use the legacy MVC framework.
Hierarchy Diagram
When loading the Sidecar subpanel layouts, the system processes the layout in the following manner:
Note: The Sugar application's client type is "base". For more information on the various client types, please refer to the User Interface page.
Subpanels and Subpanel Layouts
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Subpanels/index.html
|
1a48afb368db-1
|
Subpanels and Subpanel Layouts
Sugar contains both a subpanels (plural) layout and a subpanel (singular) layout. The subpanels layout contains the collection of subpanels, whereas the subpanel layout renders the actual subpanel widget.
An example of a stock module's subpanels layout is:
./modules/Bugs/clients/base/layouts/subpanels/subpanels.php
<?php
$viewdefs['Bugs']['base']['layout']['subpanels'] = array (
'components' => array (
array (
'layout' => 'subpanel',
'label' => 'LBL_DOCUMENTS_SUBPANEL_TITLE',
'context' => array (
'link' => 'documents',
),
),
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Subpanels/index.html
|
1a48afb368db-2
|
'link' => 'documents',
),
),
array (
'layout' => 'subpanel',
'label' => 'LBL_CONTACTS_SUBPANEL_TITLE',
'context' => array (
'link' => 'contacts',
),
),
array (
'layout' => 'subpanel',
'label' => 'LBL_ACCOUNTS_SUBPANEL_TITLE',
'context' => array (
'link' => 'accounts',
),
),
array (
'layout' => 'subpanel',
'label' => 'LBL_CASES_SUBPANEL_TITLE',
'context' => array (
'link' => 'cases',
),
),
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Subpanels/index.html
|
1a48afb368db-3
|
'link' => 'cases',
),
),
),
'type' => 'subpanels',
'span' => 12,
);
You can see that the layout incorporates the use of the subpanel layout for each module. As most of the subpanel data is similar, this approach allows us to use less duplicate code. The subpanel layout, shown below, shows the three views that make up the subpanel widgets users see.
./clients/base/layouts/subpanel/subpanel.php
<?php
$viewdefs['base']['layout']['subpanel'] = array (
'components' => array (
array (
'view' => 'panel-top',
)
array (
'view' => 'subpanel-list',
),
array (
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Subpanels/index.html
|
1a48afb368db-4
|
'view' => 'subpanel-list',
),
array (
'view' => 'list-bottom',
),
),
'span' => 12,
'last_state' => array(
'id' => 'subpanel'
),
);
Adding Subpanel Layouts
When a new relationship is deployed from Studio, the relationship creation process will generate the layouts using the extension framework. You should note that for stock relationships and custom deployed relationships, layouts are generated for both Sidecar and Legacy MVC Subpanel formats. This is done to ensure that any related modules, whether in Sidecar or Backward Compatibility mode, display a related subpanel as expected.
Sidecar Layouts
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Subpanels/index.html
|
1a48afb368db-5
|
Sidecar Layouts
Custom Sidecar layouts, located in ./custom/Extension/modules/<module>/Ext/clients/<client>/layouts/subpanels/, are compiled into ./custom/modules/<module>/Ext/clients/<client>/layouts/subpanels/subpanels.ext.php using the extension framework. When a relationship is saved, layout files are created for both the "base" and "mobile" client types.
For example, deploying a 1:M relationship from Bugs to Leads will generate the following Sidecar files:
./custom/Extension/modules/Bugs/Ext/clients/base/layouts/subpanels/bugs_leads_1_Bugs.php
<?php
$viewdefs['Bugs']['base']['layout']['subpanels']['components'][] = array (
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Subpanels/index.html
|
1a48afb368db-6
|
'layout' => 'subpanel',
'label' => 'LBL_BUGS_LEADS_1_FROM_LEADS_TITLE',
'context' =>
array (
'link' => 'bugs_leads_1',
),
);
./custom/Extension/modules/Bugs/Ext/clients/mobile/layouts/subpanels/bugs_leads_1_Bugs.php
<?php
$viewdefs['Bugs']['mobile']['layout']['subpanels']['components'][] = array (
'layout' => 'subpanel',
'label' => 'LBL_BUGS_LEADS_1_FROM_LEADS_TITLE',
'context' =>
array (
'link' => 'bugs_leads_1',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Subpanels/index.html
|
1a48afb368db-7
|
array (
'link' => 'bugs_leads_1',
),
);
Note: The additional legacy MVC layouts generated by a relationships deployment are described below.
Legacy MVC Subpanel Layouts
Custom Legacy MVC Subpanel layouts, located in ./custom/Extension/modules/<module>/Ext/Layoutdefs/, are compiled into ./custom/modules/<module>/Ext/Layoutdefs/layoutdefs.ext.php using the extension framework. You should also note that when a relationship is saved, wireless layouts, located in ./custom/Extension/modules/<module>/Ext/WirelessLayoutdefs/, are created and compiled into ./custom/modules/<module>/Ext/Layoutdefs/layoutdefs.ext.php.
An example of this is when deploying a 1-M relationship from Bugs to Leads, the following layoutdef files are generated:
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Subpanels/index.html
|
1a48afb368db-8
|
./custom/Extension/modules/Bugs/Ext/Layoutdefs/bugs_leads_1_Bugs.php
<?php
$layout_defs["Bugs"]["subpanel_setup"]['bugs_leads_1'] = array (
'order' => 100,
'module' => 'Leads',
'subpanel_name' => 'default',
'sort_order' => 'asc',
'sort_by' => 'id',
'title_key' => 'LBL_BUGS_LEADS_1_FROM_LEADS_TITLE',
'get_subpanel_data' => 'bugs_leads_1',
'top_buttons' =>
array (
0 =>
array (
'widget_class' => 'SubPanelTopButtonQuickCreate',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Subpanels/index.html
|
1a48afb368db-9
|
array (
'widget_class' => 'SubPanelTopButtonQuickCreate',
),
1 =>
array (
'widget_class' => 'SubPanelTopSelectButton',
'mode' => 'MultiSelect',
),
),
);
./custom/Extension/modules/Bugs/Ext/WirelessLayoutdefs/bugs_leads_1_Bugs.php
<?php
$layout_defs["Bugs"]["subpanel_setup"]['bugs_leads_1'] = array (
'order' => 100,
'module' => 'Leads',
'subpanel_name' => 'default',
'title_key' => 'LBL_BUGS_LEADS_1_FROM_LEADS_TITLE',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Subpanels/index.html
|
1a48afb368db-10
|
'get_subpanel_data' => 'bugs_leads_1',
);
Fields Metadata
Sidecar's subpanel field layouts are initially defined by the subpanel list-view metadata.
Hierarchy Diagram
The subpanel list metadata is loaded in the following manner:
Note: The Sugar application's client type is "base". For more information on the various client types, please refer to the User Interface page.
Subpanel List Views
By default, all modules come with a default set of subpanel fields for when they are rendered as a subpanel. An example of this is can be found in the Bugs module:
./modules/Bugs/clients/base/views/subpanel-list/subpanel-list.php
<?php
$subpanel_layout['list_fields'] = array (
'full_name' =>
array (
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Subpanels/index.html
|
1a48afb368db-11
|
'full_name' =>
array (
'type' => 'fullname',
'link' => true,
'studio' =>
array (
'listview' => false,
),
'vname' => 'LBL_NAME',
'width' => '10%',
'default' => true,
),
'date_entered' =>
array (
'type' => 'datetime',
'studio' =>
array (
'portaleditview' => false,
),
'readonly' => true,
'vname' => 'LBL_DATE_ENTERED',
'width' => '10%',
'default' => true,
),
'refered_by' =>
array (
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Subpanels/index.html
|
1a48afb368db-12
|
),
'refered_by' =>
array (
'vname' => 'LBL_LIST_REFERED_BY',
'width' => '10%',
'default' => true,
),
'lead_source' =>
array (
'vname' => 'LBL_LIST_LEAD_SOURCE',
'width' => '10%',
'default' => true,
),
'phone_work' =>
array (
'vname' => 'LBL_LIST_PHONE',
'width' => '10%',
'default' => true,
),
'lead_source_description' =>
array (
'name' => 'lead_source_description',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Subpanels/index.html
|
1a48afb368db-13
|
array (
'name' => 'lead_source_description',
'vname' => 'LBL_LIST_LEAD_SOURCE_DESCRIPTION',
'width' => '10%',
'sortable' => false,
'default' => true,
),
'assigned_user_name' =>
array (
'name' => 'assigned_user_name',
'vname' => 'LBL_LIST_ASSIGNED_TO_NAME',
'widget_class' => 'SubPanelDetailViewLink',
'target_record_key' => 'assigned_user_id',
'target_module' => 'Employees',
'width' => '10%',
'default' => true,
),
'first_name' =>
array (
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Subpanels/index.html
|
1a48afb368db-14
|
),
'first_name' =>
array (
'usage' => 'query_only',
),
'last_name' =>
array (
'usage' => 'query_only',
),
'salutation' =>
array (
'name' => 'salutation',
'usage' => 'query_only',
),
);
To modify this layout, navigate to Admin > Studio > {Parent Module} > Subpanels > Bugs and make your changes. Once saved, Sugar will generate ./custom/modules/Bugs/clients/<client>/views/subpanel-for-<link>/subpanel-for-<link>.php which will be used for rendering the fields you selected.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Subpanels/index.html
|
1a48afb368db-15
|
You should note that, just as Sugar mimics the Sidecar layouts in the legacy MVC framework for modules in backward compatibility, it also mimics the field list in ./modules/<module>/metadata/subpanels/default.php and ./custom/modules/<module>/metadata/subpanels/default.php. This is done to ensure that any related modules, whether in Sidecar or Backward Compatibility mode, display the same field list as expected.
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Subpanels/index.html
|
67bbc2cd8d8d-0
|
Modules
Overview
How modules are defined and used within the system
Module Definitions
The module definitions, defined in ./include/modules.php, determine how modules are displayed and used throughout the application. Any custom metadata, whether from a plugin or a custom module, should be loaded through the Include extension. Prior to 6.3.x, module definitions could be added by creating the file ./include/modules_override.php. This method of creating module definitions is still compatible but is not recommended from a best practices standpoint.Â
Hierarchy Diagram
The modules metadata are loaded in the following manner:
$moduleList
The $moduleList is an array containing a list of modules in the system. The format of the array is to have a numeric index and a value of the modules unique key.
$moduleList[] = 'Accounts';
$beanList
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Modules/index.html
|
67bbc2cd8d8d-1
|
$moduleList[] = 'Accounts';
$beanList
The $beanList variable is an array that stores a list of all active beans (modules) in the application. The format of the array is array('<bean plural name>' => '<bean singular name>');. The $beanList key is used to lookup values in the $beanFiles variable.
$beanList['Accounts'] = 'Account';
$beanFiles
The $beanFiles variable is an array used to reference the class files for a bean. The format of the array is array('<bean singular name>' => '<relative class file>');. The bean name, stored in singular form, is a reference to the class name of the object, which is looked up from the $beanList 'key'.
$beanFiles['Account'] = 'modules/Accounts/Account.php';
$modInvisList
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Modules/index.html
|
67bbc2cd8d8d-2
|
$modInvisList
The $modInvisList variable removes a module from the navigation tab in the MegaMenu, reporting, and it's subpanels under related modules.To enable a hidden module for reporting, you can use $report_include_modules. To enable a hidden modules subpanels on related modules, you can use $modules_exempt_from_availability_check. TheÂ
$modInvisList[] = 'Prospects';
$modules_exempt_from_availability_check
The $modules_exempt_from_availability_check variable is used in conjunction with $modInvisList. When a module has been removed from the MegaMenu view with $modInvisList, this will allow for the display of the modules subpanels under related modules.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Modules/index.html
|
67bbc2cd8d8d-3
|
$modules_exempt_from_availability_check['OAuthKeys'] = 'OAuthKeys';
$report_include_modules
 The $report_include_modules variable is used in conjunction with $modInvisList. When a module has been hidden with $modInvisList, this will allow for the module to be enabled for reporting.
$report_include_modules['Prospects'] = 'Prospect';
$adminOnlyList
The $adminOnlyList variable is an extra level of security for modules that are can be accessed only by administrators through the Admin page. Specifying all will restrict all actions to be admin only.
$adminOnlyList['PdfManager'] = array(
'all' => 1
);
$bwcModules
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Modules/index.html
|
67bbc2cd8d8d-4
|
'all' => 1
);
$bwcModules
The $bwcModules variable determines which modules are in backward compatibility mode. More information on backward compatibility can be found in the Backward Compatibility section.
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Modules/index.html
|
76209d3901ad-0
|
Relationships
Overview
Relationships are the basis for linking information within the system. This page explains the various aspects of relationships. For information on custom relationships, please refer to the Custom Relationships documentation.
Definitions
Relationships are initially defined in the module's vardefs file under the relationships array. For reference, you can find them using the vardef path ./modules/<module>/vardefs.php.
Database Structure
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Relationships/index.html
|
76209d3901ad-1
|
Database Structure
In Sugar, most relationships are stored using a joining table. This applies to both one-to-many (1:M) relationships as well as many-to-many (M:M) relationships. An example of this is the relationship between Accounts and Opportunities where there are three tables: accounts, accounts_opportunities, and opportunities. You will find that the joining table, accounts_opportunities, will contain the fields needed in order to establish the relationship link.
The fields on the accounts_opportunities table are listed below:
Fields
Description
id
A unique identifier for the relationship row (not typically used)
opportunity_id
The ID for the related opportunity record. This is named uniquely based on the relationship
account_id
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Relationships/index.html
|
76209d3901ad-2
|
account_id
The ID for the related account record. This is named uniquely based on the relationship
date_modified
The date the row was last modified
deleted
Whether or not the relationship still exists
Relationship Cache
All relationships in Sugar are compiled into the cache directory ./cache/Relationships/relationships.cache.php. If needed, the relationships cache can be rebuilt by navigating to Admin > Repair > Rebuild Relationships.
TopicsCustom RelationshipsThis page needs an overview
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Relationships/index.html
|
f867468fb5f3-0
|
Custom Relationships
Overview
This page needs an overview
Creating Custom Relationships
Relationships are initially defined in the module's vardefs file under the relationships array. For reference, you can find them using the vardef path as follows:
./modules/<module>/vardefs.php
Custom relationships are created in a different way using the Extension Framework. The process requires two steps which are explained in the following sections:
Defining the Relationship MetaData
Defining the Relationship in the TableDictionary
Defining the Relationship MetaData
The definitions for custom relationships will be found in a path similar to:
./custom/metadata/<relatonship name>MetaData.php
This file will contain the $dictionary information needed for the system to generate the relationship. The $dictionary array will contain the following:
Index
Type
Description
true_relationship_type
String
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Relationships/Custom_Relationships/index.html
|
f867468fb5f3-1
|
Index
Type
Description
true_relationship_type
String
The relationship's structure (possible values: 'one-to-many' or 'many-to-many')
from_studio
Boolean
Whether the relationship was created in Studio
table
String
The name of the table that is created in the database to contain the link ids
fields
Array
An array of fields to be created on the relationship join table
indices
Array
The list of indexes to be created
relationships
Array
An array defining relationships
relationships.<rel>
Array
The array defining the relationship
relationships.<rel>.lhs_module
String
Left-hand module (should match $beanList index)
relationships.<rel>.lhs_table
String
Left-hand table name
relationships.<rel>.lhs_key
String
The key to use from the table on the left
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Relationships/Custom_Relationships/index.html
|
f867468fb5f3-2
|
String
The key to use from the table on the left
relationships.<rel>.rhs_module
String
Right-hand module (should match $beanList index)
relationships.<rel>.rhs_table
String
Right-hand table name
relationships.<rel>.rhs_key
String
The key to use from the table on the right
relationships.<rel>.relationship_type
String
The relationship type, typically stored as 'many-to-many'
relationships.<rel>.join_table
String
The join table
relationships.<rel>.join_key_lhs
String
Left table key, should exist in table field definitions above
relationships.<rel>.join_key_rhs
String
Right table key, should exist in table field definitions above
MetaData Example
Creating a custom 1:M relationship between Accounts and Contacts will yield the following metadata file:
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Relationships/Custom_Relationships/index.html
|
f867468fb5f3-3
|
Creating a custom 1:M relationship between Accounts and Contacts will yield the following metadata file:
./custom/metadata/accounts_contacts_1MetaData.php
<?php
// created: 2013-09-20 15:15:47
$dictionary["accounts_contacts_1"] = array (
'true_relationship_type' => 'one-to-many',
'from_studio' => true,
'relationships' =>
array (
'accounts_contacts_1' =>
array (
'lhs_module' => 'Accounts',
'lhs_table' => 'accounts',
'lhs_key' => 'id',
'rhs_module' => 'Contacts',
'rhs_table' => 'contacts',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Relationships/Custom_Relationships/index.html
|
f867468fb5f3-4
|
'rhs_table' => 'contacts',
'rhs_key' => 'id',
'relationship_type' => 'many-to-many',
'join_table' => 'accounts_contacts_1_c',
'join_key_lhs' => 'accounts_contacts_1accounts_ida',
'join_key_rhs' => 'accounts_contacts_1contacts_idb',
),
),
'table' => 'accounts_contacts_1_c',
'fields' =>
array (
0 =>
array (
'name' => 'id',
'type' => 'varchar',
'len' => 36,
),
1 =>
array (
'name' => 'date_modified',
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Relationships/Custom_Relationships/index.html
|
f867468fb5f3-5
|
1 =>
array (
'name' => 'date_modified',
'type' => 'datetime',
),
2 =>
array (
'name' => 'deleted',
'type' => 'bool',
'len' => '1',
'default' => '0',
'required' => true,
),
3 =>
array (
'name' => 'accounts_contacts_1accounts_ida',
'type' => 'varchar',
'len' => 36,
),
4 =>
array (
'name' => 'accounts_contacts_1contacts_idb',
'type' => 'varchar',
'len' => 36,
),
),
'indices' =>
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Relationships/Custom_Relationships/index.html
|
f867468fb5f3-6
|
),
),
'indices' =>
array (
0 =>
array (
'name' => 'accounts_contacts_1spk',
'type' => 'primary',
'fields' =>
array (
0 => 'id',
),
),
1 =>
array (
'name' => 'accounts_contacts_1_ida1',
'type' => 'index',
'fields' =>
array (
0 => 'accounts_contacts_1accounts_ida',
),
),
2 =>
array (
'name' => 'accounts_contacts_1_alt',
'type' => 'alternate_key',
'fields' =>
array (
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Relationships/Custom_Relationships/index.html
|
f867468fb5f3-7
|
'fields' =>
array (
0 => 'accounts_contacts_1contacts_idb',
),
),
),
);
Defining the Relationship in the TableDictionary
Once a relationship's metadata has been created, the metadata file will have a reference placed in the TableDictionary:
./custom/Extension/application/Ext/TableDictionary/<relationship name>.php
This file will contain an 'include' reference to the metadata file:
<?php
include('custom/metadata/<relationship name>MetaData.php');
?>
TableDictionary Example
The custom 1:M relationship between Accounts and Contacts will yield the following TableDictionary file:
./custom/Extension/application/Ext/TableDictionary/accounts_contacts_1.php
<?php
//WARNING: The contents of this file are auto-generated
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Relationships/Custom_Relationships/index.html
|
f867468fb5f3-8
|
<?php
//WARNING: The contents of this file are auto-generated
include('custom/metadata/accounts_contacts_1MetaData.php');
?>
If you have created the relationship through Studio, the files above will be automatically created. If you are manually creating the files, run a Quick Repair and Rebuild and run any SQL scripts generated. The Quick Repair and Rebuild will rebuild the file map and relationship cache as well as populate the relationship in the relationships table.
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Data_Framework/Relationships/Custom_Relationships/index.html
|
1752ad426ce1-0
|
Integration
Overview
How to integrate with Sugar APIs
TopicsBest PracticesBest practices when integrating and migrating Sugar.Web ServicesDocumentation on Sugar Web Service APIs.ExternalResourceClientDocumentation on ExternalResourceClient, which replaces cURL.MigrationInformation on migrating data and Sugar instances.
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/index.html
|
bd537fde4923-0
|
Web Services
Overview
Web Services allow for communication between different applications and platforms. Sugar currently supports REST and SOAP APIs. The following sections will outline how to interact with the APIs and what versions of the API we recommend for use.
Versioning
API versioning is the process of creating a new set of API endpoints for new functionality while leaving pre-existing endpoints available for third-party applications and integrations to continue using. This helps to extend the application in an upgrade-safe manner.
Quick Reference
When working with the Web Service API, you should be using the latest REST API specific to your release. A quick reference of this can be found below:
Release1
REST Version
REST URL
SOAP Version2
SOAP URL
13.0.x
v11.20
/rest/v11_20/
v4.1
/service/v4_1/soap.php
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/index.html
|
bd537fde4923-1
|
v4.1
/service/v4_1/soap.php
12.3.x
v11.19
/rest/v11_19/
v4.1
/service/v4_1/soap.php
12.2.x
v11.18
/rest/v11_18/
v4.1
/service/v4_1/soap.php
12.1.x
v11.17
/rest/v11_17/
v4.1
/service/v4_1/soap.php
12.0.x
v11.16
/rest/v11_16/
v4.1
/service/v4_1/soap.php
11.3.x
v11.15
/rest/v11_15/
v4.1
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/index.html
|
bd537fde4923-2
|
v11.15
/rest/v11_15/
v4.1
/service/v4_1/soap.php
11.2.x
v11.14
/rest/v11_14/
v4.1
/service/v4_1/soap.php
11.1.x
v11.13
/rest/v11_13/
v4.1
/service/v4_1/soap.php
11.0.x
v11.12
/rest/v11_12/
v4.1
/service/v4_1/soap.php
10.3.x
v11.11
/rest/v11_11/
v4.1
/service/v4_1/soap.php
10.2.x
v11.10
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/index.html
|
bd537fde4923-3
|
10.2.x
v11.10
/rest/v11_10/
v4.1
/service/v4_1/soap.php
10.1.x
v11.9
/rest/v11_9/
v4.1
/service/v4_1/soap.php
10.0.x
v11.8
/rest/v11_8/
v4.1
/service/v4_1/soap.php
9.3.x
v11.7
/rest/v11_7/
v4.1
/service/v4_1/soap.php
9.2.x
v11.6
/rest/v11_6/
v4.1
/service/v4_1/soap.php
9.1.x
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/index.html
|
bd537fde4923-4
|
/service/v4_1/soap.php
9.1.x
v11.5
/rest/v11_5/
v4.1
/service/v4_1/soap.php
9.0.x
v11.4
/rest/v11_4/
v4.1
/service/v4_1/soap.php
8.3.x
v11.4
/rest/v11_4/
v4.1
/service/v4_1/soap.php
8.2.x
v11.3
/rest/v11_3/
v4.1
/service/v4_1/soap.php
8.1.x
v11.2
/rest/v11_2/
v4.1
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/index.html
|
bd537fde4923-5
|
v11.2
/rest/v11_2/
v4.1
/service/v4_1/soap.php
8.0.x
v11.1
/rest/v11_1/
v4.1
/service/v4_1/soap.php
7.11.x
v11
/rest/v11/
v4.1
/service/v4_1/soap.php
7.10.x
v11
/rest/v11/
v4.1
/service/v4_1/soap.php
7.9.x
v10
/rest/v10/
v4.1
/service/v4_1/soap.php
7.8.x
v10
/rest/v10/
v4.1
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/index.html
|
bd537fde4923-6
|
v10
/rest/v10/
v4.1
/service/v4_1/soap.php
7.7.x
v10
/rest/v10/
v4.1
/service/v4_1/soap.php
6.5.x
v4.1
/service/v4_1/rest.php
v4.1
/service/v4_1/soap.php
1 Some of the releases in this table may no longer be officially-supported Sugar versions, but we have included them for archival purposes. For more information, please refer to the Supported Versions resource page. 2 As of Sugar 7.0, SOAP support is no longer offered with the new APIs. The legacy APIs will remain accessible in the product, however, any existing integrations should be updated to use the latest REST endpoints.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/index.html
|
bd537fde4923-7
|
TopicsREST APIv10 - v11.20 API documentation.Legacy APIv1 - v4.1 API documentation.
Last modified: 2023-04-05 00:07:43
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/index.html
|
2e68d0eb06bb-0
|
This API has been succeeded by a new version. It is recommended to upgrade to the latest API.
Legacy API
Overview
v1 - v4.1 APIÂ documentation.
SOAP VS REST
There are significant differences between how the legacy REST and SOAP protocols function on an implementation level (e.g. Performance, response size, etc). Deciding which protocol to use is up to the individual developer and is beyond the scope of this guide. Starting in SugarCRM version 6.2.0, there are some deviations between the protocols with the v4 API. There are additional core calls that are only made available through the REST protocol. They are listed below:
get_module_layout
get_module_layout_md5
get_quotes_pdf method
get_report_pdf method
snip_import_emails
snip_update_contacts
job_queue_cycle
job_queue_next
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/Legacy_API/index.html
|
2e68d0eb06bb-1
|
snip_update_contacts
job_queue_cycle
job_queue_next
job_queue_run
oauth_access method
oauth_access_token
oauth_request_token
REST
REST stands for 'Representational State Transfer'. This protocol is used by Sugar to exchange information both internally and externally.
How do I access the REST service?
The legacy REST services in SugarCRM and be found by navigating to:
http://{site url)/service/{version}/rest.php
Where 'site url' is the URL of your Sugar instance and 'version' is the latest version of the API specific to your release of Sugar. You can find out more about versioning in the Web Services documentation.
Input / Output Datatypes
The default input / output datatype for REST is JSON / PHP serialize.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/Legacy_API/index.html
|
2e68d0eb06bb-2
|
The default input / output datatype for REST is JSON / PHP serialize.
These datatype files, SugarRestJSON.php and SugarRestSerialize.php, are in:
./service/core/REST/
Defining your own Datatypes
You can also define you own datatype. To do this, you need to create a new file such as:
./service/core/REST/SugarRest<CustomDataType>.php
Next, you will need to override generateResponse() and serve() functions. The Serve function decodes or unserializes the appropriate datatype based on the input type; the generateResponse function encodes or serializes it based on the output type.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/Legacy_API/index.html
|
2e68d0eb06bb-3
|
See service/test.html for more examples on usage. In this file, the getRequestData function, which generates URL with json, is both the input_type and the response_type. That is, the request data from the JavaScript to the server is JSON and response data from server is also JSON. You can mix and match any datatype as input and output. For example, you can have JSON as the input_type and serialize as the response_type based on your application's requirements.
REST Failure Response
If a call failure should occur, the result will be as shown below:
Name
Type
Description
name
String
Error message.
number
Integer
Error number.
description
String
Description of error.
SOAP
SOAP stands for 'Simple Object Access Protocol'. SOAP is a simple XML-based protocol that is used to allow applications to exchange information.
How do I access the SOAP service?
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/Legacy_API/index.html
|
2e68d0eb06bb-4
|
How do I access the SOAP service?
The legacy SOAP service in SugarCRM and be found by navigating to:
http://{sugar_url)/service/{version}/soap.php
Where 'sugar_url' is the url of your Sugar instance and 'version' is the latest version of the API specific to your release of Sugar. You can find out more about versioning in the section titled 'API: Versioning'. The default WSDL is formatted as rpc/encoded.
WS-I 1.0 Compliancy
Sugar supports generating a URL that is WS-I compliant. When accessing the soap entry point, you can access the WSDL at:
http://{sugar_url)/service/{version}/soap.php?wsdl
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/Legacy_API/index.html
|
2e68d0eb06bb-5
|
By default, the WSDL is formatted as rpc/encoded, however, this can be changed by specifying a 'style' and 'use' url-paramater. An example of this is:
http://{sugar_url)/service/{version}/soap.php?wsdl&style=rpc&use=literal
URL Parameters
style
rpc
use
encoded
literal
Validation
This WSDL (rpc/literal) was successfully verified against Apache CXF 2.2.
SOAP Failure Response
If a call failure should occur, the result will be as shown below:
Name
Type
Description
faultcode
Integer
Fault ID.
faultactor
String
Provides information about what caused the fault to happen.
faultstring
String
Fault Message.
detail
String
Description of fault.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/Legacy_API/index.html
|
2e68d0eb06bb-6
|
faultstring
String
Fault Message.
detail
String
Description of fault.
TopicsWhat is NuSOAP?NuSOAP is a SOAP Toolkit for PHP that doesn't require PHP extensions.MethodsWeb Service Method Calls.REST Release NotesLists changes between the different versions of the REST API.SOAP Release NotesLists changes between the different versions of the SOAP API.SugarHttpClientThe SugarHttpClient class is used to make REST calls.
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/Legacy_API/index.html
|
3e00018ef0d9-0
|
This API has been succeeded by a new version. It is recommended to upgrade to the latest API.
What is NuSOAP?
Overview
NuSOAP is a SOAP Toolkit for PHP that doesn't require PHP extensions.
Where Can I Get It?
NuSOAP can be downloaded from http://nusoap.sourceforge.net
How Do I Use It?
After you have downloaded NuSOAP, you will need to extract the zip file contents to a storage directory. Once extracted, you will reference "lib/nusoap.php" in your PHP SOAP application.
Example
<?php
//require NuSOAP
require_once("./lib/nusoap.php");
//retrieve WSDL
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/Legacy_API/What_is_NuSOAP/index.html
|
3e00018ef0d9-1
|
//retrieve WSDL
$client = new nusoap_client("http://{site_url}/service/v4/soap.php?wsdl", 'wsdl');
Â
Â
Last modified: 2023-02-03 21:04:03
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/Legacy_API/What_is_NuSOAP/index.html
|
fb1763d242d0-0
|
This API has been succeeded by a new version. It is recommended to upgrade to the latest API.
REST Release Notes
Overview
Lists changes between the different versions of the REST API.
Release Notes
v4_1
get_modified_relationships method was added.
get_relationships had the parameter $limit added.
get_relationships had the parameter $offset added.
v4
get_entries had the parameter $track_view removed.
job_queue_cycle method was added.
job_queue_next method was added.
job_queue_run method was added.
oauth_access method was added.
oauth_access_token method was added.
oauth_request_token method was added.
search_by_module had the parameter $favorites added.
snip_import_emails method was added.
snip_update_contacts method was added.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/Legacy_API/REST_Release_Notes/index.html
|
fb1763d242d0-1
|
snip_update_contacts method was added.
v3_1
get_entries had the parameter $track_view added.
get_entry had the parameter $track_view added.
get_entry_list had the parameter $favorites added.
get_language_definition method was added.
get_module_layout had the parameter $acl_check added.
get_module_layout_md5 had the parameter $acl_check added.
get_quotes_pdf method was added.
get_report_pdf method was added.
search_by_module had the parameter $unified_search_only added.
set_entry had the parameter $track_view added.
v3
get_available_modules had the parameter $filter added.
get_last_viewed method was added.
get_module_fields_md5 method was added.
|
https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_13.0/Integration/Web_Services/Legacy_API/REST_Release_Notes/index.html
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.