Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Used API’s: findByQuery, isOpportunityPage, getPayload, setHeaderInputValue

Filter Data in the CLIC Module List

In this example, we will filter rebates, but you can filter any CLIC module.

Code Block
languagejs
// First we need to use Method which triggers when we open rebate list
export const rebateAgreementsListFilterAdd = async ({ api, filter }) => {
  const { crmManager } = api;
  // Let's use payload for make our filter more interesting
  const payload = await crmManager.getPayload();
  // Also let's return different filter based on where iFrame is located
  const isAccountPage = await crmManager.isAccountPage();
  const isOpportunityPage = await crmManager.isOpportunityPage();
  
  if(isAccountPage) {
    return [{
      fieldName: 'additionalInfo1',
      operator: 'equals',
      value: payload.AccountNumber
    }];
  }
  if(isOpportunityPage) {
    return [{
      fieldName: 'additionalInfo2',
      operator: 'equals',
      value: payload.OpportunityId
    }];
  }
  
  return filter;
}

Used API’s: isAccountPage, isOpportunityPage, getPayload