liferayliferay-6liferay-hook

Add Team From startup event in liferay 6.2 ga4


i'm currently developing hook for user registration (jsp , action ,startup action) i wont at startup time (application.startup.events) to create 2 teams using this code but isn't work

Team team=TeamLocalServiceUtil.createTeam(CounterLocalServiceUtil.increment());
    team.setCompanyId(companyId);
    team.setName("individual");
    team.setDescription("individual individual");
    TeamLocalServiceUtil.addTeam(team);

could any one help me


and I've inspected team table in database there are 2 fields (companyid and groupid ) i can't see what is difference between them they are facing me any where what their benefit and how i can find them


Solution

  • companyId is what the UI calls "instance". Most likely you have only one. The technical name groupId typically refers to the site that you create the team in.

    I'd rather advise to create the team in a single call:

    Team team = TeamLocalServiceUtil.addTeam(ownerId, groupId, name, description)
    

    If this doesn't help, please update your question with more information than "doesn't work". You can be a lot more specific.