4

I created a URL button to send an email which works fine in partner portal but not in standard salesforce.I need to remove first extra slash(/) for standard salesforce.How to do this

enter image description here

Update When I updated the code according to @Ray Dehler I am getting an error on partner portal but works good in standard salesforce.Below find the screen shot of url of both partner portal and standard salesforce

enter image description here

enter image description here

/{!IF(CONTAINS($Profile.Name, "Title"),'partners','')}/_ui/core/email/author/EmailAuthor?  p2_lkid={!Lead.Id}&rtype=00Q&retURL={!IF(CONTAINS($Profile.Name, "Title"),  URLENCODE('partners')&'/' & URLENCODE(Lead.Id) ,URLENCODE(Lead.Id))}&template_id={!IF(CONTAINS($Profile.Name, "Title"), '','00Xc0000000MNDM')}
2

I have updated the button behavior as Execute Javascript and content as On Click Javascript and updated the below code and it worked.

var url = ''; 

if({!CONTAINS($Profile.Name, 'Title')}){ 
url += '/partners'; 
} 

url += 
'/_ui/core/email/author/EmailAuthor?' + 
'p2_lkid={!Lead.Id}&rtype=00Q&retURL='; 

 if({!CONTAINS($Profile.Name, 'Title')}){ 
 url += '/partners'; 
 } 

url += 
'/{!Lead.Id}' + 
'&template_id='; 

if({!NOT(CONTAINS($Profile.Name, 'Title'))}){ 
 url += '00Xc0000000MNDM'; 
} 

location.replace(url);
| improve this answer | |
0

Should be as simple as this:

{!IF(CONTAINS($Profile.Name, "Title"),'/partners','')}/_ui/core/email/author/EmailAuthor?  p2_lkid={!Lead.Id}&rtype=00Q&retURL={!IF(CONTAINS($Profile.Name, "Title"),  URLENCODE('partners')&'/' & URLENCODE(Lead.Id) ,URLENCODE(Lead.Id))}&template_id={!IF(CONTAINS($Profile.Name, "Title"), '','00Xc0000000MNDM')}

I moved the / inside the IF statement.

| improve this answer | |
  • I updated with your code and it stopped working for partner portal but now it works for standard salesforce – sfdc Jun 4 '14 at 17:34
  • What are each of the rendered URLs? – Ray Dehler Jun 4 '14 at 18:12
  • .Updated with screenshots – sfdc Jun 4 '14 at 18:19
  • And what is the URL that works from the partner portal? – Ray Dehler Jun 4 '14 at 18:24
  • /partners/_ui/core/email/author/EmailAuthor?p2_lkid=00Qa000001HGcJn&rtype=00Q&retURL=partners%2F00Qa000001HGcJn&template_id= – sfdc Jun 4 '14 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.