こんにちは。UiPath Studio Community Edition 2023.6.1版ユーザの初心者です。
Edgeに自動ログイン後、Excelの顧客データを1件ずつWebに転記するワークフローをデバッグ中です。
電話番号とEメールアドレスの記入ミスをはじいて、アプリケーション例外をthrowしたいのですが、条件文はどうなりますでしょうか?
Matchesアクティビティ利用でもOKです。
Value: “123-4567” (Replace with the phone number variable you are using)
If activity:
Condition: System.Text.RegularExpressions.Regex.IsMatch(phoneNumber, "^0[\d-]+$")
(This condition checks if the phone number starts with 0 and consists of half-width numeric characters and optional hyphens)
Then block (No exception is thrown if the condition is true):
Do the necessary workflow steps for transferring the phone number.
Else block (Exception is thrown if the condition is false):
Throw an application exception with an appropriate error message.
Value: “example@example.com” (Replace with the email address variable you are using)
If activity:
Condition: System.Text.RegularExpressions.Regex.IsMatch(emailAddress, "^[ -~]+@[^ -~]+$")
(This condition checks if the email address consists of half-width characters, excluding half-width katakana, and contains exactly one “@” symbol)
Then block (No exception is thrown if the condition is true):
Do the necessary workflow steps for transferring the email address.
Else block (Exception is thrown if the condition is false):
Throw an application exception with an appropriate error message.
If activity:
Condition: phoneNumberMatches.Count > 0
Then : Enter the phone number in the web browser.
Else : Throw activity with Application Exception message: "Invalid phone number"
Continue with the rest of your workflow if the phone number is valid.
Assign emailAddress = “test@example.com” // The email address you want to validate
If activity:
Condition: emailMatches.Count > 0
Then : Enter the Mail id in the web browser
Else : Throw activity with Application Exception message: "Invalid email address"
Continue with the rest of your workflow if the email address is valid.