How to have a record viewed by the role of the submitter, not the viewer?

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

Hello,

I have a table where depending on the role the person is in when they log in (there are three roles) they are directed to a designated form for them to fill out a bank of questions that pertain to their role. I would like to be able to have the person viewing the submitted record to view it based on the submitter's role not their own role.

Initially I was going to create a master form with all of the questions grouped by role, however the issue I am having is that there are some questions that are universal across all three roles, some that pertain to two, and some that are unique to each role.

Any thoughts / suggestions would be appreciated!

Photo of JOCHEN

JOCHEN

  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of Blake Harrison - DataBlender

Blake Harrison - DataBlender, Champion

  • 100 Points 100 badge 2x thumb
For each Submitter Role, you'll definitely want to have a separate form. For the Viewer, you'll need to have a Formula URL or Formula Text field setup as a View button. This button would be placed in a report where you would have the Edit / View options turned off for the report. The basic idea of this Formula Text button would be something like this:

"<a class=\"Tall Vibrant Alert\" & href=" & 

URLRoot() & "db/" & dbid() & "?a=dr&rid=" & [Record ID#] & "&dfid=" &

      Case([Submitter Role],"Role 1",10,"Role 2",11,"Role 3",12)

 & ">View Record</a>"


Of course, you'll need some way to identify which Role the Submitter was in, but based on your comments, I'm guessing you already have that. An additional downside to this is that if the user Edits the record, unless you have a similar Edit button setup, they will be taken to the primary form. Also, when they Save the record, they'll be directed back to the primary form. These could probably be overcome through the use of some JavaScript, however.
Photo of JOCHEN

JOCHEN

  • 0 Points
Blake, Thank you very much your solution worked perfectly for me!

I did alter it slightly to get it to work properly (could be more based on my knowledge level versus actual operation however). I created a new form with the View Submission button on it, and had that be the default form called when anyone views a record.

I left the edit record as it was since they are restricted to only be able to edit their own records, so they are in the correct form and see the correct question bank.

Thanks again - great tip and one I will certainly file away!