[BUG] cms.run action - delete fails
Bug Affects...
[x] JS development [x] Content Types or data management [x] APIs like REST
Current Behavior / Expected Behavior
Trying:
$2sxc(111).cms.run({ action: 'delete', params: { entityId: 222 } })
But also tested all other variants of the command I could find.
All reproduce this error:
This issue only seem to affect delete. All other actions work as intended. Tested user is host.
Your environment
- 2sxc version(s): 19.03
- DNN / Oqtane: DNN 9 and 10
to me it seems like the message says the entity is in use. are you sure it's a bug in the API?
Yes. Tested in a fresh app with a single entity type. No relations.
Also, check the "undefined" in the API request and the "Toolbar.Delete" in the message popup.
I just did some tests and I believe delete works.
https://2sxc.org/dnn-tutorials/en/razor/tut/js-edit is a demo. Because of LightSpeed caching, you cannot see the effect (I have to figure out how to improve that), but on another site without caching it's clearly visible.
So I believe the API is working, but I do think that your entity is in use - probably on the module where you're seeing it.
I'm pretty sure if you go to admin and see the item, you'll see that it's in use once.
Ok... A few notes:
- The item is clearly not being used anywhere. It's a blank app, a single content type, no relations anywhere.
- This tutorial pointing to the data API seems a completely different API from the cms.run.
I now tried this:
<script>
function deleteItem(eID) {
$2sxc(@MyContext.Module.Id).cms.run({ action: 'delete', params: { entityId: eID } });
}
function deleteItemNew(eID) {
$2sxc(@MyContext.Module.Id).data('teste').delete(eID);
}
</script>
deleteItem shows the error mentioned in the topic. deleteItemNew works as intended.
now that's interesting, thanks for the follow up, will look into it.
Perhaps related ?? For some reason it seems:
-
I cannot delete items anymore I did something like : var toolbar = Kit.Toolbar.Empty().Edit().Remove().For(item).AsTag(); When I try to delete it says it will remove item undefined "[title of the item]" When I click OK it doest a DELETE request with a 400 (Bad request): https://websiteaddress/api/2sxc/app/auto/content/any/c5ac67c6-b17c-4464-a6aa-5228af2cf5b1?zoneId=2&appId=35 Saying it is probably still in use. Well it is, in this module but not anywhere else....
-
the 'Remove' action is not showing. As an alternative, I tried: var toolbar = Kit.Toolbar.Empty().Edit().Remove().For(item).AsTag(); But the remove icon is not showing up, only an edit icon.