Visual Builder

Get Involved. Join the Conversation.

Topic

    Nisheeth Ranjan
    When the Field Level Validation Triggers
    Topic posted June 17, 2019 by Nisheeth RanjanSilver Medal: 2,000+ Points, tagged Business Objects, Groovy, Validation 
    84 Views, 5 Comments
    Title:
    When the Field Level Validation Triggers
    Content:

    Hi Experts, 

    I am adding a field level validation trigger on one of my BO fields. This field is being populated using a Dropdown(Select One ) Component.

    So the use case is if the user doesn't select any value in the dropdown and click on a submit button on the page(means the value is null for the field), it should throw the error I have defined in the validation trigger.

    I have defined the trigger and added the condition however it's not triggering the validation.

    Is the approach I am following is correct? When does the field level validation trigger on a page?

    Thanks,

    Nisheeth

     

    Comment

     

    • Shay Shmeltzer

      Which trigger are you using?

      Triggers only execute when you save data to the business object, so did you tie the submit button to a BO REST service that does POST or PATCH operation?

       

    • Nisheeth Ranjan
      Hi Shay, firstly I tried to simply insert a row in the BO manually and was expecting the trigger to get fired however it didn't. I have added a field validation in one of the fields.
      
    • Shay Shmeltzer

      What is the code in your field validation?

      IF you turn on BO logging - do you see any errors reported there?

      (More on BO logging towards the end of this video - https://blogs.oracle.com/vbcs/debugging-and-troubleshooting-visual-builder-logic )

    • Nisheeth Ranjan
      I am just checking if the value of the field is null so the expression I have used is NewVlaue==null.
      
      • Shay Shmeltzer

        If you want to check that a field is not empty when you are inserting a new record then you'll want to use an object validator rather than a field validator.

        (The field validation is not executed if you don't put a value in the field)

        You can write an object validator that looks like this:

        return(name)

        where name is the field you want to check for being null. That's the right way to check for null in groovy.