0

I am using ScriptAssert and the script work's fine. Now I would like to move the script to properties file.

I am able to read PONumber.mandatory as part of message. I am unable to read PONumber.mandatory.script as part of script. Any help is appreciated.

ValidationMessages.properties

PONumber.mandatory.script=!(_.OBJSTATE.equals('RELEASED') &&  (_.PONumber == '' ))
PONumber.mandatory=PONumber value is Mandatory

In Java:

@ScriptAssert(lang="javascript",script="{PONumber.mandatory.script}",alias = "_",message="{PONumber.mandatory}")
mark_o
  • 2,052
  • 1
  • 12
  • 18
  • I think that's not possible as script is evaluated "as is" without checking properties file. So you either would need to move the script from properties file to constraint declaration itself or create a custom validator for ScriptAssert which would read property files. – mark_o Oct 03 '17 at 05:38
  • Thanks mark. You are right. For now I moved the script to a field and referring it. – Sarada Chelluboyena Oct 09 '17 at 02:10

0 Answers0