Adnan
Adnan

Reputation: 276

What should be put as groupId for portal level entities like Users etc

I'm creating a portal level entity without groupId column since the data will not belong to any group/site. But for a certain requirement (example given below), I notice we need to provide groupId to pull some information. My questions

  1. Should we still consider having groupId column? (I think no)
  2. What groupId should we use when the entity is not site/group specific

I came across this issue while trying to enable searching and integrating with asses framework on my entity (without groupId). As per tutorial, I need following as a first step

<finder name="G_S" return-type="Collection">
    <finder-column name="groupId" />
    <finder-column name="status" />
</finder>

https://dev.liferay.com/develop/tutorials/-/knowledge_base/7-0/enabling-assets-at-the-service-layer

Now I don't have any such column, what should I do?

Upvotes: 1

Views: 34

Answers (1)

dnebing
dnebing

Reputation: 355

Actually I would try to encourage you not to think the entities are global only.

If you are in a single site situation, this works just fine as you can keep all of the entities with the site and it acts as though they are "global".

If you are in a multi-site situation, it can seem like you just want one entity shared across all of the sites. Often times what I've found, though, is that things you want to create and use globally, often your sites will want to do something similar for a site-local application.

If you want to stay on your path, then the Global group is the way to go. You can retrieve this using the following:

Group globalGroup = _groupLocalService.getFriendlyURLGroup(
    companyId, GroupConstants.GLOBAL_FRIENDLY_URL);

Upvotes: 1

Related Questions