Skip to content

Commit ba9c11e

Browse files
Add files via upload
1 parent b9548d8 commit ba9c11e

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Scenario: If you want a boolean, like "u_assigned", to turn true if the logged-in user has a particular role.
2+
3+
Application: Add the field to a record, then create a new client script. Give it a name, set the table, change = onLoad. Paste the snippet into the script area.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
function onLoad() {
2+
// Check if the user has the 'admin' role
3+
if (g_user.hasRole('admin')) {
4+
g_form.setValue('u_assigned', false); // Set u_assigned (replace with applicable field name) to false if the user has the 'admin' role
5+
}
6+
7+
// Otherwise, check for the 'case_technician' (replace with applicable roles) roles
8+
else if (g_user.hasRole('case_technician')) {
9+
g_form.setValue('u_assigned', true); // Set the u_assigned (replace with applicable field name) field to true
10+
11+
} else {
12+
g_form.setValue('u_assigned', false); // Set u_assigned (replace with applicable field name) to false if they don't have the roles
13+
}
14+
}

0 commit comments

Comments
 (0)