Hi All
I am getting the error with reject function so please let me know what causing this error .
[Expression evaluation error at function 'reject' [line 39]: Incorrect number of parameters for function; expected 1 parameters, but found 0 parameters.]
a!localVariables( local!group: index( rule!CDM2_findUserGroup(loggedInUser()), 1, {} ), local!escalatedTo: if( a!isNullOrEmpty(local!group), {}, index( a!queryEntity( entity: cons!CDM2_DSE_INQUIRIES, query: a!query( aggregation: a!queryAggregation( aggregationColumns: { a!queryAggregationColumn(field: "escalatedTo", isGrouping: true) } ), logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "groupId", operator: "=", value: local!group ) }, ignoreFiltersWithEmptyValues: false ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: - 1) ), fetchTotalCount: false ), "data", "escalatedTo", null() ) ), local!tmodData: reject(fn!isnull, a!forEach( items: local!escalatedTo, expression: if( a!isNullOrEmpty(fv!item), {}, if( not(isusernametaken(fv!item)), fv!item, null() ) ) )), local!tmodGivenNames: if( a!isNotNullOrEmpty(local!tmodData), index( a!queryEntity( entity: cons!TMODS_DSE, query: a!query( selection: a!querySelection( columns: { a!queryColumn(field: "given_name"), a!queryColumn(field: "preferred_given_name"), a!queryColumn(field: "enterprise_login_id"), } ), logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "enterprise_login_id", operator: "IN", value: upper(local!tmodData) ) }, ignoreFiltersWithEmptyValues: true ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: - 1) ), fetchTotalCount: false ), "data", null() ), {} ), local!groupMembers:a!forEach( items: local!escalatedTo, expression: if( a!isNullOrEmpty(fv!item), {}, if( not(isusernametaken(fv!item)), { xid: fv!item, name: a!localVariables( local!blankTmodGivenName: displayvalue( upper(fv!item), touniformstring( local!tmodGivenNames.enterprise_login_id ), if( /*a!isNullOrEmpty(local!tmodGivenNames.preferred_given_name),*/ a!isNullOrEmpty(index(local!tmodGivenNames.preferred_given_name,wherecontains(upper(fv!item),touniformstring(local!tmodGivenNames.enterprise_login_id)),{})), local!tmodGivenNames.given_name, local!tmodGivenNames.preferred_given_name ), {} ), if( a!isNullOrEmpty(local!blankTmodGivenName), fv!item, local!blankTmodGivenName ) ) }, { xid: fv!item, name: user(fv!item, "firstName") & " " & user(fv!item, "lastName") } ) ) ), a!recordFilterList( name: "Escalated To", isVisible: a!isNotNullOrEmpty(local!groupMembers), options: a!forEach( items: local!groupMembers, expression:a!recordFilterListOption( id: fv!index, name: fv!item.name, filter: a!queryFilter( field:'recordType!{92bc5c32-2509-4558-b252-56df608deb1a}CDM2 Inquiries.fields.{escalatedTo}escalatedTo', operator: "=", value: fv!item.xid ) ) ) ) )
I am geeting the error in reject function when the "AssignTo" is null
Discussion posts and replies are publicly visible
jojog0003 Can you try this code and let me know if that works for you.
a!localVariables( local!group: index( rule!CDM2_findUserGroup(loggedInUser()), 1, {} ), local!escalatedTo: if( a!isNullOrEmpty(local!group), {}, index( a!queryEntity( entity: cons!CDM2_DSE_INQUIRIES, query: a!query( aggregation: a!queryAggregation( aggregationColumns: { a!queryAggregationColumn(field: "escalatedTo", isGrouping: true) } ), logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "groupId", operator: "=", value: local!group ) }, ignoreFiltersWithEmptyValues: false ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: - 1) ), fetchTotalCount: false ), "data", "escalatedTo", null() ) ), local!tempTmodData:a!flatten( a!forEach( items: local!escalatedTo, expression: if( a!isNullOrEmpty(fv!item), {}, if( not(isusernametaken(fv!item)), fv!item, null() ) ) ) ), local!tmodData: if( a!isNotNullOrEmpty(local!tempTmodData), reject(fn!isnull, local!tempTmodData), {} ), local!tmodGivenNames: if( a!isNotNullOrEmpty(local!tmodData), index( a!queryEntity( entity: cons!TMODS_DSE, query: a!query( selection: a!querySelection( columns: { a!queryColumn(field: "given_name"), a!queryColumn(field: "preferred_given_name"), a!queryColumn(field: "enterprise_login_id"), } ), logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "enterprise_login_id", operator: "IN", value: upper(local!tmodData) ) }, ignoreFiltersWithEmptyValues: true ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: - 1) ), fetchTotalCount: false ), "data", null() ), {} ), local!groupMembers:a!forEach( items: local!escalatedTo, expression: if( a!isNullOrEmpty(fv!item), {}, if( not(isusernametaken(fv!item)), { xid: fv!item, name: a!localVariables( local!blankTmodGivenName: displayvalue( upper(fv!item), touniformstring( local!tmodGivenNames.enterprise_login_id ), if( /*a!isNullOrEmpty(local!tmodGivenNames.preferred_given_name),*/ a!isNullOrEmpty(index(local!tmodGivenNames.preferred_given_name,wherecontains(upper(fv!item),touniformstring(local!tmodGivenNames.enterprise_login_id)),{})), local!tmodGivenNames.given_name, local!tmodGivenNames.preferred_given_name ), {} ), if( a!isNullOrEmpty(local!blankTmodGivenName), fv!item, local!blankTmodGivenName ) ) }, { xid: fv!item, name: user(fv!item, "firstName") & " " & user(fv!item, "lastName") } ) ) ), a!recordFilterList( name: "Escalated To", isVisible: a!isNotNullOrEmpty(local!groupMembers), options: a!forEach( items: local!groupMembers, expression:a!recordFilterListOption( id: fv!index, name: fv!item.name, filter: a!queryFilter( field:'recordType!{92bc5c32-2509-4558-b252-56df608deb1a}.fields.{escalatedTo}', operator: "=", value: fv!item.xid ) ) ) ) )
It's not even necessary to do this in 2 steps. Just replace the "null()" on line 47 with an empty set.
Mike Schmitt We can get rid of reject.
a!localVariables( local!group: index( rule!CDM2_findUserGroup(loggedInUser()), 1, {} ), local!escalatedTo: if( a!isNullOrEmpty(local!group), {}, index( a!queryEntity( entity: cons!CDM2_DSE_INQUIRIES, query: a!query( aggregation: a!queryAggregation( aggregationColumns: { a!queryAggregationColumn(field: "escalatedTo", isGrouping: true) } ), logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "groupId", operator: "=", value: local!group ) }, ignoreFiltersWithEmptyValues: false ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: - 1) ), fetchTotalCount: false ), "data", "escalatedTo", null() ) ), local!tmodData:a!flatten( a!forEach( items: local!escalatedTo, expression: if( a!isNullOrEmpty(fv!item), {}, if( not(isusernametaken(fv!item)), fv!item, {} ) ) ) ), local!tmodGivenNames: if( a!isNotNullOrEmpty(local!tmodData), index( a!queryEntity( entity: cons!TMODS_DSE, query: a!query( selection: a!querySelection( columns: { a!queryColumn(field: "given_name"), a!queryColumn(field: "preferred_given_name"), a!queryColumn(field: "enterprise_login_id"), } ), logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "enterprise_login_id", operator: "IN", value: upper(local!tmodData) ) }, ignoreFiltersWithEmptyValues: true ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: - 1) ), fetchTotalCount: false ), "data", null() ), {} ), local!groupMembers:a!forEach( items: local!escalatedTo, expression: if( a!isNullOrEmpty(fv!item), {}, if( not(isusernametaken(fv!item)), { xid: fv!item, name: a!localVariables( local!blankTmodGivenName: displayvalue( upper(fv!item), touniformstring( local!tmodGivenNames.enterprise_login_id ), if( /*a!isNullOrEmpty(local!tmodGivenNames.preferred_given_name),*/ a!isNullOrEmpty(index(local!tmodGivenNames.preferred_given_name,wherecontains(upper(fv!item),touniformstring(local!tmodGivenNames.enterprise_login_id)),{})), local!tmodGivenNames.given_name, local!tmodGivenNames.preferred_given_name ), {} ), if( a!isNullOrEmpty(local!blankTmodGivenName), fv!item, local!blankTmodGivenName ) ) }, { xid: fv!item, name: user(fv!item, "firstName") & " " & user(fv!item, "lastName") } ) ) ), a!recordFilterList( name: "Escalated To", isVisible: a!isNotNullOrEmpty(local!groupMembers), options: a!forEach( items: local!groupMembers, expression:a!recordFilterListOption( id: fv!index, name: fv!item.name, filter: a!queryFilter( field:'recordType!{92bc5c32-2509-4558-b252-56df608deb1a}.fields.{escalatedTo}', operator: "=", value: fv!item.xid ) ) ) ) )
Correct, this is the implementation I was trying to guide OP to (without necessarily just typing it out for them though, lol)
Thanks for the nudge!I was able to reproduce the code locally to better understand it So, simply paste it
Shubham Aware
The above is not working . I am geeting the error :
[Expression evaluation error at function a!forEach [line 132]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function a!queryFilter [line 137]: Invalid index: Cannot index property 'xid' of type String into type List of Variant].
jojog0003 You have one more issue in your codeTry this and let me know if this works for you.
a!localVariables( local!group: index( rule!CDM2_findUserGroup(loggedInUser()), 1, {} ), local!escalatedTo: if( a!isNullOrEmpty(local!group), {}, index( a!queryEntity( entity: cons!CDM2_DSE_INQUIRIES, query: a!query( aggregation: a!queryAggregation( aggregationColumns: { a!queryAggregationColumn(field: "escalatedTo", isGrouping: true) } ), logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "groupId", operator: "=", value: local!group ) }, ignoreFiltersWithEmptyValues: false ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: - 1) ), fetchTotalCount: false ), "data", "escalatedTo", null() ) ), local!tmodData: a!flatten( a!forEach( items: local!escalatedTo, expression: if( a!isNullOrEmpty(fv!item), {}, if( not(isusernametaken(fv!item)), fv!item, {} ) ) ) ), local!tmodGivenNames: if( a!isNotNullOrEmpty(local!tmodData), index( a!queryEntity( entity: cons!TMODS_DSE, query: a!query( selection: a!querySelection( columns: { a!queryColumn(field: "given_name"), a!queryColumn(field: "preferred_given_name"), a!queryColumn(field: "enterprise_login_id"), } ), logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "enterprise_login_id", operator: "IN", value: upper(local!tmodData) ) }, ignoreFiltersWithEmptyValues: true ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: - 1) ), fetchTotalCount: false ), "data", null() ), {} ), local!groupMembers: a!forEach( items: local!escalatedTo, expression: if( a!isNullOrEmpty(fv!item), { xid: null, name: null }, if( not(isusernametaken(fv!item)), { xid: fv!item, name: a!localVariables( local!blankTmodGivenName: displayvalue( upper(fv!item), touniformstring( local!tmodGivenNames.enterprise_login_id ), if( /*a!isNullOrEmpty(local!tmodGivenNames.preferred_given_name),*/ a!isNullOrEmpty( index( local!tmodGivenNames.preferred_given_name, wherecontains( upper(fv!item), touniformstring( local!tmodGivenNames.enterprise_login_id ) ), {} ) ), local!tmodGivenNames.given_name, local!tmodGivenNames.preferred_given_name ), {} ), if( a!isNullOrEmpty(local!blankTmodGivenName), fv!item, local!blankTmodGivenName ) ) }, { xid: fv!item, name: user(fv!item, "firstName") & " " & user(fv!item, "lastName") } ) ) ), a!recordFilterList( name: "Escalated To", isVisible: a!isNotNullOrEmpty(local!groupMembers), options: a!forEach( items: local!groupMembers, expression: a!recordFilterListOption( id: fv!index, name: fv!item.name, filter: a!queryFilter( field: 'recordType!{92bc5c32-2509-4558-b252-56df608deb1a}.fields.{escalatedTo}', operator: "=", value: fv!item.xid ) ) ) ) )
The above code is working fine but if "escaltedto" field is null then the filter also show the null dropdown like:
That is expected right? As you already filtered the list by createdDate so might be for that range there won't be any "escalatedTo".Can you specify your exact requirement here.
My exact requirement are if there is no any data/value in "escalatedto" field then the filter can't show any null value in dropdown.
I want if there is a data in field then filter shows that value
Hi experts
Anybody help me on above code . I am still facing issues .
Thanks
In your code for local!groupMembers you intentionally create an entry with blank ID and blank Name when the current entry of local!escalatedTo is blank. This is what's causing your dropdown to have a blank entry. This is the expected behavior.
Hey jojog0003 ,Try this code
a!localVariables( local!group: index( rule!CDM2_findUserGroup(loggedInUser()), 1, {} ), local!escalatedTo: if( a!isNullOrEmpty(local!group), {}, index( a!queryEntity( entity: cons!CDM2_DSE_INQUIRIES, query: a!query( aggregation: a!queryAggregation( aggregationColumns: { a!queryAggregationColumn(field: "escalatedTo", isGrouping: true) } ), logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "groupId", operator: "=", value: local!group ) }, ignoreFiltersWithEmptyValues: false ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: - 1) ), fetchTotalCount: false ), "data", "escalatedTo", null() ) ), local!tmodData: a!flatten( a!forEach( items: local!escalatedTo, expression: if( a!isNullOrEmpty(fv!item), {}, if( not(isusernametaken(fv!item)), fv!item, {} ) ) ) ), local!tmodGivenNames: if( a!isNotNullOrEmpty(local!tmodData), index( a!queryEntity( entity: cons!TMODS_DSE, query: a!query( selection: a!querySelection( columns: { a!queryColumn(field: "given_name"), a!queryColumn(field: "preferred_given_name"), a!queryColumn(field: "enterprise_login_id"), } ), logicalExpression: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: "enterprise_login_id", operator: "IN", value: upper(local!tmodData) ) }, ignoreFiltersWithEmptyValues: true ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: - 1) ), fetchTotalCount: false ), "data", null() ), {} ), local!groupMembers: a!forEach( items: local!escalatedTo, expression: if( a!isNullOrEmpty(fv!item), {}, if( not(isusernametaken(fv!item)), { xid: fv!item, name: a!localVariables( local!blankTmodGivenName: displayvalue( upper(fv!item), touniformstring( local!tmodGivenNames.enterprise_login_id ), if( /*a!isNullOrEmpty(local!tmodGivenNames.preferred_given_name),*/ a!isNullOrEmpty( index( local!tmodGivenNames.preferred_given_name, wherecontains( upper(fv!item), touniformstring( local!tmodGivenNames.enterprise_login_id ) ), {} ) ), local!tmodGivenNames.given_name, local!tmodGivenNames.preferred_given_name ), {} ), if( a!isNullOrEmpty(local!blankTmodGivenName), fv!item, local!blankTmodGivenName ) ) }, { xid: fv!item, name: user(fv!item, "firstName") & " " & user(fv!item, "lastName") } ) ) ), a!recordFilterList( name: "Escalated To", isVisible: and( a!isNotNullOrEmpty(local!groupMembers), a!isNotNullOrEmpty(local!escalatedTo) ), options: a!forEach( items: local!groupMembers, expression: a!recordFilterListOption( id: fv!index, name: fv!item.name, filter: a!queryFilter( field: 'recordType!{92bc5c32-2509-4558-b252-56df608deb1a}.fields.{escalatedTo}', operator: "=", value: fv!item.xid ) ) ) ) )
The above code not working . I am still getting the error
Expression evaluation error at function a!forEach [line 140]: Error in a!forEach() expression during iteration 1: Expression evaluation error at function a!queryFilter [line 145]: Invalid index: Cannot index property 'xid' of type String into type List of Variant.
I modified my above posted code. Check that once.Also Can you share the value coming for local!groupMembers.