Skip to content

Instantly share code, notes, and snippets.

@chicks
chicks / get_entry.rb
Created October 26, 2012 04:28
SugarCRM REST API Relationship Traversal
get_entry: Request:
{
"session": "c8866a5a2d855a774c5609d45f3a2906",
"module_name": "Opportunities",
"id": "10635fec-bb2e-2260-d8f7-4ffc80aeef8d",
"select_fields": ["id","name","date_entered","date_modified","modified_user_id","modified_by_name","created_by","created_by_name","description","deleted","assigned_user_id","assigned_user_name","team_id","team_set_id","team_count","team_name","opportunity_type","account_name","account_id","campaign_id","campaign_name","lead_source","amount","amount_usdollar","currency_id","currency_name","currency_symbol","date_closed","next_step","sales_stage","probability"],
"link_name_to_fields_array": []
}
get_entry: JSON Response:
#! /usr/bin/env ruby
string = "6_7_0-nutmeg-build_fix"
regex = /([0-9])_([0-9])_([0-9])-([^-].*)-([^-].*)/
string =~ regex
puts [$1,$2,$3].join("_") + ("-",$4,".dev").join('')
@chicks
chicks / db2_test.php
Last active October 13, 2015 15:48
SugarCRM on DB2
<?php
// Use this to test connectivity to db2. Useful for checking IIS permissions
$database = 'DATABASE=SUGARCRM;HOSTNAME=localhost;PORT=50000;PROTOCOL=TCPIP;UID=db2admin;PWD=Sugar123!;';
$conn = db2_connect($database, '', '');
if ($conn) {
echo "Connection succeeded.";
db2_close($conn);
@chicks
chicks / create_user.rb
Created December 10, 2012 20:59
Example of how to create a SugarCRM User via REST
#! /usr/bin/env ruby
require 'digest/md5'
require 'rubygems'
require 'sugarcrm'
SugarCRM.connect("http://localhost:8888/sugarcrm", "admin", "letmein", :debug => true)
user = SugarCRM::User.new
user.email1 = "[email protected]"
@chicks
chicks / greppage.sh
Last active December 11, 2015 06:28
Zend Framework Library Usage in SugarCRM
# grep -R require * | grep -i zend | grep -v '^Zend'
custom/modules/Schedulers/ConnectionsActivityStreamPublisherJob.php: require_once('Zend/Http/client.php');
include/externalAPI/Google/ExtAPIGoogle.php:require_once('Zend/Gdata/Docs.php');
include/externalAPI/Google/ExtAPIGoogle.php:require_once('Zend/Gdata/Docs/Query.php');
include/externalAPI/Google/ExtAPIGoogle.php:require_once('Zend/Gdata/ClientLogin.php');
include/externalAPI/Google/ExtAPIGoogle.php:require_once('Zend/Gdata/Contacts.php');
include/SugarCache/SugarCacheZend.php: * requirements.
include/SugarCache/SugarCacheZend.php:require_once('include/SugarCache/SugarCacheAbstract.php');
include/SugarOauth.php: require_once 'Zend/Oauth/Consumer.php';
modules/OAuthKeys/OAuthKey.php:require_once 'Zend/Oauth/Provider.php';
<?php
// Server in the this format: <computer>\<instance name> or
// <server>,<port> when using a non default port number
$server = 'localhost';
$user = 'sa';
$pass = 'password';
// Connect to MSSQL
$link = mssql_connect($server, $user, $pass);
@chicks
chicks / gist:5258166
Created March 27, 2013 21:26
Rename Cells, Nodes on WAS 7
ConnectionsCell01
ConnectionsCellManager01
ConnectionsNode01
ConnectionsNode02
AdminConfig.list('Server')
dmgr(
cells/ip-10-172-50-218Cell01/
nodes/ConnectionsCellManager01/
servers/dmgr|server.xml#Server_1
@chicks
chicks / add_and_remove_user_from_role.json
Last active December 17, 2015 03:29
Manipulate Roles for a Sugar User
// Add user to Standard Role
set_relationship: Request:
{
"session": "ok01qfmdj0fihe5mlbddjsbj61",
"module_name": "ACLRoles",
"module_id": "323ce5f6-b090-8cbd-e9c1-518ab8951821", // Role ID
"link_field_name": "users",
"related_ids": ["1af1e378-9126-ffa9-a026-518a9bdd6177"], // User ID
"name_value_list": [],
"delete": 0
@chicks
chicks / layoutdefs.ext.php
Last active December 17, 2015 03:38
Limit which subpanels are displayed by a custom field on User
<?php
// Put this in: custom/modules/Accounts/Layoutdefs/layoutdefs.ext.php
global $current_user;
$edition = $current_user->edition_c;
if ( $edition == "Basic" ) {
unset($layout_defs['Accounts']['subpanel_setup']['documents']);
unset($layout_defs['Accounts']['subpanel_setup']['quotes']);
}
@chicks
chicks / en_us_lang.php
Last active December 17, 2015 04:18
Programmatically Change Dropdowns in Sugar
// custom/include/language/en_us.lang.php
$GLOBALS['app_list_strings']['sales_stage_dom']=array (
'Prospecting' => 'Prospecting',
'Qualification' => 'Qualification',
'Needs Analysis' => 'Needs Analysis',
'Value Proposition' => 'Value Proposition',
'Id. Decision Makers' => 'Id. Decision Makers',
'Perception Analysis' => 'Perception Analysis',
'Proposal/Price Quote' => 'Proposal/Price Quote',
'Negotiation/Review' => 'Negotiation/Review',