Skip to content

Instantly share code, notes, and snippets.

/*
* Copyright Strategic Sales Systems 2011
* Customization to write an email to the selected records on the mainview.
*/
define({
/**
* Open an email using Outlook automation, if available, falling back to mailto url otherwise.
* @param {Array|String} recipient email address (or addresses)
*/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css"
media="screen" />
</head>
<body>
<h1 id="qunit-header">
QUnit example</h1>
@nicocrm
nicocrm / gist:858086
Created March 7, 2011 04:50
SalesForce Apex CSV Parser
/**
* Used to read a delimited file.
*/
public class SSSCsvReader {
private String delim = ',';
// the input data
private String[] buffer;
public SSSCsvReader(String data){
this.buffer = data.split('\n');
@nicocrm
nicocrm / gist:858089
Created March 7, 2011 04:52
CSV Reader Test
@isTest
private class SSSCsvReaderTest {
static testmethod void testSplitCsvSimple(){
String line = 'abc,efg';
String[] splitted = new SSSCsvReader(line).readLine();
System.assertEquals(2, splitted.size());
System.assertEquals('efg', splitted[1]);
System.assertEquals('abc', splitted[0]);
}
function () {
// Execute the "Copy" method on each selected record
var grid = this;
// check that we have a selection
var selectedItems = grid.selection.getSelected();
if (selectedItems.length < 1) {
alert(grid.noSelectionsText);
return;
}
ICAccWidget nw = Sage.Platform.EntityFactory.Create();
nw.Account = caccwidget.Account;
nw.WIdget_name = caccwidget.WIdget_name;
nw.Quantity = caccwidget.Quantity;
nw.Price = caccwidget.Price;
nw.Save();
@nicocrm
nicocrm / GetCampaignResponsesPaged.cs
Created April 5, 2012 16:41
GetCampaignResponsesPaged
public class CampaignResponse
{
public String Id { get; set; }
public String ContactId { get; set; }
}
public List<CampaignResponse> GetCampaignResponses(String campaignId)
{
List<CampaignResponse> result = new List<CampaignResponse>();
GetCampaignResponsesPaged(campaignId, result, 1);
<?xml version="1.0"?>
<ContextualListConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<TargetPages>
<TargetConfigInfo>
<TargetPage>CONTACT</TargetPage>
<ReferingPages>
<ContextConditionInfo>
<ReferringPage>ACCOUNT</ReferringPage>
<DataPath>CONTACT:ACCOUNTID</DataPath>
<ConditionValue>ReferringId</ConditionValue>
<TargetConfigInfo>
<TargetPage>C_OPP_BRAND</TargetPage>
<ReferingPages>
<ContextConditionInfo>
<ReferringPage>OPPORTUNITY</ReferringPage>
<DataPath>C_OPP_BRAND:OPPORTUNITYID</DataPath>
<ConditionValue>ReferringId</ConditionValue>
</ContextConditionInfo>
</ReferingPages>
</TargetConfigInfo>
Pseudo code for SyncTarget method:
sourceDigest = get_digest_from_feed(syncSource)
targetDigest = GetDigest()
for each entry in syncSource:
gcon = retrieve_contact_from_google (entry)
if gcon == null:
create_google_contact(entry)
else: