Hi,
Can anyone please help me to understand the below code.
How is defaultOption:"Me" differ from currentUser(my account)
a!recordFilterList( name: "Assignee", defaultOption: "Me", options: { /* We modify the standard logic to account for the "LoggedIn User" user */ a!forEach( items: append(cons!VOF_ALL_ANALYSTS, {"LoggedIn User", null}), expression: if( fv!isLast, a!recordFilterListOption( id: fv!index, name: "Unassigned", filter: a!queryFilter( field: 'recordType!{c5bfe4ef-1564-4630-a19f-cbdaa1880a48}HZN_JC_JobCosting_recordtype1.fields.{0293d097-e030-4431-9bcc-f5742790bb82}assignee', operator: "is null" ) ), /* Here we configure a flexible option for the logged in user to filter orders they are assigned */ a!recordFilterListOption( id: fv!index, name: if( fv!index = count(cons!VOF_ALL_ANALYSTS) + 1, "Me", fv!item ), filter: a!queryFilter( field: 'recordType!{c5bfe4ef-1564-4630-a19f-cbdaa1880a48}HZN_JC_JobCosting_recordtype1.fields.{0293d097-e030-4431-9bcc-f5742790bb82}assignee', operator: "=", value: fv!item ) ), ) ) }, allowMultipleSelections: true )
Discussion posts and replies are publicly visible
For future reference please use the "Insert Code" option when posting - it makes it easier to read/copy/paste when people are trying to answer questions.
...in direct response to your post: what specifically do you need help with understanding?
thanks for suggesting "Insert code" option.
items: append(cons!VOF_ALL_ANALYSTS, {"LoggedIn User", null}), expression: if( fv!isLast, a!recordFilterListOption( id: fv!index, name: "Unassigned", filter: a!queryFilter( field: 'recordType!{c5bfe4ef-1564-4630-a19f-cbdaa1880a48}HZN_JC_JobCosting_recordtype1.fields.{0293d097-e030-4431-9bcc-f5742790bb82}assignee', operator: "is null" )
I would like to know what is happening here in the above code. With respect to id, name.
The overall purpose of the rule is to generate a list of values that will appear in a Record List 'User Filter' - that is, a filter that a User can select (in this case) one or more values to filter the list of Records by.
Each item that will appear in the generated drop-down is of type 'a!recordFilterListOption', and the help for this type tells you what each attribute for that type is:
If you put your cursor inside the opening bracket for this function then you will see the above help appear in the bottom left of the expression editor:
Thank you for the reply Stewart Burchell
In my case, I have a form takes the user as a input and stores to the DB.
When I assign me as a user and check with defaultOption:"Me".
I'm not able to see the records in the view.
Only when I enter loggedIn User in the DB then only that record is visible by default to me.
I suspect the issue is wiht this line:
items: append(cons!VOF_ALL_ANALYSTS, {"LoggedIn User", null}),
The intention appears to take the list of users in the cons!VOF_ALL_ANALYSTS and add to that list two additional items: the logged in user, and null. These are the values that are being used to apply a filter with, so the string "LoggedIn User" should actually be replaced with the function fn!loggedInUser() i.e.:
items: append(cons!VOF_ALL_ANALYSTS, {fn!loggedInUser(), null}),
how can we handle the condition when the loggedInUser is already present in the cons!VOF_ALL_ANALYSTS
what do you think needs to happen?
Thank you.
I was trying to encourage you to think through what you need to do in the situation where the looggedInUser value is already in the list contained in cons!VOF_ALL_ANALYSTS. Note: the what not the how. Half of delivering solutions is identifying what needs to be done and then the how then follows.