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
Rafi AdminRafi Admin 

share case records by clicking on Sharing button based on condition

Hi,
I have one requirement , Call Center agent needs to share case records only if case origin='Email' by clicking on Sharing button on Case Detail page. Please help me to reach this requirement.
Best Answer chosen by Rafi Admin
Pankaj_GanwaniPankaj_Ganwani
Hi Rafi,

You will have to create custom javascript button on Case Detail page to accomplish this requirement and hide the standard sharing button from Case detail page. Place below mentioned code on javascript button:
 
if('{!Case.Origin}' == 'Email')
     window.open('/p/share/CaseSharingDetail?parentId={!PANG__Object_1__c.Id}','_parent')



 

All Answers

Pankaj_GanwaniPankaj_Ganwani
Hi Rafi,

You will have to create custom javascript button on Case Detail page to accomplish this requirement and hide the standard sharing button from Case detail page. Place below mentioned code on javascript button:
 
if('{!Case.Origin}' == 'Email')
     window.open('/p/share/CaseSharingDetail?parentId={!PANG__Object_1__c.Id}','_parent')



 
This was selected as the best answer
Rafi AdminRafi Admin

Hi Pankaj ,

Thanks for your quick update. may I know what is PANG__Object_1__c.Id here?

Pankaj_GanwaniPankaj_Ganwani
Hi Rafi,

This would be your object Id whose record you want to share. In our case, this would be Id of the Case i.e. Case.Id.
Rafi AdminRafi Admin
Hi Pankaj ,
Its working good now. Thank you very much.