Fórumok

Create an organization

Leonardo Santos-Macias, módosítva 12 év-val korábban

Create an organization

New Member Bejegyzések: 2 Csatlakozás dátuma: 2011.05.18. Legújabb bejegyzések
I need some help creating a new organization

Everything I have found and tried takes an orgId, I am looking for something like new Organization() that or .create() that creates one with the next available id.

I tried OrganizationUtil.create(0) and OrganizationUtil.create(-1) and a new Org was created with either id 0 or even -1
thumbnail
Julien Bonjean, módosítva 12 év-val korábban

RE: Create an organization

Junior Member Bejegyzések: 57 Csatlakozás dátuma: 2009.06.10. Legújabb bejegyzések
You should use OrganizationLocalServiceUtil.addOrganization method.
Leonardo Santos-Macias, módosítva 12 év-val korábban

RE: Create an organization

New Member Bejegyzések: 2 Csatlakozás dátuma: 2011.05.18. Legújabb bejegyzések
thanks... but I already tried that and takes either user or organization object. The first one is ok but I need this for a "company admin" portlet, do not want to add the current user to the organization, just create one with no users. The second one takes an existing org and I can't do Organization = new Organization()

OrganizationLocalServiceUtil.addOrganization(userId, parentOrganizationId, name, type, recursable, regionId, countryId, statusId, comments, serviceContext)
OrganizationLocalServiceUtil.addOrganization(organization)
thumbnail
Julien Bonjean, módosítva 12 év-val korábban

RE: Create an organization

Junior Member Bejegyzések: 57 Csatlakozás dátuma: 2009.06.10. Legújabb bejegyzések
You can try with default user:
long defaultUserId = UserLocalServiceUtil.getDefaultUserId(companyId);