Script for data scrambling in non production instances

Divya Dattatra2
Giga Contributor

Hi,

Can anyone help me with the post cloning script for data scrambling in non production instances.

Thanks in advance!

1 ACCEPTED SOLUTION

VigneshMC
Mega Sage

Got this from stackoverflow. you can use normal GlideRecord and use this function to scramble text wherever needed

function shuffelWord(word){
    var shuffledWord = '';
    word = word.split('');
    while (word.length > 0) {
      shuffledWord +=  word.splice(word.length * Math.random() << 0, 1);
    }
    gs.print (shuffledWord);
}

shuffelWord("test test");

Thanks

View solution in original post

10 REPLIES 10

Hi Govind,

Thanks for responding, I appreciate your efforts. But here i need help in scripting part.

VigneshMC
Mega Sage

Got this from stackoverflow. you can use normal GlideRecord and use this function to scramble text wherever needed

function shuffelWord(word){
    var shuffledWord = '';
    word = word.split('');
    while (word.length > 0) {
      shuffledWord +=  word.splice(word.length * Math.random() << 0, 1);
    }
    gs.print (shuffledWord);
}

shuffelWord("test test");

Thanks

For the script Vignesh Provided, make sure you apply it on String fields only. You May need a separate function to scramble dates, encrypted fields , choice fields, etc etc. So this data scrambling things you are trying to achieve is a huge effort. Also, if you scramble data , you are performing many update operations which may trigger business rules. Make sure to turnoff business rules by using setWorkflow(false) command.

Hi Vignesh,

Could you please given an example of how you would do a GlideRecord to update a user's email address with this shuffleword function?

Many thanks,

Anna