search cancel

How to trim trailing spaces of an attribute


Article ID: 49050


Updated On:


CA Directory CA Identity Manager CA Identity Governance CA Identity Portal CA Risk Analytics CA Secure Cloud SaaS - Arcot A-OK (WebFort) CLOUDMINDER ADVANCED AUTHENTICATION CA Secure Cloud SaaS - Advanced Authentication CA Secure Cloud SaaS - Identity Management CA Secure Cloud SaaS - Single Sign On CA Security Command Center CA Data Protection (DataMinder) CA User Activity Reporting



With IDM 12.6 use Policy Xpress trim function. With 12.5 use a validation java script to identify and trim the trailing space character and setting back the attribute's value.


If in need to trim trailing space of an attribute (such as user id , but for any attribute) here is what you can do:

IDM 12.6 enhanced the Policy Xpress to provide a trim function. Create a policy using PX -> Data -> General -> String Parser -> here you will see the trim function.

IDM 12.5 does not include the trim function in Policy Xpress. Therefore you will need to use custom code to get this done. While you can use LAH or BLTH to achieve that you might want to consider using a validation javascript function which is easier. Use Modify Admin Task -> Find your task -> Tabs -> Profile -> Select your field. In the validation script you can use the following example that uses regular expression to replace the trailing space characters with empty strings, hence eliminating the trailing spaces.

Function validate(FieldContext, attributeValue, changedValue, errorMessage) {       
If (attributeValue.indexOf(" ") > -1) { 
          changedValue.reference = attributeValue.replace(/\s+|\s+$/g,""); 
Return true;


Component: IDMGR