开发者

Dynamics 2011 Intersect / Junction entity

开发者 https://www.devze.com 2023-04-13 05:51 出处:网络
I have 3 entities. PortalRole, Person and PersonPortalRole PersonPortalRole is a intersection entity to deal with my Many-Many relationship.

I have 3 entities.

PortalRole, Person and PersonPortalRole

PersonPortalRole is a intersection entity to deal with my Many-Many relationship.

I am using JavaScript through a HTML web resource to allow the creation and removal of this entity. I can create new entities by using the REST service fairly easily but I can't find a way of deleting a intersect record (two lookup fields) usin开发者_如何学Pythong the PersonId and PortalRoleId.

Has anyone had any exposure to either deleting a record through REST using the two foreign keys values from a lookup? I was trying to get the object first using a filter but can't seemt o filter using the lookup primary keys.

Was trying something like below which returns 15 entries to then filter the results to get the primary key, and then delete using that key but not sure on the way to do this.

SERVER/INSTANCE/XRMServices/2011/OrganizationData.svc/personportalrolesSet?$expand=Person,PortalRole


Based on that URI, you are interacting with an OData service. OData uses Atom feeds for returning lists of stuff so you will likely find within each <entry> element a <id> element that contains the URL of the resource. If you issue a HTTP DELETE to that URL then your resource will be deleted.

See docs here http://www.odata.org/developers/protocols/operations#DeletingEntries


I don't use the REST endpoint, but there's no way I know of to end a many-to-many relationship except through sending a Disassociate request (or if you have access to the SQL box, direct insertion/deletion in that table). MS has some sample code available that shows how to do this using the REST Endpoint.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号