Posted Fri, 04 Jan 2019 17:12:36 GMT by Casey Miller Director of Technical Services

Ok, I am very new to this. I am stuck at step 2 lol. When it is saying Clone the Sources : git clone 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 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

Posted Fri, 04 Jan 2019 21:25:45 GMT by Casey Miller Director of Technical Services

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. 

Posted Mon, 07 Jan 2019 18:10:17 GMT by Casey Miller Director of Technical Services

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

Posted Thu, 10 Jan 2019 18:20:14 GMT by Casey Miller Director of Technical Services

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){

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

    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; + '/Account/Logon')
        .headers({'Accept': 'application/json', 'Content-Type': 'application/x-www-form-urlencoded'})
        .send({ 'UserName': DWparameters.DWPlatformUser, 'Password': DWparameters.DWPlatfromPassword, 'Organization': DWparameters.DWPlatformOrganization, 'RememberMe': false, 'RedirectToMyselfInCaseOfError': true })
        .end(function (response) {
   + '/FileCabinets/'+ fileCabinetGUID +'/Query/DialogExpression?dialogId='+ DWparameters.DWSearchDialogGUIDForInvoiceSearch +'&format=table')
            .headers({'Accept': 'application/json', 'Content-Type': 'application/json'})
            .send({ 'Condition':[
                { 'DBName':DWparameters.fieldNameDOCNUMBER, 'Value': [invoiceNo] },
                { 'DBName':DWparameters.fieldNameSUPPLIER, 'Value': [supplierID, null] },  
            .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));

You must be signed in to post in this forum.