How to trim trailing spaces of an attribute

Document ID : KB000049050
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

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.

Solution:

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;
}