Run script validations only once

  • 374 Views
  • Last Post 15 April 2016
edgarvega posted this 14 April 2016

Hello

I have a lot of rule scripts to validate all the fields in my document. But, a customer requires tu run the validation only the first time the document is open in the verification station. Now, my question is: Can I use the IsVerified property of the IField object as a custom flag to check if I need to run or not the validation? Something like:

if(!IRuleContext.Field("myFieldName").IsVerified)
{
//Do something
!IRuleContext.Field("myFieldName").IsVerified = true;
}


Best regards

Order By: Standard | Newest | Votes
Timur posted this 14 April 2016

Hello,

Rules in such scenarios may lose their meaning.

You proabably need something like

if (Context.Field("Field").IsVerified==false)
{
do something
}
else
{
Context.CheckSucceeded=true;
}

If user verifies the field, by simply confirming its value by hitting enter, rule will be overriden.In case if value is corrected, rule will be re-evaluated.



Regards
Timur














edgarvega posted this 15 April 2016

Hello Timur!

I will try the solution that you provide. What the customer wants it to run the validation only when the document is sent to the verification station. If the user modifies a value inside the verification station I should do nothing.

Regards

Close