1 Reply Latest reply on Dec 7, 2010 9:03 AM by FentonJones

    onobjectvalidate (?) validating against parent fields



      onobjectvalidate (?) validating against parent fields



      Consider the following:




      template::validfrom (date)

      template::validuntil (date)

      I'm using a popup to select the template on the customer record.

      I need to validate whether the validfrom>currentdate or validto<currentdate and display a message. The message is just a warning, so it can ultimately be.

      My problem is that if I use the onobjectvalidate trigger the related record in the parent file (template) hasn't been retrieved yet, so I can't check the dates.

      I know it's something simple, could someone please point me in the right direction of forcing the parent record to load?

      Many thanks (again)


        • 1. Re: onobjectvalidate (?) validating against parent fields

          I've not used onObjectValidate yet, but I've often had problems using Validation when there was a relationship to evaluate. It seems the validation happens before the relationship is evaluated for the current value. I wish I could tell you the exact sequence in all circumstances (anyone?).

          Another way to accomplish what you want would be to use similar logic to filter the Value List of the popup. You'd need an unstored (important) calculation field, Get (CurrentDate), result Date (duh).

          Include that in a relationship to the Templates, with the Customer calculation current date field as the source, targeting ≥ Valid_From and again with ≤ Valid_To dates (≥ ≤ includes today). 

          In a Value List, use the above relationship to show the TemplateID as the 1st field, Show also the Template name. Lower down in the dialog, Include only related values, starting from: Customer.

          Then only the valid templates will show in the popup.