Create Many to Many relationship via webservices RRS feed

  • Question

  • Hi,

    Using webservices I have created an instance of and entity called new_property and an instance of an entity called new_deal.

    These two entities are related by a many to many relationship.

    How do I create that relationship using code?

    I tried below but it doesn't work (the trace says The 'Create' method does not support entities of type 'new_propertytodeal' which I believe is the name of the link entity in the relationship))

    //create link between property and deal
                    DynamicEntity dynEntity = new DynamicEntity();
                    dynEntity.Name = "new_propertytodeal";

                    LookupProperty propertyID = new LookupProperty();
                    propertyID.Name = "new_propertyid";
                    Lookup  proplookup = new Lookup();
                    proplookup.Value = priopertyGuid;
                    propertyID.Value = proplookup;
                    LookupProperty dealID = new LookupProperty();
                    dealID.Name = "new_dealid";
                    Lookup deallookup = new Lookup();
                    deallookup.Value = dealGuid;
                    dealID.Value = deallookup;

                    dynEntity.Properties = new Property[] { propertyID, dealID };

                        TargetCreateDynamic myTarget = new TargetCreateDynamic();
                        myTarget.Entity = dynEntity;
                        CreateRequest create = new CreateRequest();
                        create.Target = myTarget;
                        CreateResponse myResponse = (CreateResponse)service.Execute(create);
    Monday, September 22, 2008 9:28 PM


  • I answered my own question. Use AssociateEntitiesRequest....
    Monday, September 22, 2008 11:35 PM