Community

FlexiCapture for Invoices - Disable rules programatically

Is it possible to disable other rules based a rule script? I am setting up a FlexiCapture for Invoices demo which extracts line items. However, I want to conditionally extract line items based on a field in the Vendor database.

I have been able successfully do this, but my problem occurs if there is a rule error on the line items that i am ignoring. I have tried the following code which hides the line items but it does not disable the rule errors. (written in C#)

for (int thisLineItem = 0; thisLineItem <= context.field("lineitems").items.count="" -="" 1;="">=>
{
Context.Field("LineItems").Items[thisLineItem].HasRuleError = false;
}
Context.Field("LineItems").IsVisible = false;

Any help anyone can give would be appreciated.

Thanks

Steve
0

Comments

3 comments

  • Avatar
    Vladislav Suvorov
    Hello Steve,

    It looks like you are trying to implement an extra rule that will block all rule errors for the group. However all rules only affect their own errors meaning it's impossible to suppress other rules' errors from external one (script stages don't have access to IRuleContext at all).
    To stop rule errors from appearing please consider modifying necessary rules themselves to have for example a Field("").IsVisible property check or any other check that will prevent presented rule from applying to your document.

    Please let me know if you have any questions or issues with implementation.

    Best regards,
    Vladislav
    0
  • Avatar
    Steve Hough
    Thanks for the reply. This is kind of what I thought... but I wanted to avoid this as they are inbuilt rules of the FlexiCapture for Invoices template. The one i want to disable is "Check item amount" which sits under Line items. If change the inbuilt rule, won't this be lost if the product is ever upgraded?

    Thanks

    Steve
    0
  • Avatar
    Vladislav Suvorov
    Hello again Steve,

    If you don't want a specific rule to be active you can just disable it. All rules are made as "most commonly used already implemented functionality" for end users and can be enabled\disabled at end user's will.
    Project files are stored separately from FlexiCapture itself therefore either upgrading your license or FlexiCapture release has nothing to do with your existing projects.

    Hope that helped,
    Vladislav
    0

Please sign in to leave a comment.