In the transformation map, how to fill field opened by in the target table with the logged in user

Lucas Rodrigues
Tera Contributor

I have a transform map that takes an excel table and transforms it into an occurrence in a table. This table has the field open by. And this field is always filled in as system in ocurrences that were created by import from Excel. I want this field to be filled with the user who imported from excel.

I tried to do it, creating a field map as the image below, but it did not work:

LucasRodrigues_0-1709759690848.png

I don't want to do this using Business Rule. I want to do this using transform map scripts. Is there a way to do it?

 

5 REPLIES 5

Amit Pandey
Kilo Sage

Hi @Lucas Rodrigues 

 

You can use the following script in onBefore transform script-

(function executeTransformMap(source, map, log, target ) {
    
    var currentUser = gs.getUserID(); 
    target.opened_by = currentUser;

  
})(source, map, log, target);