0

I have a lightning component that redirects to a custom report passing filters via url. This component is working inside a community and, as far as I know, you need to generate your url with a 'reportFilters' url parameter.

This parameter is an encoded string based on a JSON with this structure:

[ {'operator' : 'equals', 'value' : value, 'column' : columnName}, {...} ]

The point is that if I try putting an operator different from 'equals' it tells me that kind of value for operator doesn't exist although is referenced in salesforce documentation (https://help.salesforce.com/articleView?id=filter_operators.htm&type=5).

Does anyone know how can I implement this or if it's a salesforce limitation?

EDIT

The fields that need to have this operator are datetime fields parsed as String (CreatedDate and LastModifiedDate). Maybe I need to pass them as date values instead of string?

2 Answers 2

0

You should actually use greaterthan or lessthan. You also have lessthanorequal and greaterthanorequal. You cannot use > or < directly because that implies starting or ending of tag. Also you should not really use == as a best practice. Instead you should be using equals.

In Expression Functions Reference, you will find all the function names that can be used.


NOTE

If you need < or > in value, you can set it in javscript controller.

Example:

cmp:

<aura:attribute name="myUrl" type="String" default="" />

<aura:handler name="init" value="{!this}" action="{!c.doInit}" />

{!myUrl}

JS:

doInit : function (component, event, helper) {
    component.set("v.myUrl", "https://www.some.url.with_>_and_<_works_Fine_Here");
},
4
  • Hi, I also tried greaterthan and lessthan but receiving the same error message (non valid operator)
    – molinet
    Commented Aug 9, 2019 at 10:27
  • added solution for your prob Commented Aug 9, 2019 at 10:37
  • Hi, I just find out that the operator is case sensitive and although it says that you can use 'greaterthan' or 'lessthan' you must use 'greaterThan' and 'lessThan' instead.
    – molinet
    Commented Aug 9, 2019 at 10:38
  • capitals will not work. its all small, Commented Aug 9, 2019 at 10:39
0

I just find out that the issue was with the operator value declaration. It needs to be 'greaterThan' and 'lessThan' instead of 'greaterthan' and 'lessthan' although sf documentation doesn't say so.

2
  • greaterThan will not even compile Commented Aug 9, 2019 at 10:43
  • Failed to save POC_AURA.cmp: c:POC_AURA:9,3: No function found for key: greaterThan: Source Commented Aug 9, 2019 at 10:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .