Skip to Content
Former Member
Feb 10, 2016 at 11:41 AM

JobSearchRestriction is not working during sync from productcockpit?



Job Search restriction is not working when performing synchronization from product cockpit . Requirement is, only approved products should get sync . I have tried it by overriding SyncItemJob.createSyncSessionContext(SyncItemCronJob cronJob). Applied restriction for sync job as mention below:-

INSERT_UPDATE PCMSyncItemJob;code[unique=true];syncPrincipals(uid);$sourceVersion;$targetVersion ;syncProductCatalog;namanagergroup,globaladmingroup;

INSERT_UPDATE JobSearchRestriction;code[unique=true];job(code);query;type(code) ;syncrestriction;syncProductCatalog;{approvalStatus}=({{select {} from {ArticleApprovalStatus as a} where {a.code}='approved'}});Product

public class PCMSyncItemJob extends SyncItemJob {

 protected SessionContext createSyncSessionContext(SyncItemCronJob cronJob)
     final SessionContext ctx = super.createSyncSessionContext( cronJob );
     ctx.setAttribute("disableRestrictions", Boolean.FALSE); // ENABLE User restrictions
     ctx.setAttribute("disableRestrictionGroupInheritance", Boolean.FALSE);  // ENABLE GROUP restrictions
     ctx.setUser( cronJob.getSessionUser());     //THIS IS THE ADDED LINE TO MAKE IT WORK FROM THE COCKPIT.
     return ctx;


please provide your inputs.