field map scripts

Kiran Kumar m
Tera Contributor

Hi 

im importing catalog ui policy through import sets but im having trouble while writing my transform field map script 

for my catalog conditions like here im writing three columns in excel sheet for

choose variable ..choose operator and input value 

and im importing them and in transform field script im assing all those 3 fields to catalog conditions field in target table 

so here im taking variables sys ids from item_option_new  table and assigning those sys ids to those 3 source fields and im returning that condition format 

so here is my code so help me complete it  and my condition should be in this format :

   gr.catalog_conditions = "IO:c34b1842b7321010e54deb56ee11a92b=3^ORIO:c34b1842b7321010e54deb56ee11a92b=5";

 

 

answer = (function transformEntry(source) {

    // Add your code here
    var operator = source.u_choose_operator.getDisplayValue();
    var variableName = source.u_choose_option.getDisplayValue();
    var inputValue = source.u_input_value.getDisplayValue();


    var con = new GlideRecord('item_option_new');
    con.addQuery('variable_name');
    con.query();
    if (con.next()) {
        var c = con.variableName.getUniqueValue(); ;
        var o = con.operator.getUniqueValue(); 
        var i = con.input_value.getUniqueValue(); 

    }

    con.initialize();
    con.c = variableName;
    con.o = operator;
    con.i = inputValue;
    con.insert();

    var condition = "IO:c" + "3^ORIO:o" + "i^EQ";                              
                                                                                
    return "IO:c + 3^ORIO:o + i^EQ ";                                       
                                                                                    
                                                                                          

 

})(source);

 

 

 

And here is my excel sheet refer sheet number 6

 

Thanks in advance 

2 REPLIES 2

SumanthDosapati
Mega Sage
Mega Sage

Hi,

If you want to move your ui policy between two instances then why not using update sets? 

 

Regards,
Sumanth

no im not moving between two instances its my task to import ui policies and im working on a project to import multiple ui policies so i need to complete that field script