Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Help! M2M Relationship Removal

Shane11
Mega Expert

I've been looking and I can't find any information on how to remove a Many to Many relationship table as created by the sys_m2m table.

I created M2M relationships from a table to Change Request then realized I could have used Task which would allow me to use it for Change, Incident, etc. so i created my relationship to Task, but now I need to remove the old one, it won't let me delete the relationship.

4 REPLIES 4

Shane11
Mega Expert

I thought I could just disable the ACL which restricts deletion, I just wanted someone to verify that I wouldn't be leaving pieces behind, after more research today I found this :

http://www.servicenowguru.com/system-definition/relationships/creating-manytomany-relationship-servicenowcom/

Mark Stanger 10-01-2011, 01:03 :
.... The only way to delete the m2m entry is to disable the security ACL on the 'sys_m2m' table first....

Thanks again SNC Guru!


NeilH2
Giga Guru

I have been looking for this solution for a long time thanks 🙂


I hoped it might help someone.

I don't know if it's recommended, but because only a very few of us have the access I changed the ACL to allow 'security_admin' to delete.


Chris Hagy
Tera Expert

Way late but I just had this issue and thought i'd post my fix.. I was trying to remove an m2m relationship for a table that I had deleted and like you couldn't find a 'delete' option.

 

 I exported the XML and changed the <sys_m2m action="INSERT_OR_UPDATE"> to <sys_m2m action="DELETE"> then used the "import xml" from any list view and it seems to have done the trick.

 

Steps:

1) delete the m2m table itself

2) export the XML of the m2m relationship definition

3) edit the sys_m2m action to state DELETE

4) use the import XML option

5) Validate removal.