0

We were tasked to help a client with their email campaigns. They want ask complex questions to get a list of account that match their criteria. The first, and simple, question they asked was to get a list of accounts that have open 5 low priority cases and have made an order this year. The client needs to be able to change these variables them self, the amount of orders, when the order was placed, amount of cases and what priority.

I have made a dataflow that collects all the data without any filter. We then want to provide a Lens, which is user friendly, with the filters pre-setup for them to tinker with. The account that you see in the screenshot has 6 cases, 4 low, 1 medium and 1 high priority.

lens

The issue here is that the filters don't behave like we would expect it to be. I would expect the filter to first filter out any cases that arn't low priority and then check if there are 5 or more cases left (there should only be 4). This is obviously not happening.

Quick note before continuing: The dataset has account rows with each an array attached of cases and orders like your SObjects in apex. Not like SQL joins where you have multiple rows with all the data joined together in each row.

What I assume that happens is that the filter checks if the account as a single case with low priority and does not filter out the others. That check succeeds. It then check if it has 5 or more cases, since there are still 4 low, 1 medium and 1 high priority cases, 6 total, it succeeds.

My question is: can I get the filter, in the lens or with an other user friendly UI, to behave the way I would expect it to.

{
  "sfdcDigest_Case": {
    "action": "sfdcDigest",
    "parameters": {
      "fields": [
        {
          "name": "AccountId"
        },
        {
          "name": "Id"
        },
        {
          "name": "Priority"
        },
        {
          "name": "Subject"
        }
      ],
      "object": "Case"
    }
  },
  "augment_Account_Case": {
    "action": "augment",
    "parameters": {
      "right_key": [
        "AccountId"
      ],
      "left": "sfdcDigest_Account",
      "left_key": [
        "Id"
      ],
      "right_select": [
        "Priority",
        "Subject",
        "Id"
      ],
      "right": "sfdcDigest_Case",
      "relationship": "Case",
      "operation": "LookupMultiValue"
    }
  },
  "register_Accounts_with_Orders_Cases": {
    "action": "sfdcRegister",
    "parameters": {
      "name": "Accounts with Orders and Cases",
      "alias": "Accounts_with_Orders_Cases",
      "source": "merge"
    }
  },
  "sfdcDigest_Account": {
    "action": "sfdcDigest",
    "parameters": {
      "fields": [
        {
          "name": "Id"
        },
        {
          "name": "Name"
        }
      ],
      "object": "Account"
    }
  },
  "merge": {
    "action": "augment",
    "parameters": {
      "right_key": [
        "Id"
      ],
      "left": "augment_Account_Order",
      "left_key": [
        "Id"
      ],
      "right_select": [
        "Case.Id",
        "Case.Priority",
        "Case.Subject"
      ],
      "right": "augment_Account_Case",
      "relationship": "Case",
      "operation": "LookupMultiValue"
    }
  },
  "sfdcDigest_Order": {
    "action": "sfdcDigest",
    "parameters": {
      "fields": [
        {
          "name": "AccountId"
        },
        {
          "name": "Id"
        },
        {
          "name": "EffectiveDate"
        }
      ],
      "object": "Order"
    }
  },
  "augment_Account_Order": {
    "action": "augment",
    "parameters": {
      "right_key": [
        "AccountId"
      ],
      "left": "sfdcDigest_Account",
      "left_key": [
        "Id"
      ],
      "right_select": [
        "Id",
        "EffectiveDate"
      ],
      "right": "sfdcDigest_Order",
      "relationship": "Order",
      "operation": "LookupMultiValue"
    }
  }
}

Original post: https://developer.salesforce.com/forums?communityId=09aF00000004HMGIA2#!/feedtype=SINGLE_QUESTION_DETAIL&dc=Other_Salesforce_Applications&criteria=OPENQUESTIONS&id=9060G0000005g4zQAA

0

You did all the hardwork buddy,

first filter out any cases that arn't low priority you missed out the filter to be not equal to low priority

apart from your lens thought. I was thinking to build a dashboard, having case Priority filter, a Count filter, date filter. now facet/bind these filter with the chart. which will provide user a great UI to solve the requirement. He can select High or low or normal through case priority, Select case count > 3,4,5,6....10-15 etc Select date range

if all the fields are from same dataset then its automatically does the filtering. else you can bind them for the filter purpose.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.