• Rajan Vegesna 3
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
trigger updateOpponAttendance on Attendance__c (After insert,After Update) {
    for(Attendance__c att : Trigger.new){
        Opportunity opp = new Opportunity();
        if(att.Lead__c != Null && 
           att.CourseId__c != Null && 
           att.Course_Start_Date__c != Null){
        if(att.Lead__c == opp.Lead__c){
           if(att.CourseId__c == opp.MysqlCourseId__c && 
              att.Course_Start_Date__c == opp.Course_Date__c &&
              opp.Dup_Opp__c == False){
              att.Opportunity__c = opp.Id;
              }
    }
}
}
}
Error: 
Apex trigger partnersync caused an unexpected exception, contact your administrator: partnersync: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: INVALID_PARTNER_NETWORK_STATUS, invalid status for partner network operation: []: Trigger.partnersync: line 19, column 1

Code:
trigger partnersync on Partner__c (after insert,after Update) {
    Id networkId = ConnectionHelper.getConnectionId('Academy of Financial Trading 2nd Org');
    List<PartnerNetworkRecordConnection> partnerConnections =  new  List<PartnerNetworkRecordConnection>();
    
    for (Partner__c pl : trigger.new) {
        
        PartnerNetworkRecordConnection newConnection = new PartnerNetworkRecordConnection(
            
            ConnectionId = networkId,
            LocalRecordId = pl.Id,
            SendClosedTasks = false,
            SendOpenTasks = false,
            SendEmails = false,
            ParentRecordId = pl.Id);
        partnerConnections.add(newConnection);
    }
    if (partnerConnections.size() > 0 ) {
        database.insert(partnerConnections);
        
    }
    
}
trigger updateOpponAttendance on Attendance__c (After insert,After Update) {
    for(Attendance__c att : Trigger.new){
        Opportunity opp = new Opportunity();
        if(att.Lead__c != Null && 
           att.CourseId__c != Null && 
           att.Course_Start_Date__c != Null){
        if(att.Lead__c == opp.Lead__c){
           if(att.CourseId__c == opp.MysqlCourseId__c && 
              att.Course_Start_Date__c == opp.Course_Date__c &&
              opp.Dup_Opp__c == False){
              att.Opportunity__c = opp.Id;
              }
    }
}
}
}
Error: 
Apex trigger partnersync caused an unexpected exception, contact your administrator: partnersync: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: INVALID_PARTNER_NETWORK_STATUS, invalid status for partner network operation: []: Trigger.partnersync: line 19, column 1

Code:
trigger partnersync on Partner__c (after insert,after Update) {
    Id networkId = ConnectionHelper.getConnectionId('Academy of Financial Trading 2nd Org');
    List<PartnerNetworkRecordConnection> partnerConnections =  new  List<PartnerNetworkRecordConnection>();
    
    for (Partner__c pl : trigger.new) {
        
        PartnerNetworkRecordConnection newConnection = new PartnerNetworkRecordConnection(
            
            ConnectionId = networkId,
            LocalRecordId = pl.Id,
            SendClosedTasks = false,
            SendOpenTasks = false,
            SendEmails = false,
            ParentRecordId = pl.Id);
        partnerConnections.add(newConnection);
    }
    if (partnerConnections.size() > 0 ) {
        database.insert(partnerConnections);
        
    }
    
}