Skip to main content
Hi, I need to auto share Activities on Opps that are shared through a Salesforce to Salesforce connection. I have the below trigger but get an insufficient privledges error for the PartnerNetworkRecordConnection reference... Any thoughts? I have seen people say to do the trigger, but no examples yet...

 

trigger AutoShareTasks on Task (before insert) {

 

    List<PartnerNetworkConnection> connMap = new List<PartnerNetworkConnection>([select Id, ConnectionStatus, ConnectionName from PartnerNetworkConnection where ConnectionStatus = 'Accepted']);

 

    List<PartnerNetworkRecordConnection> prncList = new List<PartnerNetworkRecordConnection>();

 

    for(Task t : Trigger.new){

 

        String tId = t.id;

 

        for(PartnerNetworkConnection network : connMap){

 

            String cid = network.Id;

 

            String status = network.ConnectionStatus;

 

            String connName = network.ConnectionName;

 

            String TaskName = t.Subject;

 

            String OpportunityID = t.whatid;

 

            String CreatedBy = t.CreatedBy.name;

 

           

 

            if(TaskName != NULL && t.CreatedBy.name != 'Connection User'){  

 

                PartnerNetworkRecordConnection newrecord = new PartnerNetworkRecordConnection(); 

 

                newrecord.ConnectionId = cid; 

 

                newrecord.LocalRecordId = tid; 

 

                newrecord.ParentRecordId= OpportunityID;   

 

                insert newrecord;

 

            }

 

        }

 

    }

 

}
1 resposta
  1. 17 de set. de 2014, 18:55
    This Answers Community is focused on configuration and design questions. Programmatic questions are best submitted to

     

    the developer forums at https://developer.salesforce.com where the forums and participants are geared toward programming troubleshooting and support.
0/9000