Issue in passing argument from Business rule to Script Include

mikeg1
Kilo Explorer

Hi Folks,

 

I have created a "Async" business rule which does some specific task on Incidents table. I am passing the following arguments from BR as :

 

var executeJob = new GlideRunScriptJob();
executeJob.scheduleScript("new getData().getDescription('incident','description','"+current.number+"')");

 

Here 'description' is Incident's field name which I am passing as argument. Now i am using it in one of the function of Script Include as:

 

getDescription: function(name, field, record) {
               var oTable = new GlideRecord(name);
               oTable.addQuery('number',record);
               oTable.query();
               if (oTable.next()){
                     ...
                     .....
                     oTable.field = ''Set to some random value....'
               }
}

 

Now every thing is working as intended but it seems "oTable.field" is not getting parsed at all. Ideally in this case "field" as argument should contain the 'description' but its not happening. I am assuming that Object "oTable" is considering 'field' as one of Incident table field instead of as passed argument, that's why system is not able to parse it correctly.

 

Can anyone guide me through this if I am missing something here?

 

Thanks,

1 ACCEPTED SOLUTION

setValue should work. Did you check other syntax issues?


Can you try as follows and see if that works?



oTable[field] = 'some random value';


View solution in original post

7 REPLIES 7

Kalaiarasan Pus
Giga Sage

oTable.setValue(field, value)


Hi Kalai,



Have already tried that but its not working too, any other input ?



Thanks,


setValue should work. Did you check other syntax issues?


Can you try as follows and see if that works?



oTable[field] = 'some random value';