Forum Discussion
CharlieMurawski
8 years agoQrew Cadet
Unfortunately there's no easy way to get the user's role natively in QB. I played around with various API calls in my browser to perhaps derive the role via a button click on your form -- however getuserrole requires the userid which you need get userinfo for (supplying the email address, if available). So even if you were to write a script for that might not be 100% full proof.
I did think of a workaround that might work for you however. How about making several form rules in your form for that table. The condition for all of them would be "when the record is added" -- since this isn't an option you would need to do something like "when date created is blank" or some other workaround for this (let me know if you need help with that).
So with this condition you could make a form rule for every role:
1) When the record is saved and date created = blank and user is in Role A: Change "Role Who Added the Record" to "Role A"
2) When the record is saved and date created = blank and user is in Role B: Change "Role Who Added the Record" to "Role B"
1) When the record is saved and date created = blank and user is in Role C: Change "Role Who Added the Record" to "Role C"
"Role who added the record" would be a text field you would add to your table -- so basically any time someone adds the record the role is logged to a text field.Make sure you have "Fire "change" actions only when a condition changes from false to true" disabled.
FYI this would only apply to the "record owner" field, as we're firing this on adding. You could make the same rules for editing as well if you wanted to track that via a separate field.
Let me know how that works
I did think of a workaround that might work for you however. How about making several form rules in your form for that table. The condition for all of them would be "when the record is added" -- since this isn't an option you would need to do something like "when date created is blank" or some other workaround for this (let me know if you need help with that).
So with this condition you could make a form rule for every role:
1) When the record is saved and date created = blank and user is in Role A: Change "Role Who Added the Record" to "Role A"
2) When the record is saved and date created = blank and user is in Role B: Change "Role Who Added the Record" to "Role B"
1) When the record is saved and date created = blank and user is in Role C: Change "Role Who Added the Record" to "Role C"
"Role who added the record" would be a text field you would add to your table -- so basically any time someone adds the record the role is logged to a text field.Make sure you have "Fire "change" actions only when a condition changes from false to true" disabled.
FYI this would only apply to the "record owner" field, as we're firing this on adding. You could make the same rules for editing as well if you wanted to track that via a separate field.
Let me know how that works