Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Mapping Error on submission of form if the field mapped from variable is Encrypted

fathimasnow
Tera Contributor

We have a encrypted field on case table and we need to map that field with Record producer variable from map to field in the variable. After mapping we are getting error "Invalid attempt. Encrypted data could not be saved".

1 ACCEPTED SOLUTION

Naveen20
ServiceNow Employee

Use the Record Producer's Script field. Remove the "Map to field" on that variable, and add this in the Record Producer's Script:

 
javascript
(function() {
    var encryptedValue = producer.variables.your_variable_name.toString();
    if (encryptedValue) {
        current.your_encrypted_field = encryptedValue;
    }
})();

View solution in original post

2 REPLIES 2

Naveen20
ServiceNow Employee

Use the Record Producer's Script field. Remove the "Map to field" on that variable, and add this in the Record Producer's Script:

 
javascript
(function() {
    var encryptedValue = producer.variables.your_variable_name.toString();
    if (encryptedValue) {
        current.your_encrypted_field = encryptedValue;
    }
})();

fathimasnow
Tera Contributor

Thank you so much for the quick response this piece of code work's