Please rate how useful you found this document: 
No votes yet

Overview

Warning: The Sugar CRM Triggers wizard is being deprecated.

SugarCRM is a web-based customer relations management (CRM) tool that facilitates the use of customer support, marketing and sales business roles by bringing them together under a unified software system. This allows customer relations specialists to quickly and efficiently deal with a wide range of customer demands.

Although SugarCRM can be accessed through a website, its functionalities have been integrated with ProcessMaker, meaning that users can manage SugarCRM modules from within ProcessMaker through a web service connection.

The communication between ProcessMaker and SugarCRM application can be successfully created using the 11 triggers added within ProcessMaker; amongst those we can find:

Each one of them are explained in detail in the guide below.

How it works

In the image below, you can see the option to create SugarCRM triggers from ProcessMaker (For example create an account), which affects directly to the SugarCRM Environment.

But, what do we need in order to create SugarCRM triggers in ProcessMaker?. As we mentioned before, the communication can be achieved using SugarCRM web services, so make sure you have a valid web service URL. A valid URL has the following structure:

http://<sugarCRM_URL>/soap.php?wsdl

Depending on the Sugar installation some will have the web service inside a folder:

http://<sugarCRM_URL>/sugarcrm/soap.php?wsdl

Just to make sure, copy the link in a web browser and you must have the XML definition for the web service:

Requirements

  • ProcessMaker v. 3.0 and later
  • SugarCRM v. 6.5.x and later

Glossary

Source: http://forums.sugarcrm.com

Account

A record representing a customer or a business. An account contains information such as the customer’s name, address and phone number.

Contact

A person who may be associated with a possible sales opportunity or with an account.

Lead

An early contact in the sales process who has not yet been evaluated or qualified to be a contact.

Opportunity

A specific selling opportunity or sales deal that you have identified and qualified. Opportunities progress through sales stages such as Qualification, Negotiation and Closed Won, and have an amount and an expected close date associated with them for purposes of forecasting the amount of sales that will close during a time period.

SugarCRM Triggers

ProcessMaker works with the following SugarCRM Triggers:

CreateSugarAccount()

CreateSugarAccount(): Creates SugarCRM entries from the Account module.

Function Definition

string CreateSugarAccount(string sugarSoap, string user, string password, string name, string $resultType="array")

Parameters

  • sugarSoap: Sugar SOAP URL. For example: http://www.example.com/sugar/soap.php?wsdl
  • user: User name who is used to log on SugarCRM.
  • password: Password which corresponds to the user name given in a previous field.
  • name: Give the account a name to have it created in SugarCRM.
  • resultType: The result could be either an array or an object with the list of all account elements.

Return Value

The variable to hold return value returns the Sugar Account ID.

Example: Follow the next steps to implement the CreateSugarAccount() trigger in ProcessMaker. Let's create a Sugar account from information filled in a ProcessMaker Dynaform:

  1. Create the Dynaform based on the trigger parameters, since those variables will be used in the trigger. Depending on your process design, and the permission your users have over your Sugar server information, you can create Dynaform fields, Sugar User and Sugar Server Password as the image shown, to let your users fill those fields with your Sugar Server information. If you do not want to give that information to your users, you can fill the information of both fields inside your trigger.

  2. Create the trigger by going to Triggers > Wizard > SugarCRM triggers.

  3. Click over Creates SugarCRM entries from the Account module and you see the following trigger definition:

  4. If you click Edit Source Code, you see the following definition to add some additional code:

    $res = CreateSugarAccount("http://example/sugarcrm/soap.php?wsdl", @@SugarUserName, @@SugarUserPassword, @@SugarAccountName, "array");

    Note: If you edit the trigger source code, then you won't be able to come back to the trigger definition.

  5. Add the trigger after the Dynaform.

  6. Run your process and fill the information in the Dynaform:

  7. After clicking the Create Account button, the account is created. To verify this login in SugarCRM, go to the Accounts tab, you will see the account created:

CreateSugarContact()

CreateSugarContact(): Creates SugarCRM entries from the Contacts module.

Function Definition

string CreateSugarContact(string sugarSoap, string user, string password, string first_name, string last_name, string email, string title, string phone, string account_id, string resultType = "array")

Parameters

  • sugarSoap: Sugar SOAP URL. eg. http://www.example.com/sugar/soap.php?wsdl
  • user: User name who is used to log on SugarCRM.
  • password: Password which corresponds to the user name given in a previous field.
  • first_name: Give the contact a first name.
  • last_name: Give the contact a last name.
  • email: Add a contact's email.
  • title: Add the contact's job title.
  • phone: Add the contact's phone number.
  • account_id: Add a valid customer number.
  • resultType: The result could be either an array or an object with the list of all contact elements.

Return Value

The variable to hold return value returns the created contact.

Example: Follow the next steps to implement the CreateSugarContact() trigger in ProcessMaker. Let's create a Sugar account from information filled in a ProcessMaker Dynaform:

  1. Create the Dynaform based on the trigger parameters, since those variables will be used in the trigger. Depending on your process design and the permission your users have over your Sugar server information, you can create Dynaform fields, Sugar User and Sugar Server Password as the image shown, to let your users fill those fields with your Sugar Server information. If you do not want to give that information to your users, you can fill the information of both fields inside your trigger.

  2. Create the trigger by going to Triggers > Wizard > SugarCRM triggers.

  3. Click over Creates SugarCRM entries from the Contacts module and you see the following trigger definition:

  4. If you click Edit Source Code, you see the following definition to add some additional code:

    $accountresult = CreateSugarContact("http://example/sugarcrm/soap.php?wsdl", @@SugarUserName, @@SugarUserPassword, @@SugarFirstName, @@SugarLastName, @@SugarEmail, @@SugarTitle, @@SugarPhoneWork, @@SugarIDaccount, "array");

    Note: If you edit the trigger source code, then you won't be able to come back to the trigger definition.

  5. Add the trigger after the Dynaform.

  6. Run a case and fill the information in the Dynaform:

  7. After clicking the Create Account button, the contact is created. To verify this login in SugarCRM, go to the Contacts tab, you will see the user you've created, in this example John Smith was created successfully:

CreateSugarLeads()

CreateSugarLeads(): Creates SugarCRM entries from the Leads module.

Function Definition

string CreateSugarLeads(string sugarSoap, string user, string password, string first_name, string last_name, string email, string title, string phone, string account_id, string resultType = "array")

Parameters

  • sugarSoap: Sugar SOAP URL. eg. http://www.example.com/sugar/soap.php?wsdl
  • user: User name who is used to log on SugarCRM.
  • password: Password which corresponds to the user name given in a previous field.
  • first_name: Give the contact a first name.
  • last_name: Give the contact a last name.
  • email: Add a contact's email.
  • title: Add the contact's job title.
  • phone: Add the contact's phone number.
  • account_id: Add a valid customer number.
  • resultType: The result could be an array or an object with the list of all lead elements.

Return Value

The variable to hold return value returns the creation of a sugar lead.

Example: Follow the next steps to implement the CreateSugarLeads() trigger in ProcessMaker. Let's create a Sugar lead from information filled in a ProcessMaker Dynaform:

  1. Create the Dynaform based on the trigger parameters, since those variables will be used in the trigger. Depending on your process design, and the permission your users have over your Sugar server information, you can create Dynaform fields, Sugar User and Sugar Server Password as the image shown, to let your users fill those fields with your Sugar Server information. If you do not want to give that information to your users, you can fill the information of both fields inside your trigger.

  2. Create the trigger by going to Triggers > Wizard > SugarCRM triggers.

  3. Click over Creates SugarCRM entries from the Leads module and you see the following trigger definition:

  4. If you click Edit Source Code, you see the following definition to add some additional code:

    @@return = CreateSugarLeads("http://example.com/sugarcrm/soap.php?wsdl", @@SugarUserName, @@SugarUserPassword, @@SugarFirstName, @@SugarLastName, @@SugarEmail, @@SugarTitle, @@SugarPhoneWork, @@SugarCustomerNumber, "array");

    Note: If you edit the trigger source code, then you won't be able to come back to the trigger definition.

  5. Add the trigger after the Dynaform.

  6. Run a case and fill out the Create Sugar Lead Dynaform:

  7. After clicking the Create The Lead button, the lead is created. To verify this, login in SugarCRM. Go to Leads tab, you will see the user you've created, in this example Elizabeth Brown was created successfully:

CreateSugarOpportunity()

CreateSugarOpportunity(): Creates SugarCRM entries from the Opportunities module.

Function Definition

string CreateSugarOpportunity(string sugarSoap, string user, string password, string name, string account_id, string email, string title, string phone, string amount, string date_closed, string sales_stage, string resultType="array")

Parameters

  • sugarSoap: Sugar SOAP URL. eg. http://www.example.com/sugar/soap.php?wsdl
  • user: User name who is used to log on SugarCRM.
  • password: Password which corresponds to the user name given in a previous field.
  • name: Opportunity Name.
  • account_id: Add a valid customer number.
  • amount Introduce the opportunity amount.
  • date_closed Define the date when the opportunity was closed.
  • sales_stage Choose amongst one of the stages: Prospecting, Qualification, Needs Analysis, Value Proposition, Id. Decision Makers, Perception Analysis, Proposal/Price Quote, Negotiation/Review, Closed Won, Closed Lost.
  • resultType The result could be an array or an object with the list of all opportunity elements.

Return Value

The variable to hold return value returns the creation of a Sugar Opportunity.

Example: Follow the next steps to implement the CreateSugarOpportunity() trigger in ProcessMaker. Let's create a Sugar lead from information filled in a ProcessMaker Dynaform:

  1. Create the Dynaform based on the trigger parameters, since those variables will be used in the trigger. Depending on your process design, and the permission your users have over your Sugar server information, you can create Dynaform fields, Sugar User and Sugar Server Password as the image shown, to let your users fill those fields with your Sugar Server information. If you do not want to give that information to your users, you can fill the information of both fields inside your trigger.

  2. Create the trigger by going to Triggers > Wizard > SugarCRM triggers.

  3. Click over Creates SugarCRM entries from the Leads module and you see the following trigger definition:

  4. If you click Edit Source Code, you see the following definition to add some additional code:

    @@return = CreateSugarOpportunity("http://serverSoapUrl/sugarcrm/soap.php?wsdl", @@SugarUser, @@SugarServerPassword, @@OpportunityName, @@CustomerNumber, @@OpportunityAmount, @@DataClosed, @@SalesStage, "array");

    Note: If you edit the trigger source code, then you won't be able to come back to the trigger definition.

  5. Add the trigger after the Dynaform.

  6. Run a case and fill out the Create Sugar Opportunity Dynaform:

  7. After clicking the Submit button, the opportunity is created. To verify this, login in SugarCRM. Go to Opportunities tab, you will see the new opportunity created:

GetSugarAccount()

GetSugarAccount() gets SugarCRM entries from the Account module.

Function Definition

string GetSugarAccount(string sugarSoap, string user, string password, string query, string orderBy, string selectedFields, string maxResults, string resultType="array")

Parameters

  • sugarSoap: Sugar SOAP URL. For example: http://www.example.com/sugar/soap.php?wsdl
  • user: User name who is used to log on SugarCRM.
  • password: Password which corresponds to the user name given in a previous field.
  • query: The SQL WHERE clause without the word where.
  • orderBy: The SQL ORDER BY clause without the phrase order by.
  • selectedFields: A list of fields to include in the results.
  • maxResults: The maximum number of results to return. It is 50 by default. This parameter is optional.
  • resultType: The result could be an array or an object with the list of all account elements. This parameter is optional.

Return Value

The variable to hold return value returns an array/object of the Sugar accounts.

Example: Follow the next steps to implement the GetSugarAccount() trigger in ProcessMaker:

  1. Create the trigger by going to Triggers > Wizard > SugarCRM triggers.

  2. Click over Gets SugarCRM entries from the Account module and you see the following trigger definition:

  3. After saving the new Sugar trigger, if you click Edit Source Code, you see the following definition to add some additional code:

    @&Accounts = GetSugarCalls("http://serverSoapUrl/sugar/soap.php?wsdl", @@SugarUser, @@SugarServerPassword, @@Query, @@OrderBy, @@SelectedFields, @@MaxResults, "object");

    Note: If you edit the trigger source code, then you won't be able to come back to the trigger definition.

  4. Add the trigger before the Dynaform to display results in Dynaform controls.

  5. Use the @&Accounts object variable result in a trigger to display in a Dynaform, in a template or in conditions.

GetSugarCalls()

GetSugarCalls() gets SugarCRM entries from the Calls module.

Function Definition

string GetSugarCalls(string sugarSoap, string user, string password, string query, string orderBy, string selectedFields, string maxResults, string resultType="array")

Parameters

  • sugarSoap: Sugar SOAP URL. For example: http://www.example.com/sugar/soap.php?wsdl
  • user: User name who is used to log on SugarCRM.
  • password: Password which corresponds to the user name given in a previous field.
  • query: The SQL WHERE clause without the word where.
  • orderBy: The SQL ORDER BY clause without the phrase order by.
  • selectedFields: A list of fields to include in the results.
  • maxResults: The maximum number of results to return. It is 50 by default. This parameter is optional.
  • resultType: The result could be an array or an object with the list of all call elements. This parameter is optional.

Return Value

The variable to hold return value returns an array/object of the Sugar calls.

Example: Follow the next steps to implement the GetSugarCalls() trigger in ProcessMaker:

  1. Create the trigger by going to Triggers > Wizard > SugarCRM triggers.

  2. Click over Gets SugarCRM entries from the Calls module and you see the following trigger definition:

  3. After saving the new Sugar trigger, if you click Edit Source Code, you see the following definition to add some additional code:

    @&Calls = GetSugarCalls("http://serverSoapUrl/sugar/soap.php?wsdl", @@SugarUser, @@SugarServerPassword, @@Query, @@OrderBy, @@SelectedFields, @@MaxResults, "object");

    Note: If you edit the trigger source code, then you won't be able to come back to the trigger definition.

  4. Add the trigger before the Dynaform to display results in Dynaform controls.

  5. Use the @&Calls object variable result in a trigger to display in a Dynaform, in a template or in conditions.

GetSugarContacts()

GetSugarContacts() gets SugarCRM entries from the Contacts module.

Function Definition

string GetSugarContacts(string sugarSoap, string user, string password, string query, string orderBy, string selectedFields, string maxResults, string resultType="array")

Parameters

  • sugarSoap: Sugar SOAP URL. For example: http://www.example.com/sugar/soap.php?wsdl
  • user: User name who is used to log on SugarCRM.
  • password: Password which corresponds to the user name given in a previous field.
  • query: The SQL WHERE clause without the word where.
  • orderBy: The SQL ORDER BY clause without the phrase order by.
  • selectedFields: A list of fields to include in the results.
  • maxResults: The maximum number of results to return. It is 50 by default. This parameter is optional.
  • resultType: The result could be an array or an object with the list of all contact elements. This parameter is optional.

Return Value

The variable to hold return value returns an array/object of the Sugar contacts.

Example: Follow the next steps to implement the GetSugarContacts() trigger in ProcessMaker:

  1. Create the trigger by going to Triggers > Wizard > SugarCRM triggers.

  2. Click over Gets SugarCRM entries from the Contacts module and you see the following trigger definition:

  3. After saving the new Sugar trigger, if you click Edit Source Code, you see the following definition to add some additional code:

    @&Contacts = GetSugarContacts("http://serverSoapUrl/sugar/soap.php?wsdl", @@SugarUser, @@SugarServerPassword, @@Query, @@OrderBy, @@SelectedFields, @@MaxResults, "object");

    Note: If you edit the trigger source code, then you won't be able to come back to the trigger definition.

  4. Add the trigger before the Dynaform to display results in Dynaform controls.

  5. Use the @&Contacts object variable result in a trigger to display in a Dynaform, in a template or in conditions.

GetSugarEntries()

GetSugarEntries() gets SugarCRM entries from the indicated module.

Function Definition

string GetSugarEntries(string sugarSoap, string user, string password, string module, string query, string orderBy, string selectedFields, string maxResults, string resultType="array")

Parameters

  • sugarSoap: Sugar SOAP URL. For example: http://www.example.com/sugar/soap.php?wsdl
  • user: User name who is used to log on SugarCRM.
  • password: Password which corresponds to the user name given in a previous field.
  • module: The name of the module from which to retrieve records.
  • query: The SQL WHERE clause without the word where.
  • orderBy: The SQL ORDER BY clause without the phrase order by.
  • selectedFields: A list of fields to include in the results.
  • maxResults: The maximum number of results to return. It is 50 by default. This parameter is optional.
  • resultType: The result could be an array or an object with the list of all entry elements. This parameter is optional.

Return Value

The variable to hold return value returns an array/object of the Sugar entries.

Example: Follow the next steps to implement the GetSugarEntries() trigger in ProcessMaker:

  1. Create the trigger by going to Triggers > Wizard > SugarCRM triggers.

  2. Click over Get SugarCRM Entries and you see the following trigger definition:

  3. After saving the new Sugar trigger, if you click Edit Source Code, you see the following definition to add some additional code:

    @&Entries = GetSugarEntries("http://serverSoapUrl/sugar/soap.php?wsdl", @@SugarUser, @@SugarServerPassword, @@Module, @@Query, @@OrderBy, @@SelectedFields, @@MaxResults, "object");

    Note: If you edit the trigger source code, then you won't be able to come back to the trigger definition.

  4. Add the trigger before a Dynaform to display results in Dynaform controls.

  5. Use the @&Entries object variable result in a trigger to display in a Dynaform, in a template or in conditions.

GetSugarEntry()

GetSugarEntry() gets SugarCRM entries by ID from the indicated module.

Function Definition

string GetSugarEntry(string sugarSoap, string user, string password, string module, string id, string selectedFields, string linkNameToFieldsArray, string resultType="array")

Parameters

  • sugarSoap: Sugar SOAP URL. For example: http://www.example.com/sugar/soap.php?wsdl
  • user: User name who is used to log on SugarCRM.
  • password: Password which corresponds to the user name given in a previous field.
  • module: The name of the module from which to retrieve records.
  • id: A SugarBean ID.
  • selectedFields: A list of fields to include in the results.
  • linkNameToFieldsArray: A list of link names and the fields to be returned for each link name.
  • resultType: The result could be an array or an object with the list of all entry elements. This parameter is optional.

Return Value

The variable to hold return value returns an array/object of the Sugar entries.

Example: Follow the next steps to implement the GetSugarEntry() trigger in ProcessMaker:

  1. Create the trigger by going to Triggers > Wizard > SugarCRM triggers.

  2. Click over Get SugarCRM Entry and you see the following trigger definition:

  3. After saving the new Sugar trigger, if you click Edit Source Code, you see the following definition to add some additional code:

    @&Entry = GetSugarEntry("http://serverSoapUrl/sugar/soap.php?wsdl", @@SugarUser, @@SugarServerPassword, @@Module, @@SugarBeanID, @@SelectedFields, @@LinkNameToFieldsArray, "object");

    Note: If you edit the trigger source code, then you won't be able to come back to the trigger definition.

  4. Add the trigger before a Dynaform to display results in Dynaform controls.

  5. Use the @&Entry object variable result in a trigger to display in a Dynaform, in a template or in conditions.

GetSugarLeads()

GetSugarLeads() gets SugarCRM entries from the Leads module.

Function Definition

string GetSugarLeads(string sugarSoap, string user, string password, string query, string orderBy, string selectedFields, string maxResults, string resultType="array")

Parameters

  • sugarSoap: Sugar SOAP URL. For example: http://www.example.com/sugar/soap.php?wsdl
  • user: User name who is used to log on SugarCRM.
  • password: Password which corresponds to the user name given in a previous field.
  • query: The SQL WHERE clause without the word where.
  • orderBy: The SQL ORDER BY clause without the phrase order by.
  • selectedFields: A list of fields to include in the results.
  • maxResults: The maximum number of results to return. It is 50 by default. This parameter is optional.
  • resultType: The result could be an array or an object with the list of all lead elements. This parameter is optional.

Return Value

The variable to hold return value returns an array/object of the Sugar leads.

Example: Follow the next steps to implement the GetSugarLeads() trigger in ProcessMaker:

  1. Create the trigger by going to Triggers > Wizard > SugarCRM triggers.

  2. Click over Gets SugarCRM entries from the Leads module and you see the following trigger definition:

  3. After saving the new Sugar trigger, if you click Edit Source Code, you see the following definition to add some additional code:

    @&Leads = GetSugarLeads("http://serverSoapUrl/sugar/soap.php?wsdl", @@SugarUser, @@SugarServerPassword, @@Query, @@OrderBy, @@SelectedFields, @@MaxResults, "object");

    Note: If you edit the trigger source code, then you won't be able to come back to the trigger definition.

  4. Add the trigger before the Dynaform to display results in Dynaform controls.

  5. Use the @&Leads object variable result in a trigger to display in a Dynaform, in a template or in conditions.

GetSugarOpportunities()

GetSugarOpportunities() gets SugarCRM entries from the Opportunities module.

Function Definition

string GetSugarOpportunities(string sugarSoap, string user, string password, string query, string orderBy, string selectedFields, string maxResults, string resultType="array")

Parameters

  • sugarSoap: Sugar SOAP URL. For example: http://www.example.com/sugar/soap.php?wsdl
  • user: User name who is used to log on SugarCRM.
  • password: Password which corresponds to the user name given in a previous field.
  • query: The SQL WHERE clause without the word where.
  • orderBy: The SQL ORDER BY clause without the phrase order by.
  • selectedFields: A list of fields to include in the results.
  • maxResults: The maximum number of results to return. It is 50 by default. This parameter is optional.
  • resultType: The result could be an array or an object with the list of all opportunity elements. This parameter is optional.

Return Value

The variable to hold return value returns an array/object of the Sugar opportunities.

Example: Follow the next steps to implement the GetSugarOpportunities() trigger in ProcessMaker:

  1. Create the trigger by going to Triggers > Wizard > SugarCRM triggers.

  2. Click over Gets SugarCRM entries from the Opportunities module and you see the following trigger definition:

  3. After saving the new Sugar trigger, if you click Edit Source Code, you see the following definition to add some additional code:

    @&Opportunities = GetSugarOpportunities("http://serverSoapUrl/sugar/soap.php?wsdl", @@SugarUser, @@SugarServerPassword, @@Query, @@OrderBy, @@SelectedFields, @@MaxResults, "object");

    Note: If you edit the trigger source code, then you won't be able to come back to the trigger definition.

  4. Add the trigger before the Dynaform to display results in Dynaform controls.

  5. Use the @&Opportunities object variable result in a trigger to display in a Dynaform, in a template or in conditions.