Skip to content

Instantly share code, notes, and snippets.

View mtetlow's full-sized avatar

Mike "Mikename" Tetlow mtetlow

  • AscendX
  • Denver CO
View GitHub Profile
/*
Copyright (c) 2015, salesforce.com, inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
/*
Copyright (c) 2015, salesforce.com, inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of salesforce.com, inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
{
"ApexClass": [
"NamespacePrefix"
],
"ApexPage": [
"Id",
"Name"
],
"CollaborationGroup": [
"CollaborationType",
sObject sObj = Schema.getGlobalDescribe().get('Account').newSObject();
sObject sObj2 = Schema.getGlobalDescribe().get('Account').newSObject();
List<sObject> sObjList = new List<sObject>();
sObjList.add(sObj);
sObjList.add(sObj2);
List<Account> accountList = (List<Account>)sObjList;
upsert accountList;
//Results in
System.TypeException: DML on generic List only allowed for insert, update or delete
var WrappedCalendar = React.createClass({
mixins:[
require('react-onclickoutside'),
],
handleClickOutside: function(e){
this.props.hideDatePicker();
},
render: function(){
return(
<Calendar value={this.props.deadlineDate} onChange={this.props.dateChanged} footer={true} />
@RemoteAction
global static boardInfoWrapper toggleFollowTask(string taskId){
//Find if there is a current record
//Need to use without sharing
List<EntitySubscription> existingList = trControllerWithoutSharing.queryWithoutSharing('Select e.SubscriberId, e.ParentId From EntitySubscription e WHERE e.SubscriberId=\''+String.escapeSingleQuotes(UserInfo.getUserId())+'\' AND e.ParentId=\''+String.escapeSingleQuotes(taskId)+'\' LIMIT 1000');
//If no, insert a new one
if(existingList.size()==0){
EntitySubscription follow = new EntitySubscription (parentId = taskId,subscriberid = UserInfo.getUserId());
Map<String, Schema.SObjectField> fields = Schema.SObjectType.EntitySubscription.fields.getMap();
if(fields.get('NetworkId')!=null){
@mtetlow
mtetlow / gist:f33788b9de2e7c54cb01
Created December 22, 2014 15:55
Canvas Resize junk
<!-- include this fella -->
<script type='text/javascript' src='/canvas/sdk/js/publisher.js'></script>
<script>
//Call whenever you do something that results in a frame resize, and probably on load
function resizeIframe(){
var containerHeight = document.getElementById('checklist-container').clientHeight;
Sfdc.canvas.publisher.resize( {height : containerHeight+'px'});
}
</script>
@mtetlow
mtetlow / gist:3cc4551173a263022d16
Created December 5, 2014 14:50
example of field describes to get a field name
Schema.DescribeSObjectResult d = Schema.getGlobalDescribe().get('Task').getDescribe();
Map<String,sObjectField> fields = d.fields.getMap();
for (String f : fields.keyset() ) {
Schema.DescribeFieldResult dfr = fields.get(f).getDescribe();
//system.debug(JSON.serialize(dfr));
system.debug(dfr.Name);
}
<script>
document.addEventListener('DOMContentLoaded', pageFullyLoaded, false);
function pageFullyLoaded(){
var body = document.body,
html = document.documentElement;
var height = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight );
alert(height);
Sfdc.canvas.publisher.resize( {height : height+'px'});
}
</script>
if (!showWarning(this)) return false;bannerText=null;;A4J.AJAX.Submit('j_id0:j_id12',event,{'similarityGroupingId':'j_id0:j_id12:objectTable:213:j_id25','parameters':{'j_id0:j_id12:objectTable:213:j_id25':'j_id0:j_id12:objectTable:213:j_id25'} } )