Policy Automation for B2C Service

Get Involved. Join the Conversation.

Topic

    Kurt Helfrich
    Collecting one out of a group of fieldsAnswered
    Topic posted January 24, 2017 by Kurt HelfrichGold Trophy: 10,000+ Points 
    94 Views, 7 Comments
    Title:
    Collecting one out of a group of fields
    Content:

    I have several places in an interview where I'm collecting several similar types of fields as multiple phone numbers.  The requirement is to put a field up for office phone, mobile phone, etc., and accept the input if at least one of the fields in completed. 

    For this application, I'm just using the global entity.  It doesn't seems to make sense to complicate the setup with others.  I read Jasmine Lee's best practice guide

    I created a rule that says:

    the job site contact's phone information has been collected if

    the job site contact office phone is known or

    the job site contact mobile phone is known

    Then, I try to use that attribute to control the Optional If setting for the 2 fields.

    It's not working.  Whether one is filled out and passes validation or not, the other is mandatory. 

    In the debugger, the "has been collected" attribute is always unknown. 

    What am I missing?  Is there a better way to go about this?

    Version:
    OPA August 2016

    Best Comment

    Matt Sevin

    Ensure your input validation accepts the blank/empty in addition to the format you desire.  (i.e. submitting blank is "valid" input format), but then Jasmine's rule will check the multi-input requirement that at least one phone number is NOT the blank/uncertain value. 

    Comment

     

    • Jasmine Lee

      Hi Kurt,

      One way to handle this is to make all the phone number fields Optional-Always, and create an error event rule which fires if they try to click past without providing any numbers, e.g.

      Error("You must provide at least one phone number.") if
      .....the mobile number is uncertain and
      .....the office number is uncertain

      Cheers,
      Jasmine

    • Jasmine Lee

      Note that the example Error rule above assumes the phone number attributes are Number attributes. If they are Text attributes, the Error rule would look more like this:

      Error("You must provide at least one phone number.") if
      .....the mobile number = "" and
      .....the office number = ""

      Cheers,
      Jasmine

    • Kurt Helfrich

      Thanks, Jasmine.  That's a lot of help.  Two follow-up questions:

      1. I have input validation on the phone number fields, for instance, for North American style phone numbers.  It seems like even if I make the fields Optional Always, the input validation is firing.  I guess I would hope that the input validation only fired if there was a value, and that it wouldn't act like yet another mandatory requirement.

      2. If you had a similar situation, would you have designed this setup differently?  If so, how?

    • Matt Sevin

      Ensure your input validation accepts the blank/empty in addition to the format you desire.  (i.e. submitting blank is "valid" input format), but then Jasmine's rule will check the multi-input requirement that at least one phone number is NOT the blank/uncertain value. 

    • Jasmine Lee

      What sort of validation? Is it a regular expression? If so, can you modify the regular expression to also accept a blank field? (I'm thinking along the same lines as Matt here.)

    • Kurt Helfrich

      Yes, it's a regex, and yes, Matt's trick worked.

      Thanks for all the help!  I marked Matt's post as the solution, since it was the last piece of the puzzle, but it was a team effort.

      Are there places on the web where examples like this are worked out?  If so, I haven't found them yet.

    • Danette Beal

      Thanks Kurt for following up and marking a best answer, this helps us our immensely!! 

      Thanks to Matt and Jasmine for chiming in and being part of the collective team effort!!