Change vendor if some data is found on the invoice

Symptoms

The vendor is recognized incorrectly and there is a need to change it if some information is found on the invoice

Cause

  • There is information related to a different Vendor from the Data Set in the document. 
  • There are several vendors that share the same information
  • There is no information about the right vendor in the document

Resolution

  1. Create a FlexiLayout Studio project and upload samples of those vendors into the project.
  2. Disable Header's and Footer's groups and create a Static Text element.
  3. Go to the properties of this Static Text Element and define that it should look for the information that is only present in the invoices of this vendor.
  4. Create A block for this element and select Static Text element as a source element for this block
  5. Export the FlexiLayout .afl file to the location that is suitable for you.mceclip1.png
  6. Go to the Document Definition properties and add this .afl file as an additional layout. This will add this field to the Document Definition
  7. Go to the properties of this field and disable Export field value, Should be matched and  Show on Verification. Go to the Verification tab and disable the required verification.
  8. Go to the properties of the Vendorid field, Select the Rule tab and create a new Script rule, make sure that you add the newly created field to this rule and disable read-only for the VendorID field. You will see a prompt that will ask you to create a rule chain since the Vendor ID Field has a rule already, so enter the name of the chain that you like and put this new rule to the very top.
  9. Click Edit in the rule and use this JScript.Net code: 
    if (Context.Field("TestBlock").Text=="Value that is specific for this Vendor") {
    Context.Field("VendorId").Text=Id of the Vendor that you want to be used;
    }

This script will check the value of the custom, newly-created field and if its value matches the criteria VendorID will be changed to the one that you need.

Linked articles:

Change Business unit depending on the value of some field.

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.