Skip to main content
davinar9817
December 20, 2022
Question

Phone Number Validation Error

  • December 20, 2022
  • 7 replies
  • 1 view

So I was finally able to get some phone number validation working. However, it only works in the interface and not when I'm actually using the record action.

Here's the code the error message I'm getting. I think this is happening because the record action relies on user input and perhaps starts off as null. I'm just hoping there's a way to fix it.

When I try to create a new contractor through the record action: Error Evaluating UI Expression Expression evaluation error [evaluation ID = 0932b:f622d] in rule 'ds_createcontractor' at function 'search' [line 65]: A null parameter has been passed as parameter 2.

                a!textField(
                  label: "Phone Number ",
                  labelPosition: "ABOVE",
                  placeholder: "### - ### - ####",
                  saveInto: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{f4c57b1e-a70b-4b5c-abfd-91fbfa77c38f}conPhoneNumber'],
                  refreshAfter: "UNFOCUS",
                  required: true,
                  value: ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{f4c57b1e-a70b-4b5c-abfd-91fbfa77c38f}conPhoneNumber'],                 
                  validations: {if(
                    search("-", ri!record['recordType!{d327a5dc-18d4-4ffd-8bdf-6a22b134677f}DS Contractor.fields.{f4c57b1e-a70b-4b5c-abfd-91fbfa77c38f}conPhoneNumber'],8)<3,
                    "Please enter hyphens between the numbers.",
                    {}
                  )}
                  
                ),

Usually looks like this:

    7 replies

    mikes0011
    Brainy
    December 20, 2022

    your search() command looks suspect.

    you're saying, "search( "-", [phone number], 8)"

    which means, "search the entered phone number for hyphens, starting at the 8th character"

    That doesn't seem to fit what you actually want, though.

    The Expression Guru
    davinar9817
    December 20, 2022

    Starting at the correct index doesn't seem to change things, unfortunately

    mikes0011
    Brainy
    December 20, 2022

    What are you hoping to accomplish via the "< 3" part of the expression?

    The Expression Guru