email otp

Hi,

I have a doubt. I need to send a otp once the user clicks on the action "create record". While creating they have  a field OTP, where they enters the value that is received via email.

I have used the rand function to generate the random number, I added this logic in a script task and then had the send email node. My question here is:

1. I am receiving the mail for otp after clicking on submit or cancel, but in my PM i have the email node right after the start node. I wanted to receive the otp once after opening the form itself

2. I store the value for the otp in the Process variable in PM. How can we do the comparison if the user enters the code in the form?

Can someone please help here

Thanks in advance.

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    1. Sending OTP Immediately After Opening the Form:

    To send the OTP as soon as the form is opened, you need to ensure the process model starts as soon as the user opens the form. You can achieve this by:

    1. You should use an interface or related action that triggers the process when the form is opened. This way, the script task that generates the OTP and the email node can execute right after the start node.
    2.  If using an Appian SAIL interface, you could set a rule input or a saveInto in a field that triggers a process model using a start process smart service when the interface is loaded. This will immediately send the OTP as the form is opened.

    2. Comparing the OTP Entered by the User:

    1. Store the OTP: When the OTP is generated, store it in a process variable.
    2. User Input: The form where the user enters the OTP should have a text field bound to a rule input (let’s call it ri!userOTP).
    3. Validate OTP: After the user submits the form, add a gateway in your process model that checks if pv!generatedOTP (the OTP stored in your process) matches ri!userOTP (the OTP entered by the user). You can use an XOR gateway to route the flow based on whether the OTPs match or not.
    4. Handle Mismatches: If the OTPs don’t match, you can either loop back and allow the user to try again or show an error message.
  • Thanks for your reply. I have couple of doubts here.

    In my PM, I have a series of email node. One email should be sent once the user opens the form and another email should only be sent when the user submits the form. since I added the start process in the interface, I am getting both the email right after the user opens the form. how can we solve this?

    to validate the OTP, can it be done only after submitting the form. In my case, the user can submit the form only when the otp that the user types in the form matches with the email otp. 

    Can you please guide here

  • 0
    Certified Lead Developer

    I would do it this way. All steps happen in one dynamic UI.

    1. Normal record action with a start form

    2. A button "Send OTP" triggers a process in the background that creates the OTP and send it. Store the result from the process to a local.

    3. Display the OTP input field and add a validation that compares the entered value to the stored OTP.

    4. If the OTP is valid, allow the user to proceed.