This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

CustomSMS activity - gateway settings

I am testing the CustomSMS SDK for Password Manager. I need the email to go to telephone@domain.com. Currently, the activity will email the user's email address a code. Is there any way to pass their selected telephone@domain.com?


Here is the PowerShell:

function PostLoad($workflow, $activity)
{
    #Edit this list to specify additional attributes that can contain phone numbers
    $PHONE_NUMBER_ATTRS = [string[]] ("telephoneNumber", "info", "mobile")

    #Obtain user's phone numbers
    $user = $global.GetUserById($workflow.UserInfo.Domain, $workflow.UserInfo.Id, $PHONE_NUMBER_ATTRS)

    
    if ($user -eq $null) {
        $workflow.CriticalError([QPM.Common.Scenarios.WorkflowErrorCode]::SystemError, "User not found")
    } else {
        #Populate "Select phone number" combobox with phone numbers
        $i = 0
        $activity.Runtime.Controls["ddlPhoneNumber"].Options.Clear()
        $PHONE_NUMBER_ATTRS | %{
            $num = $user[$_]

            #TODO: if necessary, mask and/or validate user's phone number
            #Currently, any non-empty number will go
            if ("$num" -ne "") {
                $num = $num.ToString()
                $activity.CustomData["PhoneNumber_$i"] = $num
                $activity.Runtime.Controls["ddlPhoneNumber"].Options.Add("PhoneNumber_$i", $num)
                $i = $i + 1
            }
        }
        if ($i -eq 0) {
            #No phone numbers could be used for authentication
            $workflow.CriticalError([QPM.Common.Scenarios.WorkflowErrorCode]::PhoneAuthenticationPhoneNumbersNotSet)
        }
    }
}


function PreExecuting($workflow, $activity)
{

    $phoneNumber= $activity.Runtime.Controls["ddlPhoneNumber"].Text
    if ("$phoneNumber" -eq "") {
        #Very unlikely - user not selected a phone number
        $workflow.ActivityFailure("Please select a phone number")
    }

    #Edit this line to specify SMS gateway e-mail address where PIN code will be sent
    #
    #Example:
    #
    #$MAIL = "$($phoneNumber)@mysmsgateway.com"
    #
    #For test purposes, PIN code will be sent to user's e-mail address
    #
    $MAIL = $workflow.UserInfo.AccountInfo.Mail


    #TODO: specify passcode length here
    $code = $global.GeneratePasscode(8)

    $workflow.CustomData["PhoneAuthentication_Passcode"] = $code

    #Sending a PIN code
    $global.EmailUser($MAIL, "PIN code", $code)
}