I'm having this issue with a self-referencing 1:N relationship-
I'm trying to associate entity A (of type new_transaction
) with entity B (of the same type).
The association works fine (I've checked in the DB- 'new_relatedTransactionId'
column is updated correctly).
however, the name column ('new_relatedTransactionIdName'
) is set to NULL
, causing the form to display an empty text box...
I've tried the following methods, with no success-
1.
var rel = new Relationship(relationshipName) {PrimaryEntityRole = EntityRole.Referenced};
EntityReferenceCollection relatedEntities = new EntityReferenceCollection();
relatedEntities.Add(relatedTransaction.ToEntityReference());
crmServiceContext.Associate(new_transaction.EntityLogicalName,sourceTransaction.Id,rel,relatedEntities);
2
sourceTransaction.lv_relatedtransactionid = relatedTransaction.ToEntityReference();
crmServiceContext.UpdateObject(sourceTransaction);
3
crmServiceContext.AddLink(sourceTransaction, new Relationship(relationshipName) { PrimaryEntityRole = EntityRole.Referenced }, relatedTransaction);
I've tried switching EntityRole.Referenced
and EntityRole.Referencing
, still no luck there.
Anyone encountered a similar issue?