locked
workflow Randomly generating an alpha numeric string. RRS feed

  • Question

  • Good evening everyone.

    I have created a custom entity that one department will fill out, once done they change the status then a work flow picks this up and creates an account and contact record for the data.  For my contact record we are handing out a user name and password.

    heres where i am stuck. 

    How can i generate the username with a work flow with the form of first letter of first name and last name in whole. So for "bill gates" it would be "bgates"

    Also how could i set it to randomly generate an alpha numeric password of 8 characters?  I was thinking just a counter but i need letters as well.

    Any ideas?  i am getting to be somewhat skilled with CRM tho my coding is poor due to lack of experience. this has been a growing task of mine to assist with the CRM for my company.

    Tuesday, December 21, 2010 1:55 AM

Answers

  • You won't be able to do it with "out of the box" workflow steps.  It would, however be relatively easy to accomplish with a custom workflow activity of your own design, provided you have the .NET coding skills required (not high level, but you will have to code, compile and install the assembly).

    The "username" could be accomplished using the CRM Manipulation Library; a set of CRM Custom Workflow Activities written by developers from Engage and made freely available on CodePlex.

    The Substring step could be used to rip apart the first name; use the result and the last name to build your username.  Perhaps you could use a selection of substrings from other fields to build your (not so) "random" password?

     


    --pogo (pat)
    Tuesday, December 21, 2010 2:47 AM
  • You won't be able to do it with "out of the box" workflow steps.  It would, however be relatively easy to accomplish with a custom workflow activity of your own design, provided you have the .NET coding skills required (not high level, but you will have to code, compile and install the assembly).

    The "username" could be accomplished using the CRM Manipulation Library; a set of CRM Custom Workflow Activities written by developers from Engage and made freely available on CodePlex.

    The Substring step could be used to rip apart the first name; use the result and the last name to build your username.  Perhaps you could use a selection of substrings from other fields to build your (not so) "random" password?

     


    --pogo (pat)
    The CRM Workflow Manipulation Library does offer a RandBetween function in their Solve Equation workflow step. Between this and the Substring function, you could definatly create an alphanumeric PW. 
    Dodd
    Tuesday, December 21, 2010 2:18 PM

All replies

  • You won't be able to do it with "out of the box" workflow steps.  It would, however be relatively easy to accomplish with a custom workflow activity of your own design, provided you have the .NET coding skills required (not high level, but you will have to code, compile and install the assembly).

    The "username" could be accomplished using the CRM Manipulation Library; a set of CRM Custom Workflow Activities written by developers from Engage and made freely available on CodePlex.

    The Substring step could be used to rip apart the first name; use the result and the last name to build your username.  Perhaps you could use a selection of substrings from other fields to build your (not so) "random" password?

     


    --pogo (pat)
    Tuesday, December 21, 2010 2:47 AM
  • Hi Steve,

    The following JavScript will generate a random password (in the example 8 characters long):

    function randomPassword(length)
    {
    length =8
      chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
      pass = "";
      for(x=0;x<length;x++)
      {
        i = Math.floor(Math.random() * 62);
        pass += chars.charAt(i);
      }
      return pass;
    }
     {
      crmForm.all.password.DataValue = randomPassword(length.value);
      return false;
    }

    You could have a play with this, perhaps creating a Password Entity and creating a relationship to your custom entity etc...

    Just a start.

    Rob


    www.crmconsult.info Twitter:robertpeledie
    Tuesday, December 21, 2010 11:54 AM
  • You won't be able to do it with "out of the box" workflow steps.  It would, however be relatively easy to accomplish with a custom workflow activity of your own design, provided you have the .NET coding skills required (not high level, but you will have to code, compile and install the assembly).

    The "username" could be accomplished using the CRM Manipulation Library; a set of CRM Custom Workflow Activities written by developers from Engage and made freely available on CodePlex.

    The Substring step could be used to rip apart the first name; use the result and the last name to build your username.  Perhaps you could use a selection of substrings from other fields to build your (not so) "random" password?

     


    --pogo (pat)
    The CRM Workflow Manipulation Library does offer a RandBetween function in their Solve Equation workflow step. Between this and the Substring function, you could definatly create an alphanumeric PW. 
    Dodd
    Tuesday, December 21, 2010 2:18 PM