This topic contains 1 reply, has 0 voices, and was last updated by ktarog 8 years, 7 months ago.

  • Author
    Posts
  • #9900

    jamesm

    Hey guys

    I want to add a condition to a workflow to throw a warning message on screen if the user enters a phone number into customer record phone field that’s got a non numerical character in it.

    How can I do this, I’ve tried the following and none work

    replace(translate(({phone}),”’WNZabcdefghijklmnop qrstuvwxyz:=[]$ยฃ()_-+/ ‘,’ ‘),’ ‘,”)

    Phone contains ‘||:||=||[||]||ยฃ||(||)||_||-||+||/||W||N||Z||a||b||c||d||e||f||g||h||i||j||k||l||m|| n||o||p||q||r||s||t||u||v||w||x||y||z

    IF {phone} LIKE ‘%[^0-9]%’

    CASE WHEN

    LENGTH(TRIM(TRANSLATE({phone}, ‘ +-.0123456789’, ‘ ‘))) != ”
    This is a cached copy. Click here to see the original post.

  • #9901

    ktarog

    Hi,

    You can use regular expressions. On my particular example, I have used regexp_instr which returns any 1st occurrence of a matching character or string based on my regex.

    This formula worked for me : REGEXP_INSTR(TO_CHAR({phonefield}),'[A-Za-z!@#$%^&*;:]’) > 0

    ***My sample regex will match any letter with special characters !@#$%^&*;:

    Note: This function returns the integer position of the string. If no match is found, this will return zero.

    Hope this helps.

You must be logged in to reply to this topic.