How to perform custom validations data that is being imported thru CSV Imports

We have custom validations that trigger in UI on the Journal line level (using client Script).  I am trying to put those validations on the data that is getting imported thru CSV import file feature and populated the errors in the result CSV response.

Is this achievable? appreciate it if someone can shed some light on the solution.

 

Rookie Asked on June 16, 2020 in SuiteScript.
Add Comment
2 Answer(s)

I have built a tool that does exactly this. Its a well known annoyance when trying to import larger journal entries that you will only get 1 error per transaction. Even if your import had 100 lines on it and 75 of them had errors, you would need to try to import it 75 times before you found every error. Unfortunately, the solution to this problem is no small task. What I did was create a Suitelet where a user could select a saved Import, Select a pre-configured set of validation rules (custom record setup with pre-defined options for the types of validation to perform), then select a CSV file from their computer. Upon submit of that form, the code would read the selected validation rules, then perform those validations against each line of the CSV. If any validations failed, the next screen would show a list of all errors found in the file, showing the rule that failed as well as the line number in the CSV where the error is located. If no validations fail, then the File and the selected saved import are passed to the task module to start the import process, and the user is redirected to the Import status screen. The caveat to this configuration is that it will only work for single file imports.

Rookie Answered on July 28, 2020.
Add Comment

Yes you could achieve similar validation with a User Event script on before submit.  However, if the user is doing a csv import and they check the box to not run server side scripts on import, you cannot stop them from doing that.

Intermediate Answered on June 16, 2020.

Thanks for the reply.

I have tried using user event script I can only get the error in the top row similar to standard error feature.  But if there are line level validations and I want to show respective errors next to that particular line in CSV. Is this possible?

Thank you!

on June 16, 2020.

The CSV Upload behavior of returning a single error message per record is a hard limitation. Your script could perform multiple evaluations and summarize all into a single error message.

on June 17, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor