locked
what's wrong with this associate call? RRS feed

  • Question

  • Hello, any idea what might be wrong with the associate call in the following method?:

        public void AssociateParentChild(IOrganizationService orgService, Guid parentIncidentId)
        {
            //hard-coded guid for test purposes
            var child = orgService.Retrieve("incident", new Guid("FC48CDB2-8C25-E311-B7DA-00155D760004"), new ColumnSet(true));
            var relatedEntities = new EntityReferenceCollection();
            relatedEntities.Add(child.ToEntityReference());
            orgService.Associate("incident", parentIncidentId,
                new Relationship("new_incident_incident_Parent") { PrimaryEntityRole = EntityRole.Referenced }, relatedEntities);
        }

    I've validated that the guids used for this method are valid.  The relationship name used in the associate call is correct.  However, the associate call returns the following error:

        Value cannot be null.

        Parameter name: source

    Any idea what the issue might be here?

    Wednesday, November 20, 2013 2:43 AM