Below is a basic query that will output the results of all ContHist records from 1/1/2009 and forward.
select * from CONTHIST where ondate > '2009-01-01'
A holding place for thoughts, ideas and revelations related to cloud configuration and development with Salesforce.com
Friday, May 24, 2013
Wednesday, May 22, 2013
Compare Two Blocks of Text
Ran across this nice little free online tool recently that compares 2 blocks of text. This is helpful if you are looking at code that could have been updated and pulling out those differences...
http://www.diffchecker.com
http://www.diffchecker.com
Tuesday, May 21, 2013
Friday, May 17, 2013
Mass Upload Pictures to Rich Text Field
There is a lot of confusing stuff out there about mass uploading pictures into a rich text field. Below is one thing I have found by testing actually works pretty well.
Process:
Process:
- Upload image as an attachment into Salesforce against the record the picture is being added to.
- Use that success file to create a new CSV file with the following attributes.
- The ID of the record having the image inserted
- A column that will have the following text
<img alt="User-added image" src="https://c.na14.content.force.com/servlet/servlet.FileDownload?file=00Pd0000003Uf0n"></img>
The 'User-added image' can be replaced with the name of the contact, or not replaced at all. Follow the steps below to fill out the hyperlink:
- Add an image to any record in your Salesforce org as an attachment
- Open up the attachment
- Right click on 'View file' and select 'Open link in a new tab' (this is the option for Chrome)
- Copy the url that appears on the new tab, this is the base for the image link
- It will take some excel manipulation, but you will need to use the success file for the attachment upload and replace the ID at the end with the ID of all attachments uploaded.
In the end you will only need 2 columns in the file that is uploaded. One being the ID of the record that is receiving the picture, two being the img url from above.
Tuesday, May 14, 2013
Importing Zip Codes with a Leading Zero into Salesforce.com
When importing Zip Codes into Salesforce because the file must be in CSV format you can run into problems you didnt know were there. For example when you open up a data file in CSV format if there are any Zip codes with leading zeroes like 01752 they will appear with the leading zero chopped off and will display like 1752.
You can follow these steps below to be sure to load those leading zeroes.
1. Select the entire Zip Code column from within Excel.
2. Select the menu option Format -> Cells...
3. Select the Number tab, and click on the category called "Special".
4. You can then select the type Zip Code or Zip Code + 4, and then click OK.
Be sure to save the changes to your .CSV file.
NOTE: If you reopen the saved .CSV file in Excel, the formatting is not preserved. Opening in Notepad preserves the formatting. Save the formatting of the zip code for your last step when importing records. If you do not reopen the .CSV file in Excel before importing, the zip codes are imported with the appropriate leading zeroes.
These steps came from the Salesforce custom community:
https://success.salesforce.com/questionDetail?qId=a1X30000000HZDMEA4
You can follow these steps below to be sure to load those leading zeroes.
1. Select the entire Zip Code column from within Excel.
2. Select the menu option Format -> Cells...
3. Select the Number tab, and click on the category called "Special".
4. You can then select the type Zip Code or Zip Code + 4, and then click OK.
Be sure to save the changes to your .CSV file.
NOTE: If you reopen the saved .CSV file in Excel, the formatting is not preserved. Opening in Notepad preserves the formatting. Save the formatting of the zip code for your last step when importing records. If you do not reopen the .CSV file in Excel before importing, the zip codes are imported with the appropriate leading zeroes.
These steps came from the Salesforce custom community:
https://success.salesforce.com/questionDetail?qId=a1X30000000HZDMEA4
Monday, May 13, 2013
How to Quickly Check the Old Value in an APEX Trigger
Using the Old Map context variable in a trigger can quickly look back at the old value of a field in a trigger. This can be helpful when you need to write a trigger that is checking to see if a value has been changed...
for ( lead l_new: Trigger.new ){
if ( l_new.Status != Trigger.oldMap.get ( l_new.id ).Status ) {
}
}
for ( lead l_new: Trigger.new ){
if ( l_new.Status != Trigger.oldMap.get ( l_new.id ).Status ) {
}
}
Friday, May 10, 2013
Automating Salesforce Approval Processes with Apex Triggers
Ran across this the other day and wanted to re-post it, looks easy enough to implement...
http://blog.jeffdouglas.com/2010/01/04/automating-salesforce-approval-processes-with-apex-triggers/
http://blog.jeffdouglas.com/2010/01/04/automating-salesforce-approval-processes-with-apex-triggers/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | trigger OpportunitySubmitForApproval on Opportunity (after update) { for (Integer i = 0; i < Trigger.new.size(); i++) { if (Trigger.old[i].Probability < 30 && Trigger.new[i].Probability >= 30) { // create the new approval request to submit Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest(); req.setComments('Submitted for approval. Please approve.'); req.setObjectId(Trigger.new[i].Id); // submit the approval request for processing Approval.ProcessResult result = Approval.process(req); // display if the reqeust was successful System.debug('Submitted for approval successfully: '+result.isSuccess()); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | @isTest private class TestOpportunitySubmitForApproval { static testMethod void testApprovalSuccess() { Opportunity opp = new Opportunity(); opp.Name = 'Test Opp'; opp.Amount = 100; opp.CloseDate = Date.today(); opp.Probability = 10; opp.StageName = 'Prospecting'; // insert the new opp insert opp; // change the probability of the opp so the trigger submits it for approval opp.Probability = 40; // update the opp which should submit it for approval update opp; // ensure that the opp was submitted for approval List<ProcessInstance> processInstances = [select Id, Status from ProcessInstance where TargetObjectId = :opp.id]; System.assertEquals(processInstances.size(),1); } } |
Monday, May 6, 2013
White List IP Address for Data Loader access with no Security Token
Just found out that if you white list your IP address in a Salesforce org you do not need a security token to use APEX Data Loader. If a login is shared and the email address associated with the login is someone hard to reach, you can just do this and bypass getting a security token to load data!
Setup > Your Name > Security Controls > Network Access > New
Make the Start and End IP address your personal PC's IP address.
Note: You can do a google search of 'Whats my ip' to get your computer's ip address.
Once this is done when you login to data loader still use your username, but rather than using passwordSECURITYTOKEN as the password, all you need is the password.
Setup > Your Name > Security Controls > Network Access > New
Make the Start and End IP address your personal PC's IP address.
Note: You can do a google search of 'Whats my ip' to get your computer's ip address.
Once this is done when you login to data loader still use your username, but rather than using passwordSECURITYTOKEN as the password, all you need is the password.
Subscribe to:
Posts (Atom)