Robust Transform Map - RTE Entity script Operation Not working

Nilanjan1
Mega Sage

Dear Experts, 

 

Can someone guide me on why the assigned to value is not being set in a Robust transform Map when used with Script operations on RTE Entity. 

I am trying to set the values as per the source

if the source is empty, the assigned to and managed by should be empty

if the source has a value, the assigned to and managed by should be left as is. 

 

I need some help urgently.

 

The code is attached below

 

(function(batch, output) {
        // add your code here.
        for (var i = 0; i < batch.length; i++) {
            //step1: access the input variables
            var a = batch[i].input; //Value of the source field.
            var grPC = new GlideRecord('sys_user');
            grPC.addQuery('correlation_id', a);
            grPC.query();
            if (grPC.next()) {
                output[i] = grPC.sys_id;
            }else{
				
				output[i] = NULL;
			}
		}  
        })(batch, output);

 

9 REPLIES 9

@James Chun : One more query, these are all reference fields like location, assigned to managed by etc. so when I am running the RTE, it seems that it is working in some case like updating the values, but when there is no value at the source/staging table, it does update the target table, what may be the issue? 

@Nilanjan1 , sorry not sure what you are asking here.. Are you saying if the target record's value is empty, the RTE does not update it?

Nilanjan1
Mega Sage

@James Chun  & @Pratik Malviya  

 

I will check both the solutions and reply back ! 

Shree14
Tera Contributor

Hi Nilanjan,

 

Did the script worked for you?

@Shree14  Yes it did.