Appian Community and Appian Academy are being upgraded. From July 24–August 3, the Appian Community will be in read-only mode. During this time, the site will be read-only and user registration will be disabled. We apologize for any inconvenience this may cause, but a more secure, stable, and performant Community experience is coming soon!
The new Appian Community launches August 3, followed by Appian Academy on August 7. During the migration, Appian Community Edition, Appian Academy, Documentation, Certifications, Instructor-led Customer Training, Partner Sales Training & Accreditation, and Forum (for Appian Partners and Customers only) will remain available.
Using a grid I display several rows of comments on a form. The requirement is that users should be able to see only their comments or final approval/rejection comments. They should not have visibility to the comments for the different approval flows. The current solution is showing every comment in a grid. Is there any way I can restrict the visibility of approval flow comments? Any recommendations? TIA
Discussion posts and replies are publicly visible
I hope you have a hierarchy of groups set up that generally define a user's role(s). In this way it's pretty straightforward to use on-form logic to check whether the viewing user is in certain group(s). Then you'd use additional on-form logic to simply decide whether different columns (or different comment types, presuming you have a systematic way to differentiate them) are shown for members of different groups.
a!localVariables( local!commentsPageInfo: a!pagingInfo( startIndex: 1, batchSize: 10, sort: a!sortInfo(field: "createddate", ascending: true) ), local!commentsData: todatasubset( arrayToPage: ri!savedComments, pagingConfiguration: local!commentsPageInfo ), a!sectionLayout( label: "Comments", contents: { a!gridField( emptyGridMessage: "No Comments Found", data: local!commentsData, pagingSaveInto: local!commentsPageInfo, columns: { a!gridColumn( label: "Comment", sortField: "text", value: fv!row.text, width: "WIDE" ), a!gridColumn( label: "User", sortField: "createdby", value: fv!row.createdby ), a!gridColumn( label: "Date Created", sortField: "createddate", value: fv!row.createddate ) } ), a!paragraphField( label: " Add Comments", value: ri!initalComment, saveInto: { ri!initalComment, a!save(ri!userComment, loggedInUser()) }, ) } ) )
This is how the code looks and is called in the main interface.
Seems like you transport the comment in a process from one form to the other. In this case, you will need to implement a filter on your ri!savedComments. I would recommend using the filter() function in combination with a separate expression. Others might prefer to filter using foreach(). Both works, but this is what you need to do.
I tried using foreach () function but it didn't work. Can you quote any example for the filter function?
filter( rule!THIS_IS_YOUR_EXPRESSION(item:_), ri!savedComments )
Your expression has a rule input called "item" and gets passed one item from the list. It then needs to implement your conditions and return true to keep that item in the list. The filter function will then iterate on the list and call your expression for each item.
Tan18 said:I tried using foreach ()
Can you provide a bit more context? What piece of the passed-in comment CDT are you trying to use to segregate what user(s) can see which comment(s)?