How to assign an existing Site Template to a Site Programmatically in Liferay DXP 7.4

63 views Asked by At

I have found some solutions but they are old like 2014 or more I want an updated solution to this problem.

I am using Liferay DXP version 7.4

I have tried this code but its not working :

 LayoutSetPrototype layoutSetPrototype = LayoutSetPrototypeLocalServiceUtil.fetchLayoutSetPrototype(layoutSetPrototypeId);
    String layoutSetPrototypeUuid = layoutSetPrototype.getUuid();
    try {
        LayoutSetLocalServiceUtil.updateLayoutSetPrototypeLinkEnabled(group.getGroupId(), privateLayout, true, layoutSetPrototypeUuid);
        LayoutLocalServiceUtil.updatePriorities(group.getGroupId(), privateLayout);
    } catch (PortalException e) {
        log.error("Failed trying to use site template when creating group", e);
    }

The above code is mentioned in this article :(https://liferay.dev/es/ask/questions/development/how-to-add-site-template-to-a-site-programmatically--1)

0

There are 0 answers