• Tjd440
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 2
    Replies
This one is a bit wierd, but what we need to do is share a task over S2S from Org A to Org B using a trigger, however org B doesn't have the Task's parent object.  So, we need to somehow re-assign the tasks parent at Org B, yet somehow maintain the by-directional sync provided by the PartnerConnection(s2s).  We are trying to do this by the following, but I get a generic "INVALID_PARTNER_NETWORK_STATUS, invalid status for partner network operation: []" error.  Ie..

(Org A Task Trigger)

PartnerNetworkRecordConnection pnrc = new PartnerNetworkRecordConnection();    
pnrc.ConnectionId = connectionId;
pnrc.LocalRecordId = task.Id; // Tasks real local ID
pnrc.ParentRecordId = child.Id; // Not the tasks real parent, but another object visible to Org B
insert pnrc;

Should this work, and/or is there an alternative to re-assigning the parent on the OrgB side of the share?
  • September 16, 2014
  • Like
  • 0

Is there a way using APEX or the API(s) to create an open task with no legitimate user (ie "nobody")?  We are sharing tasks between two instances over a S2S connection for process visibility between the orgs, however since we don't have the same users on each side, the receiver side needs someone to "own" the forwarded tasks, even though there isn't anyone really assigned to that task at that organization.  Shared tasks by default get assigned to the connection owner, or whomever we assign the parent object owner to.  Other then buying an "Remote User" license for each side to inherit these records, is there anyway to do create this nobody/null reference (in a trigger/etc)?  Alternatively, can we reference the "Connection User" somehow?

 

Thanks

Tanner

  • October 14, 2013
  • Like
  • 0

We are trying to use the REST API to synchronize some objects between two salesforce instances which are not supported by the ParnterConnectionAPI well (notes,events,activities,attachments,etc).  Assuming orgA is going to make REST posts to B and OrgB is going to make REST posts to ordA on afterInsert triggers, what is the best way to handle the OAuth authentication between these instances?  I know I can go through the OAuth grantType=Password login, then do the post with the issues token, but this requires me to hard-code a username/password/tokens in my APEX code (and its a pain).  So, is there a better OAuth methodology for a server to server connection like this?

 

Also, I know the partner connection does technically support those objects, however it only moves those objects on the initial share/forward of the parent object (Account), however it does not forward those objects if they are added after the initial share of the parent object, nor are they synced going forward.

 

Thanks!

Tanner

 

 

  • October 02, 2013
  • Like
  • 0

Can Notes and Attachments be shared using an after insert trigger and the PartnerNetworkRecordConnection object?  The PartnerNetworkRecordConnection does not accept the "Id" field from Notes and Attachments (wrong type), although it does for Account/Contact/etc.  Is this a known limitation, or am I perhaps doing something wrong?  

Error Message on note save: Apex trigger triggerNoteExample caused an unexpected exception, contact your administrator: triggerNoteExample: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Local Record ID: id value of incorrect type: 002f0000000b6SxAAI: [LocalRecordId]: Trigger.triggerNoteExample: line 16, column 1

// Example
trigger triggerNoteExample on Note (after insert)
{
List<PartnerNetworkConnection> partnerNetConList = [select id from PartnerNetworkConnection where connectionName = 'XYZ' and connectionStatus = 'Accepted'];
if (partnerNetConList.size()==1)
{
  PartnerNetworkConnection connection = partnerNetConList.get(0);
 
  for (Note note: Trigger.new)
  {
    PartnerNetworkRecordConnection newConnection =
                      new PartnerNetworkRecordConnection(
                          ConnectionId = connection.Id,
                          LocalRecordId = note.Id
                          );
   
    insert newConnection;
  
  }
}
}

I see the same behavior with Attachments.  Is there another S2S method to share these objects (I am aware of the REST alternative).

Thanks!

  • September 19, 2013
  • Like
  • 0

Can Notes and Attachments be shared using an after insert trigger and the PartnerNetworkRecordConnection object?  The PartnerNetworkRecordConnection does not accept the "Id" field from Notes and Attachments (wrong type), although it does for Account/Contact/etc.  Is this a known limitation, or am I perhaps doing something wrong?  

Error Message on note save: Apex trigger triggerNoteExample caused an unexpected exception, contact your administrator: triggerNoteExample: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Local Record ID: id value of incorrect type: 002f0000000b6SxAAI: [LocalRecordId]: Trigger.triggerNoteExample: line 16, column 1

// Example
trigger triggerNoteExample on Note (after insert)
{
List<PartnerNetworkConnection> partnerNetConList = [select id from PartnerNetworkConnection where connectionName = 'XYZ' and connectionStatus = 'Accepted'];
if (partnerNetConList.size()==1)
{
  PartnerNetworkConnection connection = partnerNetConList.get(0);
 
  for (Note note: Trigger.new)
  {
    PartnerNetworkRecordConnection newConnection =
                      new PartnerNetworkRecordConnection(
                          ConnectionId = connection.Id,
                          LocalRecordId = note.Id
                          );
   
    insert newConnection;
  
  }
}
}

I see the same behavior with Attachments.  Is there another S2S method to share these objects (I am aware of the REST alternative).

Thanks!

  • September 19, 2013
  • Like
  • 0