• Instructions to Ask a Question

    Click on the "Ask a Question" button and select the application for which you would like to ask questions.

    We have 5 different products namely - Pabbly Connect, Pabbly Subscription Billing, Pabbly Email Marketing, Pabbly Form Builder, Pabbly Email Verification.

    The turnaround time is 24 hrs (Business Hours - 10.00 AM to 6.00 PM IST, Except Saturday and Sunday). So your kind patience will be highly appreciated!

    🚀🚀Exclusive Discount Offer

    Just in case you're looking for any ongoing offers on Pabbly, you can check the one-time offers listed below. You just need to pay once and use the application forever -
     

    🔥 Pabbly Connect One Time Plan for $249 (🏆Lifetime Access) -  View offer 

    🔥 Pabbly Subscription Billing One Time Plan for $249 (🏆Lifetime Access) - View offer

Random Text and Number and special characters

gulito

Member
Hi

I would like to generate initial passwords for our app. That should contain text and numbers and maybe special characters.
I know that I can use the formater to gennerate random text like that:

Number Formatter -> Spreadsheet Functions
RANDBETWEEN(11111111,99999999)
This will generate a random number between 11111111 & 99999999 every time the action is fired.

However I would like to get a combination also with text and maybe special characters.
Is there a possibility to achieve that in pabbly connect?

Thanks for your help.
best
Olivier
 

Supreme

Well-known member
Staff member
Hey @gulito

Certainly, you can create an alpha-numeric password in Pabbly Connect with the help of the Code action step of JavaScript.

1684317257053.png


function generateRandomPassword(length) { var charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; var password = ""; // Ensure at least one number in the password var hasNumber = false; for (var i = 0; i < length; i++) { var randomIndex = Math.floor(Math.random() * charset.length); var character = charset.charAt(randomIndex); if (!hasNumber && /[0-9]/.test(character)) { // If no number in password yet, add a number hasNumber = true; } password += character; } // If no number in password, add a random number at a random position if (!hasNumber) { var randomPosition = Math.floor(Math.random() * length); var randomNumber = Math.floor(Math.random() * 10); password = password.slice(0, randomPosition) + randomNumber.toString() + password.slice(randomPosition + 1); } return password; } var password = generateRandomPassword(10); return(password);
 
Top