Monday, November 18, 2013

SQL Restrict Number of Characters

I have used the 'left()' function to limit the results of a query in the past, but sometimes it does not work. The other function that can be used to limit the results of a query is substring, here is how it is used:

select Substring(notes,1,4000) as notes from history

Where the 1 is where you start and the 4000 is how many characters you want to pull in.

SUBSTRING ( expression ,start , length )

Tuesday, November 12, 2013

Override Button to Pre populate Fields

I found this blog post the other day and though it was very well written and very helpful!

http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html

More button code notes that are Task Button specific:

/00T/e?
who_id={!$User.Id}                                 // Set "Assigned to" to current user
&what_id={!ExpenseAccount__c.Id}   // "Related to" which object
&tsk1=Roger Wicki                                 // Override "Assigned to" with this name
&tsk2={!User.Name}                               // Related Contact's Name
&tsk3={!ExpenseAccount__c.Name}  // The Object's name
&tsk3_id=01ID0000000OiBz                // My custom object's ID
&tsk4={!(TODAY() + 7)}                          // Due Date
&tsk5=Print%20Expenses                     // Subject
// &save=1
// &save=x
&retURL=/{!ExpenseAccount__c.Id}
&cancelURL=/{!ExpenseAccount__c.Id}

For other objects you when using Google Chrome you can right click and "Inspect Element" to identify the field ID and use '&00Ni000000CKJg7' to preset a field value. This is most helpful for standard fields because you can get the same ID for custom fields by clicking on the field in the setup and pulling the ID from the URL.