In this sample, we will walk you through creating an automatic duplicate items check when "Add" or "Update" button is pressed on sales/purchase document form. This example requires version B1UP 2018.02 or newer.
All support requests regarding this functionality will be premium (paid) support.
All exports can be found as attachments, the setup consists of:
1 - B1 validation
1 - .NET snippet
2 - Macros
The final outcome is a solution that shows the duplicate item code findings and after that asks would the user like to still add the document or not:
Step 1 – Set up the .NET snippet
Lets start by heading to the.NET snippet configuration screen:
While in the .NET code configuration screen, import the file "dotNET snippet - RowCount - RowCount - Row count of matrix.xml" that you can find as an attachment in this article.
Now your .NET snippet should be all set up.
Step 2 - Set up the validation configuration
Now head to the B1 Validation Configuration -form and import the file "VALIDATION - 61 - Duplicate check Sales quotation-149.xml" that you can also find as an attachment in this article.
Check the settings of the validation so that it includes all the forms you want the duplicate check to apply. The default one only has formtype 149 (=Sales Quotation.) and is set to launch on both Add and Update -modes.
Step 3 – Set up the macros
The last step is import the universal function macros from files "Macro - UF-117 - Duplicate block (Macro).xml" and "Macro - UF-116 - Duplicate message (Macro).xml".
Step 4 – Checking the integrity
When importing the configurations, it could be that the macros for example have different codes. If so, please change the B1 validation universal function links and macros accordingly.
After everything is in place, just test the functionality and you're good to go.