I'm new to Liferay and work on a site done with Liferay 6.1.1.
I have a question about deleting organization. When I try to delete an organization, I have an error message
You cannot delete organizations that have suborganizations or users.
I found that before deleting the organization, I had to delete this organization's site and unasign all user manually, then the organization can be delete without error.
Does anybody know if it is possible to add a property or edit the delete function so when you try to delete an organization it'll do the previous task automatically ?
I think it is not possible to achieve/fulfill your requirement just by setting property. However, you can achieve this by creating
Hook
in liferay. Inside hook you can use below Liferay's api :OrganizationLocalServiceUtil.getSuborganizations(long companyId, long organizationId)
which will return list of sub organization. You can iterate this list and callOrganizationLocalServiceUtil.deleteOrganization(long organizationId)
which will delete sub organization.UserLocalServiceUtil.clearOrganizationUsers(long organizationId)
HTH