Attchment content validator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2024 08:07 AM
Hello Team,
We have a custom widget for attachment validation. It is basically checking all the data rows in the attachment.
Each row has certain mandatory, reference and optional columns.
There are 3 mandatory (Cost center, user id, Name) and 5 reference columns (mostly referencing sys_user table).
We have a catalog to create Bulk Process orders. So the end user will have to fill and attach the attachment through this catalog. While filling if they miss any mandatory columns or data in reference columns is not present in actual referenced tables, then the system should alert the end user. As per the current process, if the end user is not filling the mandatory attribute (like user id), the attachment validator is throwing an error. However, the error is quite generic. It just informs that the mandatory attribute is missing value.
However the requirement from customer is to give them the actual row number and attribute name in the error message.
Like if user id is missing on rows 5 and 7, then error should highlight the same.
Below is the function call for validating mandatory attributes.
Can we modify it in a way that i start getting the above errors?
Please advise.
function validateOrderInfoRows(attachmentRows) {
return attachmentRows
.filter(function (row) {
return rowHasAnyField(row, VALIDATION_CONFIG.ORDER_INFO_FIELDS.REQUIRED.concat(VALIDATION_CONFIG.ORDER_INFO_FIELDS.OPTIONAL));
})
.every(function (orderInfoRow) {
return validateRequiredFields(orderInfoRow, VALIDATION_CONFIG.ORDER_INFO_FIELDS.REQUIRED);
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2024 08:25 AM
I have some experience in creating a widget that allows a user to upload an excel doc, then does some validation. In my app, the user is presented with a table that shows which rows were valid and which rows contain errors.
Does your custom widget display the data after it is uploaded? Are you able to attach an XML export of this custom widget?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2024 09:35 AM - edited ‎06-07-2024 01:03 PM
Hi Kris
Our custom widget does not display the data actually. It just shows the below error message once we upload which is quite generic. There is just a red mark which informs end user that there is a problem.
Now which row and which column is a problem is something we need to show here..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2024 12:10 PM
Thank you for the screenshot.
Going back to the original question of "Can we modify it in a way that i start getting the above errors?", the answer is a mixture of yes and no.
The "no"..
I don't believe you can modify that script you posted, in any meaningful way, to achieve your requirement. Depending on what is returned in validateRequiredFields, maybe perhaps you could script an alert() to let the user know there's an error at that row.
The "Yes"
If you are able to the provide the HTML Template, Client Script, Server Script,... basically an export of the widget, then there will be a better chance to provide a more comprehensive answer.