function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Mt CKMt CK 

How to extract number from case subject or case description both?

Hi I am currently using this formula in the flow to extract number from the suject line. Criteria is that if number starts with 3 and is 10 digits long. 
 
IF(AND(

ISBLANK({!TextVar}),
MID({!$Record.Subject},{!Counter},1)="3",
ISNUMBER(MID({!$Record.Subject},{!Counter}+1,1)),
ISNUMBER(MID({!$Record.Subject},{!Counter}+2,1)),
ISNUMBER(MID({!$Record.Subject},{!Counter}+3,1)),
ISNUMBER(MID({!$Record.Subject},{!Counter}+4,1)),
ISNUMBER(MID({!$Record.Subject},{!Counter}+5,1)),
ISNUMBER(MID({!$Record.Subject},{!Counter}+6,1)),
ISNUMBER(MID({!$Record.Subject},{!Counter}+7,1)),
ISNUMBER(MID({!$Record.Subject},{!Counter}+8,1)),
ISNUMBER(MID({!$Record.Subject},{!Counter}+9,1)),
NOT(ISNUMBER(MID({!$Record.Subject},{!Counter}+10,1)))
),
MID({!$Record.Subject},{!Counter},10),NULL)


However, I also want to find if the such number also exists in case descrption? How can I use that in same formula with OR condition maybe? The goal is to find number either in subject, if not then in description. - Thank you, Mt

 

 

SubratSubrat (Salesforce Developers) 
Hello ,

To extract a number from either the Case subject or Case description in your formula, you can use an additional OR condition. Here's an updated version of your formula that considers both the subject and description:
IF(
    AND(
        ISBLANK({!TextVar}),
        OR(
            AND(
                MID({!$Record.Subject},{!Counter},1)="3",
                ISNUMBER(MID({!$Record.Subject},{!Counter}+1,1)),
                ISNUMBER(MID({!$Record.Subject},{!Counter}+2,1)),
                ISNUMBER(MID({!$Record.Subject},{!Counter}+3,1)),
                ISNUMBER(MID({!$Record.Subject},{!Counter}+4,1)),
                ISNUMBER(MID({!$Record.Subject},{!Counter}+5,1)),
                ISNUMBER(MID({!$Record.Subject},{!Counter}+6,1)),
                ISNUMBER(MID({!$Record.Subject},{!Counter}+7,1)),
                ISNUMBER(MID({!$Record.Subject},{!Counter}+8,1)),
                ISNUMBER(MID({!$Record.Subject},{!Counter}+9,1)),
                NOT(ISNUMBER(MID({!$Record.Subject},{!Counter}+10,1)))
            ),
            AND(
                MID({!$Record.Description},{!Counter},1)="3",
                ISNUMBER(MID({!$Record.Description},{!Counter}+1,1)),
                ISNUMBER(MID({!$Record.Description},{!Counter}+2,1)),
                ISNUMBER(MID({!$Record.Description},{!Counter}+3,1)),
                ISNUMBER(MID({!$Record.Description},{!Counter}+4,1)),
                ISNUMBER(MID({!$Record.Description},{!Counter}+5,1)),
                ISNUMBER(MID({!$Record.Description},{!Counter}+6,1)),
                ISNUMBER(MID({!$Record.Description},{!Counter}+7,1)),
                ISNUMBER(MID({!$Record.Description},{!Counter}+8,1)),
                ISNUMBER(MID({!$Record.Description},{!Counter}+9,1)),
                NOT(ISNUMBER(MID({!$Record.Description},{!Counter}+10,1)))
            )
        )
    ),
    MID({!$Record.Subject},{!Counter},10),
    MID({!$Record.Description},{!Counter},10),
    NULL
)

If the above formula helps , please mark this as best answer.
Thank you.
Mt CKMt CK
Showing syntax error - The formula expression is invalid: Incorrect number of parameters for function 'IF()'. Expected 3, received 4
SubratSubrat (Salesforce Developers) 
Hello Mt ,

Can you try with this formula :
IF(
    AND(
        ISBLANK({!TextVar}),
        OR(
            AND(
                LEFT({!$Record.Subject}, 1) = "3",
                REGEX({!$Record.Subject}, "^3[0-9]{9}$")
            ),
            AND(
                LEFT({!$Record.Description}, 1) = "3",
                REGEX({!$Record.Description}, "^3[0-9]{9}$")
            )
        )
    ),
    IF(
        LEFT({!$Record.Subject}, 1) = "3",
        MID({!$Record.Subject}, 1, 10),
        MID({!$Record.Description}, 1, 10)
    ),
    NULL
)

Hope this helps !
Thank you.
Mt CKMt CK
Do REGEX works in flow formula? Never tried it. Let me see. Thank you.
Mt CKMt CK
The flow doesn't work with this formula. 
Christine G. Williams WilliamsChristine G. Williams Williams
Hello,

To extract numbers from the case subject or case description, you can use various text processing techniques depending on the programming language or tools you are using. Here's a general approach you can follow:
1. Identify the source
2. Tokenize the text
3. Search for numbers
4. Store the numbers
5. Handle multiple occurrences
6. Handle decimal numbers or fractions
7. Validate and process the extracted numbers 
myfedloan org paymentplans (https://www.myfedloan.us/)