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
Jyothy LakshmyJyothy Lakshmy 

Attachment On Event with custom button

Hi all,
    I am using a custom button in event page layout for some interrnam pupose. I have used the code given below to populate the 'Add attachemnt page' from custom button


Code:
URL.getSalesforceBaseUrl().toExternalForm() + '/p/attach/ActivityAttach?relatedListId=' + eventID +'_RelatedActivityAttachmentList&retURL=%2F'+eventID+'%2Fe%3FretURL%3D%252F'+eventID+'&pid='+eventID+'&type=00U';

Link retrieved :
https://cs10.salesforce.com/p/attach/ActivityAttach?relatedListId=00UJ0000009yQ2F_RelatedActivityAttachmentList&retURL=%2F00UJ0000009yQ2F%2Fe%3FretURL%3D%252F00UJ0000009yQ2F&pid=00UJ0000009yQ2F&type=00U


But the issue is after attachement return to 'Edit page ' of event simply like standared functionalty. Instead, i have to return to the view page after saving the attachment. What change i should made for it?

Thanks in advance.
Shweta_AgarwalShweta_Agarwal
Hi Jyothy,

Change the retURL to "%2F'+eventID+".

So your Code will be
Code:
URL.getSalesforceBaseUrl().toExternalForm() + '/p/attach/ActivityAttach?relatedListId=' + eventID +'_RelatedActivityAttachmentList&retURL=%2F'+eventID+'&pid='+eventID+'&type=00U';

Thanks,
Shweta