Encrypting/Masking Variables in a Catalog Form (Integer field and String Field)

shahid1
Kilo Expert

Hi All,

We have a requirement here to make two of the catalog fields, in a form, encrypted/masked. (Basically the client wants us to make the fields look like a password field where and when user types in the text or integer it comes up in "*****" format or hidden format).

So , how to do that for a variable type string (Text Box) or Integer field? Anybody can help here?

Will that appear in the same way in the RITM form and TASK form?

And what will be the process to decry-pt or unmask it?

Thanks in Advance,

Shahid

23 REPLIES 23

Hi Rahul and Gurpreet, Gurpreet Singh



I am not that good with the encryption thing through business rule as of now.



So can you please share a script where i can understand it and edit it according to my needs.



P.S :- Your code will give me a base as i havent done encryption through scripting earlier.



And will it be that i should be accessing the scratchpad to encrypt the field values on RITM and TASK form too?



Thanks and RGDS,


Shahid


Hi Rahul and Gurpreet, Gurpreet Singh



Also if you write a macro code for making it encrypted , the text is not getting carried over to the RITM or TASK.



It just stays blank.



Any suggestions?



RGDS,


Shahid


Ok, I got the same


Anyhow i got a solution for storing value as encrypted value and show it on some action


The fields which is mapped with those fields make it type as decrypt Password (2 Way Encrypted)


To show the actual value you can create a UI action with below script



  • function getPass(){
  • var user = new GlideRecord('sc_req_item');  
  • user.get('sys_id', current.sys_id);  
  • gs.addInfoMessage(user.u_color);
  • get_pass.setRedirectURL(current);
  • }

See attached screenshot. However masking the variable on catalog is still a mystery


Hi Rahul,



Awesome!! .



The real requirement is to hide the value of the field and make it visible as "*****" in the RITM and TASK level.(Not on the form, if possible then it would awesome).



Can anything be done through scratchpad?



Thanks,


Shahid


A crazy idea


- Keep the UI macro as usual


- Create a new variable(Hidden)


- Crate a catalog client script to pass the value of UI macro field to new variable


- Create a before business rule with below code


function onBefore(current, previous) {


  //This function will be automatically called when this rule is processed.


  var current_variable = current.variables.variablename;


  current.field = current_variable;


}



Rest as i explained earlier