Prevent duplicate entries being selected in a multi row variable set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2023 07:54 AM - edited 06-30-2023 07:55 AM
I've got a multi row variable set that allows a user to select different AMA controls. However, what I've just noticed is that a user is able to select the same control twice for a Business Application.
If the above example, the user should only select the 'Manual Order Process' AMA control only once. I was just wondering what I can do to stop the same AMA control being selected. A user should only select each AMA control once, not multiple times.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2023 07:58 AM
Hello @matthew_hughes
I hope you are doing well!
You can write a onSubmit client script on your MVRS, for the reference please follow the link here having same requirement
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2023 08:14 AM
I've tried the following, but it's not worked:
function onSubmit() {
var value = parent.g_form.getValue("ama_controls"); // change mrvs name
var arr = JSON.parse(value);
if (searchExisting(g_form.getValue("ama_control"), arr)) {
alert('There are duplicates please remove those before submitting');
return false;
}
}
function searchExisting(keyColumn, newArray) {
for (var i = 0; i < newArray.length; i++) {
if (newArray[i].ama_control == keyColumn) {
return true;
}
}
return false;
}
It states 'There is a JavaScript error in your browser console'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2023 08:19 AM
Can you check the console what is the error came up
Right click on your form where error has came up and click on inspect
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2023 08:25 AM
The error I'm getting is:
TypeError: Cannot read properties of undefined (reading 'getValue')