Skip to main content
July 13, 2023
Question

Record-Security Rules/Expressions

  • July 13, 2023
  • 8 replies
  • 0 views

Hi! I was trying to make a security rule for my record (filter --> loggedUserName() = nomProveedor (one of my fields)), but in the security rule I can only put direct values or constants

 

I found out that there are security expressions, but how should be my structure to obtain a filter like the mentioned one? Example:

Username: Proveedor 1

I want to filter the record so that he can only see the rows in which my field "nomProveedor" is equal to the Username

Thanks a lot!

    8 replies

    mikes0011
    Brainy
    July 13, 2023

    I assume you will need to choose this option instead.

    The Expression Guru
    July 13, 2023

    Thank you so much. How would be the ideal structure to make a filter expression to obtain my desired output?

    mikes0011
    Brainy
    July 13, 2023

    As it says on that page, you need to use a!queryFilter (or a set of query filters joined together under a!queryLogicalExpression) - the simplest being configured along the lines of:

    a!queryFilter(
      field: recordType!myrecordtype[record type field reference],
      operator: "=",
      value: tostring(loggedInUser())
    )

    The Expression Guru