- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2015 06:53 AM
I have three sets of users in my user table. The first set needs a User ID and the second needs its unique key in a different column. A third set will have both User ID and the other key (which will be different to each other, so I cannot combine the columns).
Thus neither User ID nor the other column is mandatory, but I want at least one to be filled in - mandatory in combination but not individually.
What is a good way to achieve this? I think database level constraints are not available so I'm considering a business rule and/or a client script. Users added programmatically are unlikely to violate this constraint so my current thought is a client script but I would like to know if there are other options that work.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2015 10:36 AM
I had problems with Client Script because both fields were not visible to all users and the client script cannot access invisible fields.
I eventually found a simple and elegant solution with Data Policies - thanks to the tip on UI Policies which was the catalyst! The data policy is reversible and states that when both fields are empty then one of them (it doesn't matter which) or both become mandatory. By filling in either field, the condition becomes false and because the policy is reversible, the mandatory property or properties falls away again which means you only need to fill one in.
All the necessary error messages appear on the UI as well which helps the user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2015 06:59 AM
Hello John,
Client script is a good solution.
You may use UI Policy too.
Thanks,
Subhankar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2015 08:18 AM
The Client Script almost works for me - my problem is that one of the fields is hidden from some helpdesk users ... so I can't use g_form.getValue. I'll see if UI Policy works, otherwise I'll have to consider making the field visible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2015 10:36 AM
I had problems with Client Script because both fields were not visible to all users and the client script cannot access invisible fields.
I eventually found a simple and elegant solution with Data Policies - thanks to the tip on UI Policies which was the catalyst! The data policy is reversible and states that when both fields are empty then one of them (it doesn't matter which) or both become mandatory. By filling in either field, the condition becomes false and because the policy is reversible, the mandatory property or properties falls away again which means you only need to fill one in.
All the necessary error messages appear on the UI as well which helps the user.