You need to sign in to do that
Don't have an account?
the1castdown
Custom Button That Changes Changes Functions Based On Case Data
*I posted this once already and it got deleted, I have no idea why. This is a legitemate question, If I posted in the wrong place, please message me to tell me the correct place to post.*
I started creating a custom button to appear in the details section of cases. I want the button to go to the "Send an Email" page if it is the first time responding to a support case, but I would like it to go to "Email Messages for Case" page if a reply Email for the support case has been sent. I got this to work using 2 different buttons with the following code:
"Send an Email" button
http://na3.salesforce.com/email/author/emailauthor.jsp?p2_lkid={!Case.ContactId}&p3_lkid={!Case.Id}&p24={!Case.SuppliedEmail}
"Email Messages for Case" button
https://na3.salesforce.com/ui/email/EmailMessageListPage?id={!Case.Id}
To put these functions in the same button I figured I'd have to use an IF statement that could check to see if emails have been sent or not. The best solution I came up with thus far:
http://na3.salesforce.com/
{!IF( Case.CreatedDate >= Case.LastModifiedDate,
"email/author/emailauthor.jsp?p2_lkid=" & Case.ContactId & "&p3_lkid=" & Case.Id & "&p24=" & Case.SuppliedEmail,
"ui/email/EmailMessageListPage?id=" & Case.Id)}
Believe it or not, that code actually works, except for the fact that every "/" inside the IF statement is changed to %2F as well as the"?" which is changed to its HTML equivalent. I've seen that browsers can interpret escaped characters correctly, but for some reason it doesn't work for my function. If I use URLs without forward slashes or question marks the function works great. Any help on this problem as well as a better idea on how to check if Emails activity has occured would be great.
If this seems like a bad solution for making my salesforce case work more user friendly, I'm open to any ideas.
Unless I decide this is the wrong approach for providing better case workflow, I plan to add functionality that applies a support email template to the first Reply email for a support case.
Apex Code is the on-demand programming language and is not generally the same crowd as those that create custom buttons and formula fields.
Your first message was moved to the S-controls developer discussion board.
Your other post about custom formulas was moved to the formula field board on successforce.com.