I am creating a user filter,for completed by we have stored the value in userId ,while showing in record list using user function ,I need to sort the filter options.Is there anny possible way can someone help me
For the below example let's say,I want to sort the usernames in alphabetical order.
a!localVariables( local!acctExecs: getdistinctusers(cons!ACCOUNT_OWNERS), a!recordFilterList( name: "Account Executives", options: a!forEach( items: local!acctExecs, expression: a!recordFilterListOption( id: fv!index, name: user(fv!item, "firstName") & " " & user(fv!item, "lastName"), filter: a!queryFilter( field: recordType!Customer.fields.AccountOwner, operator: "=", value: fv!item ) ) ) ) )
Discussion posts and replies are publicly visible
Can you try this
a!localVariables( local!acctExecs: getdistinctusers(cons!ACCOUNT_OWNERS), local!mappedUsers: a!forEach( items: local!acctExecs, expression: a!map( username: fv!item, displayName: user(fv!item, "firstName") & " " & user(fv!item, "lastName") ) ), local!sortedUsers: todatasubset( local!mappedUsers, a!pagingInfo( startIndex: 1, batchSize: -1, sort: a!sortInfo(field: "displayName", ascending: true) ) ).data, a!recordFilterList( name: "Account Executives", options: a!forEach( items: local!sortedUsers, expression: a!recordFilterListOption( id: fv!index, name: fv!item.displayName, filter: a!queryFilter( field: recordType!Customer.fields.AccountOwner, operator: "=", value: fv!item.username ) ) ) ) )
This is not working distinct user function
It says expression evaluation error at function user
Stefan Helzle
Can you share the error you are getting?
You need to make some changes based on your actual code.share your error here.
Im not getting error but the field is not sorting.Im querying from case table all the assigned to and casdID,assigned to are in (username),I wanted to display the user's name in sorting order.I am using the user function to get the firstname and lastname ,If the its null make it as unassigned.At wht place I can sort itI cant share the code .Please help me
I have replaced recordtype with caseid and assigned to
Can someone help me with this issueShubham Aware
Sort the mapped list with displayName field using todatasubset() before a!forEach creates recordFilterListOption() options.
local!mappedData: a!forEach( items: local!uniqueData, expression: a!map( values: fv!item.values, displayName: if( a!isNullOrEmpty(index(fv!item,"label","")), "Unassigned", if(index(fv!item,"label","")="System","System", user(index(fv!item,"label",""),"firstName") & " " & user(index(fv!item,"label",""),"lastName") ) ) ) ), local!sortedData: todatasubset( local!mappedData, a!pagingInfo(startIndex:1,batchSize:-1,sort:a!sortInfo(field:"displayName",ascending:true)) ).data,