function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RevJoelRevJoel 

Custom Button Wonkiness - Yes, wonkiness

I have created a custom button called Send Notification which opens a send email window. Here is the code:

 

location.replace('/email/author/emailauthor.jsp?retURL=/{!SFDC_Bug__c.CreatedById}&p3_lkid={!SFDC_Bug__c.Id}&rtype=003&p2_lkid={!Case.ContactId}&template_id=00X50000001Sjp9');

 

The challenge I am having is twofold:

1. When I click the button, on the Send Email screen, there is no From field so I cannot select the same system address we use for cases so responses go directly into the custom tab item. 

2. Once the email is sent, you are not taken back to the previous page, but to the senders Profile page in Salesforce. Why?

 

Any advice would be appreciated. Thanks!

DannyWalkerDannyWalker

"retURL=/{!SFDC_Bug__c.CreatedById}"

 

This part of the custom link is what is doing 2).  You need to replace this with the page you want to return to.

RevJoelRevJoel

Thanks, Danny! I will see if I can figure out what to enter there to take me back to the correct page. 

RevJoelRevJoel

OK. Here is what I have done  to try to remedy #1:

 

I have tried adding the p26=email@company.com parameter to the button and it will not send from that address. It still shows it as coming from me (my sf email address) when I send the email. Any ideas? Here is the current text:

 

location.replace('/email/author/emailauthor.jsp?retURL=/{!SFDC_Bug__c.CreatedById}&p26=user@company.com&p3_lkid={!SFDC_Bug__c.Id}&rtype=003&p2_lkid={!Case.ContactId}&template_id=00X50000001Sjp9');

navneetnavneet

Hello,

 

If you are familiar with Visula force page and apex then I would suggest go for it.

 

you need to do following steps:-

 

1) create visual force page which can include all the information which you want to send and email adress of the person.

(inshort create form)

2) on submit of the button call apex action and write logic for send email(search on google you will get the code)

3) create custom button and follow the steps below

a) select label

b) select name

c) Display type - Detail page button

d)Behaviour - display in new window

e) content source - visualforce page

 

after submit call the java script in to the visualforce page to close the popup window, you will be on the sale page and popup window will be closed.

 

If you try with this approach then it will be more generic. Let me know if you need any help in creating vfpage and writing controller logic 

 

Thanks,

 

Navneet