Marketcircle    Forums  Hop To Forum Categories  Extending Daylite  Hop To Forums  Scripting    Relating contacts - not happening..
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Journeyman
Posted
Ok, I've got 2 contacts (by contactID) and want to establish a relationship. It seems as if creating a new relationship object and setting the source and destination contacts, as well as the relationship type, should do it - but no go. No error, but no relationship, either.. Any ideas?

-- assume we already have 2 contact objects

-- and this is getting the relationship type

relqual := BDQualifier qualifierWhereValueOfKey:'name' isLike:'is spouse of'.
relTypeContext := objectContext objectsForEntityNamed:'RelationshipType' matchingQualifier:relqual.
theRelType := relTypeContext objectAtIndex:0.
theRelTypeID := theRelType relationshipTypeID.

newRelationship := (createContactContext createObjectForEntityNamed:'Relationship' addToObjectContext: YES).

newRelationship setValue:firstContactSetID forKeyPath:'sourceContact.contactID'.
newRelationship setValue:secondContactSetID forKeyPath:'destinationContact.contactID'.
newRelationship setValue:theRelTypeID forKeyPath:'relationshipType.relationshipTypeID'.

objectContext saveChanges.

-- The relationship does get created, I can log it's relation ID. Just not getting the actual contacts to relate.

Thanks!
-E
 
Posts: 96 | Location: San Francisco | Registered: June 22, 2006Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

Marketcircle    Forums  Hop To Forum Categories  Extending Daylite  Hop To Forums  Scripting    Relating contacts - not happening..

© Copyright 2006 Marketcircle Inc. All rights reserved.