0

I created a Sharepoint 2013 app and I am trying to connect two lists with a lookup. If I set RelationshipDeleteBehavior="Cascade" on the lookup field the deploy of the app fails even if I also set Indexed="true".

I am developing the app with Visual Studio.

Am I doing something wrong or is there another way to enforce cascade delete relationship?

3 Answers 3

1

I experienced the same issue when trying to set the property in the column definition I deploy with my app, however I have been able to specify this property in the "Field" element inside the schema.xml file for the list template that I deploy along with my app. However, it does not seem to be preforming the cascade delete, even with the Indexed="true", and EnforceUniqueValues="True" also specified.

Any progress made by anyone on this issue?

0

I have noticed problems with the lookup/relationship behavior attribute when a feature is not deployed in the correct dependency order. If a list is deployed before its dependency (another list), the constraint is not implemented. Take a look at this reference for more information:

http://www.ozkary.com/2015/11/sharepoint-app-list-lookup-delete.html

I hope this helps.

0

Don't know if you have found a solution to this problem.

I had the same problem, trying to set the RelationshipDeleteBehavior (xml) when creating the field. I managed to set the RelationshipDeleteBehavior if I updated the field while setting the contenttype to the list.

So basically I created a function that uses ctx and item as arguments. Then I used it to get the listId and list, I used that to get the ContentType (that I shall add to my list).

Then I get each field of the list and setting update to true, and then I get the schemaXml for each field and replace the /> with 'Indexed="TRUE" RelationshipDeleteBehavior="Restrict" />'.

For example:

var schemaXml = field.get_schemaXml();
schemaXml = schemaXml.replace("/>", ' Indexed="TRUE" RelationshipDeleteBehavior="Restrict" />');
field.set_schemaXml(schemaXml);
field.update();

This worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.