You need to sign in to do that
Don't have an account?
salesforce to salesforce automatically sharing a custom object or opportunity
I want to create a trigger for a customer object and opportunity we are sharing with another organization . I want to add a triger to the object and opportunity so whenever a new record insert, it can be automatically shared with another organizaion.
Here is the code I wrote, I am not familiar with the code . so .........
trigger EDCSharing on Incentive__c (after insert) {
List<PartnerNetworkConnection)> connMap = new List<PartnerNetworkConnection>(
[select Id, ConnectionStatus, ConnectionName from PartnerNetworkConnection
where ConnectionStatus = 'Accepted']
);
for(PartnerNetworkConnection network : connMap) {
PartnerNetworkRecordConnection newrecord = new PartnerNetworkRecordConnection();
newrecord.ConnectionId = network.Id;
newrecord.LocalRecordId = accountId;
newrecord.RelatedRecords = 'Incentive__c';
newrecord.SendClosedTasks = true;
newrecord.SendOpenTasks = true;
newrecord.SendEmails = true;
insert newrecord;
}
And there is a error message said : there is unexpected token " list"
Hi cherry
look in red mark as you error due this barcket . remove baracket it will work.
trigger EDCSharing on Incentive__c (after insert) {
//List<PartnerNetworkConnection)> connMap = new List<PartnerNetworkConnection>(
List<PartnerNetworkConnection> connMap = new List<PartnerNetworkConnection>( // Correct Line
[select Id, ConnectionStatus, ConnectionName from PartnerNetworkConnection
where ConnectionStatus = 'Accepted']
);
for(PartnerNetworkConnection network : connMap) {
PartnerNetworkRecordConnection newrecord = new PartnerNetworkRecordConnection();
newrecord.ConnectionId = network.Id;
newrecord.LocalRecordId = accountId;
newrecord.RelatedRecords = 'Incentive__c';
newrecord.SendClosedTasks = true;
newrecord.SendOpenTasks = true;
newrecord.SendEmails = true;
insert newrecord;
}
I tried that , I still have the same problem
May be you will get another typr of Error. Can you paste your complete code.
May be you will get the error related to AccountId.
~Thanks
Onkar Kumar
this is my complete code. I am not familiar with the code .