Define the Mapper Script

Use the mapper script to define a script to be executed during the update user segments process.

Procedure

  1. In Backoffice Administration Cockpit, go to Start of the navigation pathSystem Next navigation step Scripting Next navigation step ScriptingEnd of the navigation path
  2. Choose the Cx Mapper Script type from the top menu. You can do so by clicking the arrow button and then clicking the arrow next to the Script label.
  3. Use the wizard to create a new mapper script.
    Field Value
    Script code titleMapperScript
    Script engine type GROOVY
    Script group complexProviderGroup
    Content
    import de.hybris.platform.core.model.user.CustomerModel;
    import de.hybris.platform.core.model.user.TitleModel;
    import de.hybris.platform.personalizationintegration.mapping.SegmentMappingData;
     
    CustomerModel customer = externalData;
    TitleModel title = customer.getTitle();
    if (title != null)
    {
        SegmentMappingData segment = new SegmentMappingData();
        segment.setAffinity(java.math.BigDecimal.ONE);
        segment.setCode("TITLE_" + title.getCode());
        return [segment]
    }
    else { return []}
  4. Go to the storefront and log in as trail@hybris.com.
  5. Go to the Backoffice Administration Cockpit and verify TITLE segment with a C prefix was assigned to the user.