Mask Spanish Fiscal Identification Numbers

The mask Spanish Fiscal Identification Numbers policy generates a random Spanish Fiscal Identification Number (NIF). If the source value includes an X prefix used to identify non-citizens, the prefix is included.

JavaScript policy syntax

This policy is available with the functions NIFMask.randomNIF() and NIFMask.maskNIF().

To generate a random value not based on an input value, use the function: NIFMask.randomNIF()

To generate a value based on an input value, use the function: NIFMask.maskNIF(record.getItem('<arg.inputAttribute>'))

For example, to generate a random value based on an input value, use the following:

NIFMask.maskNIF(record.getItem('/DEMO/CUSTOMERS/NATIONAL_ID'))

To generate a value based on the input value and mask an additional attribute in which all instances of the input value are masked, use the function: NIFMask.maskNIF(record.getItem('<arg.inputAttribute>'), '<arg.additionalAttribute>')

For example, to generate a value based on the NATIONAL_ID attribute and mask additional instances of the input value found in the CUST_ID attribute, use the following:

NIFMask.maskNIF(record.getItem('/DEMO/CUSTOMERS/NATIONAL_ID'), '/DEMO/CUSTOMERS/CUST_ID')

Argument Description
inputAttribute The attribute containing the input value to mask.
additionalAttribute The additional attribute in which all instances of the input value are masked.