How to get Url Patterns for Particular Site using Groovy Script in Hybris?

  1. In the SAP Commerce Administration Console, go the Console tab, select the Scripting Languages option, and select Groovy in the Script type drop-down menu.
  2. Enter the Groovy script.

import de.hybris.platform.servicelayer.search.FlexibleSearchService
import de.hybris.platform.servicelayer.search.SearchResult
import de.hybris.platform.cms2.model.site.CMSSiteModel;

Map params = new HashMap();
String query = “select {p:pk} from {CMSSite as p } where {p:uid} in (‘DemoSite1′,’DemoSite2’)”
params = null;
FlexibleSearchService fss = spring.getBean(“flexibleSearchService”);
final SearchResult searchResult = fss.search(query, params);
for (final CMSSiteModel csmSite : searchResult.getResult()){
println csmSite.getUid()+” – “+csmSite.getUrlPatterns();
};

Leave a Comment

Your email address will not be published. Required fields are marked *