• DanielJimenez
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 49
    Replies

I noticed with the Spring 12 release that the ref ID sent out on case to email messages has changed. For example what used to be ref:00DAXvQ8.500A9s4mg:ref is now ref:_00DA0XvQ8._500A09s4mg:ref. 

 

My old formula for building this code was:

 

"ref:"&LEFT( $Organization.Id , 4 )&RIGHT( $Organization.Id , 4 )&"."&LEFT( Id , 4 )&RIGHT( Id , 5 )&":ref"

 

Does anyone have an updated one for the new ref code style??? I build/maintain a plugin for Apple Mail to add emails to cases and want to be able to handle the new ref codes. 

 

Thanks in advance!

Daniel

Hello fellow Mac users!

I am wrapping up the first version of a "mailbundle" (aka plugin) for Apple Mail 5.0+ (Lion) for use with SalesForce as a replacement for / in addition to email-to-case.

Most in our company have already moved to Macs and we constantly find ourselves forwarding emails to SalesForce using email-to-case. Tired of losing attachments, pasting ref:blahblah:ref every where so it wouldn't get truncated and seeing incorrect to/from information in SalesForce; I began building the bundle in my spare time about a month ago.

The bundle is built with Simon Fell's excellent zkSforce library (hat tip), a lot of patience, googling and time with a debugger attached to Mail.App (this stuff ain't documented!). Currently it allows you to append an email to an existing case (as an EmailMessage, not an activity) by searching for the case in a manner similar to MailDrop. However before prompting you to search, the bundle looks in the subject and body for the ref: code and only ref: codes for your org! if found the bundle will automatically locate the case without the need to do a search! Additionally it properly grabs both the text/plain and text/html bodes and includes them in the EmailMessage.

I'm making this post to gauge public interest in the bundle (if there is any). I have been using it daily now and hope to get our support team using it as we roll out Lion. I've long been a fan of bundles like "MailFollowUp" (http://www.cs.unc.edu/~welch/MailFollowup/), which is why I decided to go with a mail bundle; I wanted the tighter integration with Mail.app than is possible via another app.

Hope to hear some feedback!
Daniel
Hello, I'm making a simple automator workflow to upload PDFs to a specific record in SalesForce. Is it possible to use the SalesForceScripting app to upload attachments? I do have it successfully querying and inserting a row in SalesForce, just not sure how to throw the attachment contents in with the insert statement. TIA for any pointers! Daniel
Does anyone have experience trying this? I'm building a page in force.com sites. Basically another tool will make an anonymous http POST call to this page to update a specific users chatter feed.

TIA,
Daniel

Hi, I'm using Triggers to send out emails on "AfterUpdate", however I'd like the trigger to obey the DML options:

 

dml.EmailHeader.triggerUserEmail
dml.EmailHeader.triggerOtherEmail
dml.EmailHeader.triggerAutoResponseEmail

 

 

I figured it'd be as easy as an if statement making sure those variables are true, however I can't seem to find a way to read these variables, only set them. Is there any way to do this?

 

My first thought was to try the below, however it returned null:

 

 

Database.DMLOptions dml = new Database.DMLOptions();
System.debug(Logginglevel.info,dml.EmailHeader.triggerUserEmail);

Then for kicks, I tried:

 

System.debug(Logginglevel.info,Database.DMLOptions.EmailHeader);

 That didn't work either.

 

Any pointers? Is this possible?

 

Thanks in advance!,

Daniel

 

 

New to VisualForce/Apex/Salesforce in general. I've created some methods I found very useful and thought I'd share. Just fair warning that these could most definitely be improved upon. I welcome any recommendations and feel free to use this code, I hope you find it useful.

 

 

 

public class ChatterUtils {
    @future
    static public void addFollower(Id userId, Id objectToFollowId) {
        EntitySubscription e = new EntitySubscription();
        e.subscriberId = userId;
        e.parentId = objectToFollowId;
        Database.insert(e,false);
    }
    
    @future
    static public void addFollowers(Set<Id> userIds, Id objectToFollowId) {
        EntitySubscription[] es = new List<EntitySubscription>();
        for (Id userId : userIds) {
            EntitySubscription e = new EntitySubscription();
            e.subscriberId = userId;
            e.parentId = objectToFollowId;
            es.add(e);
        }
        Database.insert(es,false);
    }
    
    @future
    static public void copyFollowers(Id objectToCopyFrom, Id objectToFollowId) {
        User[] users = [select id from user where id in 
                (select subscriberId from EntitySubscription where parentId = :objectToCopyFrom)];
        EntitySubscription[] es = new List<EntitySubscription>();
        for (User user : users) {
            EntitySubscription e = new EntitySubscription();
            e.subscriberId = user.Id;
            e.parentId = objectToFollowId;
            es.add(e);
        }
        Database.insert(es,false);
    }
    
    @future
    /**
    	This crazy method takes two side by side arrays, both with sObject Ids. The arrays must both be the same size.
    	Followers are copied from/to in the exact same order they are both in, in the array. Very useful in triggers on joining objects.
    **/
    static public void copyFollowers(Id[] objectsToCopyFrom, Id[] objectsToFollow) {
        System.assertEquals(objectsToCopyFrom.size(),objectsToFollow.size());
        System.debug(Logginglevel.INFO,'Objects same size?: ' + (objectsToCopyFrom.size() == objectsToFollow.size()) + '. Size is ' + objectsToCopyFrom.size());
        Integer size = objectsToFollow.size();
		EntitySubscription[] es = new List<EntitySubscription>();        
        
		//Creating the Map that lets us get all the followers by their parent Id.
        EntitySubscription[] allEntitySubs = [select subscriberId,parentId from EntitySubscription where parentId in :objectsToCopyFrom];
      	
      	if (allEntitySubs.size() > 0) {
      		Map<Id,Id[]> followerMap = new Map<Id,Id[]>();
	        for (EntitySubscription es1 : allEntitySubs) {
	        	if (followerMap.containsKey(es1.parentId)) {
	        		followerMap.get(es1.parentId).add(es1.subscriberId);
	        	} else {
	        		Id[] esList = new List<Id>();
	        		esList.add(es1.subscriberId);
	        		followerMap.put(es1.parentId,esList);
	        	}
	        }
	        System.debug(LoggingLevel.info,'Map size: ' + followerMap.size());
	        
	        //This creates the EntitySubscription.
	        for (Integer i = 0; i < size; i++) { //Using an old school loop so we can go through both arrays.
	        	System.debug(Logginglevel.info,'Copying all followers from: ' + objectsToCopyFrom[i]);
	        	if (followerMap.get(objectsToCopyFrom[i]) != null) {
	        		for (Id followerId : followerMap.get(objectsToCopyFrom[i])) {
		                EntitySubscription e = new EntitySubscription();
		                e.subscriberId = followerId;
		                e.parentId = objectsToFollow[i];
		                System.debug(Logginglevel.INFO,e);
		                es.add(e);
	            	}	
	        	}
	        }
	        System.debug(Logginglevel.INFO,'Adding ' + es.size() + ' followers.');
	        Database.insert(es,false);
      	}
    }
    
    @future
    static public void addRelatedPost(String title, String body, Id parentId, Id relatedObjectId) {
        FeedPost issuePost = new FeedPost();
        issuePost.Type = 'LinkPost';
        issuePost.ParentId = parentId;
        issuePost.Title = title;
        issuePost.Body = body;
        issuePost.LinkUrl= '/' + relatedObjectId;
        insert issuePost;
    }
    
    static testMethod void test(){
 		Map<Id,Account> accounts = new Map<Id,Account>([select id from account limit 10]);
 		Account account = [select id,ownerid from Account limit 1];
 		Map<Id,User> users = new Map<Id,User>([select id from user]);
 		User user = [select id from User limit 1];
 		
 		ChatterUtils.copyFollowers(account.id,account.ownerId);
 		ChatterUtils.addFollower(account.id,account.ownerId);
    }
    
    static testMethod void testNoFollowers() {
    	Account account = new Account(Name='Test');
    	insert account;
    	Case aCase = new Case();
    	insert aCase;
    	
    	Id[] list1 = new List<Id>();
    	list1.add(account.id);
    	Id[] list2 = new List<Id>();
    	list2.add(aCase.id);
    	ChatterUtils.copyFollowers(list1,list2);
    }
}

 

 

I really use the copyFollowers() method a lot. I use it for triggers on junction objects. For example, we have an object called CaseIssue for a many-to-many relationship between Cases and Issues.

 

 

trigger CaseIssueChatter on CaseIssue__c (after insert) {
	Set<Id> caseIds = new Set<Id>();
	Set<Id> issueIds = new Set<Id>();
     for (CaseIssue__c ci : Trigger.new) {
     	caseIds.add(ci.Case__c);
     	issueIds.add(ci.Issue__c);
     }
     ChatterUtils.copyFollowers(caseIds,issueIds);
}

 

 

We also like our Cases to copy the followers of the Account, so they are able to stay in the loop with their customer's cases. 

 

 

trigger CaseChatter on Case (after insert, after update) {
    Id[] caseIds = new List<Id>();
    Id[] accountIds= new List<Id>();
    for (Case newCase : Trigger.new) {
        caseIds.add(newCase.id);
        accountIds.add(newCase.accountId);
    }
    ChatterUtils.copyFollowers(accountIds, caseIds);
}

 

I had a hard time making these usable in bulk so I figure if our org is the only one using it, it's sort of a waste. Most of my frustration was due to using @future I think, but it seemed to be appropriate.

 

Also I don't have all my unit tests included here, as some of them are pretty specific to our environment.

 

Daniel

 

Hi, I'm using a custom controller to grab the chatter feed for a specific object. Here is my query:

 

 

select Id, ParentId, CreatedBy.name, CreatedDate, 
    FeedPost.Body, Type, FeedPost.Title, FeedPost.LinkURL,
    (select FeedItemId, FieldName, OldValue, NewValue from FeedTrackedChanges)
from CaseFeed where ParentId = :theCase.id  order by CreatedDate desc

 

 

Almost everything works great. What I don't like is that FeedTrackedChanges gives you the IDs back with the other field changes. Can anyone give me some pointers on the best way to filter this out? The only idea I had was filtering out anything with a length of 15 or 18 characters. Seems risky though. FWIW, I am using a custom controller.

 

 

Thanks in advance!

Daniel

 

 

 

 

Hi all, quick question from a SFDC new guy. I'm building a wizard and would like to offer my users the ability to either choose an existing contact using lookup or to enter in specific information. I've got all the fields setup, a controller and a vf page. I've put a radio button in and I plan to just use JavaScript/CSS to change the fields displayed when the option is changed. In my controller I was going to do a null check and create/append data in fields if true. Does this sound like the most logical approach here?

 

Thanks for any advice!

Daniel

Hi, has anyone been able to find the chatter filter in the side bar? It's shown in the video at http://www.salesforce.com/chatter/getstarted/, however I can't seem to figure out how to enable it at all. Am I the only one? Thanks! Daniel

 

 

 

Edit: The direct link to the video is here: http://www.salesforce.com/assets/swf/youtube_players/chatter.jsp?display_type=lb

Hi, 

 

I'm creating a simple visual force email template for my case alerts. I'm using apex:repeat to loop over relatedTo.CaseComments and display them in a simple table. However the comments are out of order, for example they display in the order below...

 

Fri Oct 16 05:00:00 GMT 2009

Mon Oct 19 05:00:00 GMT 2009

Tue Jun 08 15:35:21 GMT 2010

Mon Oct 19 05:00:00 GMT 2009

 

Is there a simple solution for this? Besides using a controller? I'd think they'd be in order in the database.

 

Thanks in advance!

Daniel

Hi to all,

 

I need to integrate in Salesforce CRM a callcenter based in ASTERISK PBX using a CTI adapter. I know there are several CTI's, but are based in Windows OS. Anyone know about any developed CTI adapted working in MAC?

 

I give you my thanks for your support.

 

Best regards

I would dearly love to deploy this to all the Macs in my company, but being able to sync to specified groups is key. We must keep our Salesforce contacts separate from other contacts. As there are really no tools for syncing Outlook 2011 with SalesForce, our only route is Apple Mail, iCal, and Address Books...if we can get group syncing.

 

I know SF3 is beta, but it has been in beta for many years, and address book groups were on the wish list 3 to 4 years ago. Is there any glimmer of hope?

Hello fellow Mac users!

I am wrapping up the first version of a "mailbundle" (aka plugin) for Apple Mail 5.0+ (Lion) for use with SalesForce as a replacement for / in addition to email-to-case.

Most in our company have already moved to Macs and we constantly find ourselves forwarding emails to SalesForce using email-to-case. Tired of losing attachments, pasting ref:blahblah:ref every where so it wouldn't get truncated and seeing incorrect to/from information in SalesForce; I began building the bundle in my spare time about a month ago.

The bundle is built with Simon Fell's excellent zkSforce library (hat tip), a lot of patience, googling and time with a debugger attached to Mail.App (this stuff ain't documented!). Currently it allows you to append an email to an existing case (as an EmailMessage, not an activity) by searching for the case in a manner similar to MailDrop. However before prompting you to search, the bundle looks in the subject and body for the ref: code and only ref: codes for your org! if found the bundle will automatically locate the case without the need to do a search! Additionally it properly grabs both the text/plain and text/html bodes and includes them in the EmailMessage.

I'm making this post to gauge public interest in the bundle (if there is any). I have been using it daily now and hope to get our support team using it as we roll out Lion. I've long been a fan of bundles like "MailFollowUp" (http://www.cs.unc.edu/~welch/MailFollowup/), which is why I decided to go with a mail bundle; I wanted the tighter integration with Mail.app than is possible via another app.

Hope to hear some feedback!
Daniel

Hi, 

I'm trying to create a custom list button on OpportunityLineItems but I can't seem to figure out how this could be done. The idea is to select some of the line itemsand edit them together (bulk edit style). So I created a VF page using the standard controller OpportunityLineItem with an extension. The moment I pick List Buttonwhen attempting to create the button, the VF page disappears from the available choices.

 

Is this even doable? I've noticed that the moment I add a recordSetVar I get an error msg "List Controllers are not supported for OpportunityLineItem". 

 

I've seen this done before :-). Is there a trick here?



Thanks!

 
  • July 28, 2011
  • Like
  • 0
Hello, I'm making a simple automator workflow to upload PDFs to a specific record in SalesForce. Is it possible to use the SalesForceScripting app to upload attachments? I do have it successfully querying and inserting a row in SalesForce, just not sure how to throw the attachment contents in with the insert statement. TIA for any pointers! Daniel
Does anyone have experience trying this? I'm building a page in force.com sites. Basically another tool will make an anonymous http POST call to this page to update a specific users chatter feed.

TIA,
Daniel

The following series of posts is an implementation of the idea:

 

https://sites.secure.force.com/success/ideaView?c=09a30000000D9xt&id=08730000000BrQtAAK

 

When viewing the text, the linewrap looks mangled, but it appears the code will cut & paste correctly back into eclipse.   At some point in the future I'll probably offer this on the app exchange.

 

The following is an example of a visual force page for editing accounts with locked fields.

 

 

<apex:page standardController="Account">
<c:DetailsEdit value="{!account}" helpURL="/help/doc/user_ed.jsp?loc=help&target=account_edit.htm&section=Accounts" save="{!save}" cancel="{!cancel}">
<apex:pageBlockSection columns="1">
<apex:repeat value="{!$ObjectType.Account.FieldSets.EditFields}" var="f">
<apex:inputField value="{!account[f]}" />
</apex:repeat>
<apex:repeat value="{!$ObjectType.Account.FieldSets.LockedFields}" var="f">
<apex:outputField value="{!account[f]}"/>
</apex:repeat>
</apex:pageBlockSection>
</c:DetailsEdit>
</apex:page>

 

 

It's hard to implement these techniques if you can't use them from all interfaces.

  • February 24, 2011
  • Like
  • 0

In my project, we follow certain records via after update triggers, if some conditions match.

 

I am getting this error on follow code that creates an EntitySubscription via trigger

 

Description: Error:Apex trigger FollowXYZ caused an unexpected exception, contact your administrator: FollowXYZ: execution of AfterUpdate caused by: System.DmlException: Insert failed. First exception on row 0; first error: LIMIT_EXCEEDED, Maximum per user subscription limit reached.: []: Class.eng.ChatterUtil.followRecords: line 27, column 13

 

Seems their is some governor limit on following the entities also, i tried figuring out what the exact count is. It seems "500".

Can anyone tell me the exact count, I can't find this documented anywhere ??

Hi,

 

I am i have a created a custom object and am trying to make a master-detail relationship with the object Product. The problem is when I select Master-Detail the Product object does not show up in the drop down list. Does this mean that I can not create a Master Detail relation ship keeping the Product as the master or is there some settings to be changed to get this done.

 

Thanks

KD 

  • May 20, 2009
  • Like
  • 0