Boomi Mapping - Removing special chars from an input

Dell Boomi mapping shape provides numerous ways to modify/enrich an input via functions. In this post I am going to show how I validated and removed special chars from an input using Scripting and do it along with another string function.

The user defined functions available with mapping, allows us to apply sequence of functions to the input. In this example, I am going to use it.

Use Case:

I have two input strings coming from the source profile (first_name and last_name), which I want to first concatanate together and then remove non-alphanumeric characters if present.


Solution


  1. In your map, add an User Defined function and add two inputs; first_name, last_name. 
    Add User Defined function into the map
    Added inputs to the user defined function
  2. As the first step, add a function "String Concat" under the  "String" category. 
  3. Specify first_name and last_name as the inputs. Also set a delimiter, if you need a one. In my case, I want to concatenate the values with '.'.
    String concat function
  4. Map first_name and last_name input variables to the added function. 
    Map User Defined function input to the String concat 
  5. As the second step add a "Scripting" function, under "Custom Scripting".
  6. Select "Use Inline Script" as the source and "Javascript" as the language.
  7. Define an input variable(name) and an output variable(name_modified).  
    Scripting function
  8. Use the below as the script to execute.

  9. name_modified = name.replace(/[^A-Za-z0-9.]/g, "");
    
  10. After adding it, map the result of first function as the input of the second function. 
    Map string concat output to the scripting function input
  11. Add an output variable to the map function to store the final output of function sequence. 
    Add output to the user defined function
  12. Map the "name_modified" result of script function to the output variable added above. 
    Map scripting output to the user defined function output. 
That's it. Here we added a function which take two inputs and concat them, remove special chars and return the resulting string.

Thank you!

Comments

Popular posts from this blog

PHP-SOAP web service with out a WSDL

How to add Maven dependency from a relative path referencing a local jar