• Phil, does this also go for

    Phil, does this also go for DW7? or does it use Platform out of box install for desktop apps import?

  • Josef, I tested this and it

    Josef, I tested this and it does use the validation that you have for that store dialog.

    https://www.docuware.com/sites/default/files/forums-images/validation_test_form.png

  • I posted something on this a

    I posted something on this a couple months ago. Still haven't gotten an answer from anyone at docuware. I am thinking maybe I will just create a service ticket and ask the question... 

  • Steve, i am not a coder

    Steve, i am not a coder either. It all comes precoded just need to adjust the DB field names with what yours are called. This basically validates on the store of the document whether its a duplicate or not. Just to let you know, I have it working with Workflow manager as well, but I ran into a problem. When the AP clerks store the document, they don't know if its a duplicate right away. We have an invoice approval process that starts right on the storage of the document. So, if it is a duplicate, the workflow would still kickoff for the approval process. It just wasn't working for us. We would then need to delete the duplicate, go in and stop the workflows for approval . By doing the validation before storage this would allow the notification of duplicate before it is even stored.

     

    Whether this works on 6.6 not sure. I was using on v7.

  • Hey Steve, check this forum

    Hey Steve, check this forum out. I just installed nodejs and copied the files from github and this works perfect. Doesn't take long at all to get setup.

    https://www.docuware.com/forum/english-forums/docuware-questions-about-u...

     

  • UPDATE: So I was missing the

    UPDATE: So I was missing the exports.checkValues function. Once this was added everything worked great. Below is what the validation before storing file looks like: (Mind you, all this does is validate that an invoice with doc type of Invoice, Invoice Number, and Vendor Number arent already in the cabinet being stored into. If there is a match, it notifies and won't let then store. Works great for not even allowing duplicate invoices in the system)

    const DWparameters = require('./DWValidationSettings');
    const validator = require('validator');    
    const unirest = require('unirest');

     

    exports.checkValues = function (DWInputValues) {
        var invoiceNo = this.getFieldValue(DWInputValues.Values, DWparameters.fieldNameDOCNUMBER);
        var supplierID = this.getFieldValue(DWInputValues.Values, DWparameters.fieldNameSUPPLIER);    

        return new Promise((resolve, reject) => {
            this.isDuplicateInvoice(DWInputValues.FileCabinetGuid, invoiceNo, supplierID)
             .then(success => {
                if (!success) {
                    throw new Error('There is already an invoice stored (#'+ invoiceNo +'SupplierID:' + supplierID + ')');
                }

                return success;
            })
        .then(success => resolve(true))
                                    .catch(function (error){
                                                    reject(error);
                                    })    
        });
    }

    exports.getFieldValue = function (DWIndexFieldCollection, fieldName) {
        var field = DWIndexFieldCollection.find(x => x.FieldName == fieldName);
        if (field === undefined) {
            return;
        }

        return field.Item;
    }

    exports.isDuplicateInvoice = function (fileCabinetGUID, invoiceNo, supplierID) {
        return new Promise((resolve, reject) => {    
            var CookieJar = unirest.jar(true);

            //logon to DW PLATFORM and retrieve cookie;
            unirest.post(DWparameters.DWPlatformUrl + '/Account/Logon')
            .headers({'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded'})
            .jar(CookieJar)
            .send({ 'UserName': DWparameters.DWPlatformUser, 'Password': DWparameters.DWPlatfromPassword, 'Organization': DWparameters.DWPlatformOrganization, 'RememberMe': false, 'RedirectToMyselfInCaseOfError': true })
            .end(function (response) {
                unirest.post(DWparameters.DWPlatformUrl + '/FileCabinets/'+ fileCabinetGUID +'/Query/DialogExpression?dialogId='+ DWparameters.DWSearchDialogGUIDForInvoiceSearch +'&format=table')
                .headers({'Accept': 'application/json', 'Content-Type': 'application/json'})
                .jar(CookieJar)
                .send({ 'Condition':[
                    { 'DBName':DWparameters.fieldNameDOCNUMBER, 'Value': [invoiceNo] },
                    { 'DBName':DWparameters.fieldNameSUPPLIER, 'Value': [supplierID, null] },  
                ],
                'SortOrder':[],'ForceRefresh':true,'FlagConditions':{'IncludeCheckedOut':false},'Operation':'And','AdditionalResultFields':[],'Start':0,'Count':1})
                .end(function (response) {
                    if (response.error) {
                        return reject(new Error(response.error.message));
                    }

                    try {
                        var resultCount = response.body.Count.Value;
                        return resolve(resultCount == 0);                
                    } catch (error) {
                        return reject(new Error("Unable to retrieve similar invoices. Error:" + error));
                    }
                });
            });
        })
    }

  • Anyone have any suggestion on

    Anyone have any suggestion on this? It seems like a node_module didnt get installed or something..

  • This was not a file that I

    This was not a file that I have touched so I am not sure why I am getting this error. It actually specifically states not to touch this file. 

  • Setting up Validations with NodeJS and Github

    Ok, I am very new to this. I am stuck at step 2 lol. When it is saying Clone the Sources : git clone https://github.com/DocuWare/Validation-NodeJS-samples.git how exactly do you do the clone?? I've tried command prompt and opening nodeJS and running this command but I get syntax error. It is just confusing because then in step 3 it says in command prompt navigate to the folder where the sample app was cloned... how do I know where it was cloned?

     

    I am using this site for the instructions https://github.com/DocuWare/Validation-NodeJS-samples. Any help would be greatly appreciated. Essentially I want to be able to validate whether an invoice with matching invoice number doc type of invoice and vendor name is already in the cabinet. looks like they already have something like that feature for check for already existing invoices before storing.

    EDIT: Ok so I have gotten all of the setup and configuration figured out. Just took some digging around and playing. I am getting a good connection but am receiving this error ? error is attached

     

     

    https://www.docuware.com/sites/default/files/forums-images/validations_error.png

  • John, it has to be equal

    John, it has to be equal because it needs to be an exact match. Are you using a file connection, DB, or File Cabinet? The best way to do this would be to get an export not on the check infromation but on the invoice information. Hopefully the system you are getting this from would have the check number that paid that invoice. This way you have a list of invoices and then a column that would show what check paid that invoice. Then just do a match on invoice number and vendor number/name and pull in the check number from the column. 

    OR are you saying that is what you have but the invoice column has multiple values in it? If this is the case, not sure what you could do.. If they have commas or other separation values you could do some manipulation in excel..