To copy variable's value into a journal type field

Poorva Bhawsar
Mega Sage

Hi Community,

 

I have few select box variables, if user selects the value of those variables as rejected, rejection reason field will populate. I want to copy the value of those variables if they are rejected along with the rejection reason from sctask to another table's journal type field.

 

I am thinking about the logic like if xyz == rejected && rejection reason != '' then need to add them in that journal field. If those are not rejected, those i approved i dont want to add them in this journal field.

 

Thanks,

Poorva Bhawsar

 

1 ACCEPTED SOLUTION

Hi @Poorva Bhawsar the error is below

var answer = [];
var server_name = current.variables.server_name_s.toString();
var arr = server_name.split(',');
for (var i = 0; i < arr.length; ++i) {
var grCI = new GlideRecord('cmdb_ci_server');
grCI.addEncodedQuery('sys_idIN' + server_name.toString());//replace to arr[i]

to

grCI.addEncodedQuery('sys_idIN' + arr[i]);
grCI.query();
while (grCI.next()) {
//gs.log("Inside the l

Regards
Harish

View solution in original post

35 REPLIES 35

Here i have an another issue. If i am using cmdb_ci table for the gliderecord, its not working for its child tables. I mean its not updating the deviation notes field for this. Thats why i did gliderecord on cmdb_ci_server table but if i use this table it will not work for server child tables.

 

What we need to do in this case?

And what if i need to gliderecord it on server table only. What should be the query for this?

Hi @Poorva Bhawsar  you need a relationship between your server table and catalog task table for the query to work.

 

If you dont have a relationship then you need to find a unique value between server and task table and use that field in your query so that it can provide correct update.

 

What is your requirement exactly? How is the task generated? Do you have any workflow or flow designer?

Regards
Harish

i have a workflow for this.

Hi @Poorva Bhawsar what is the reason behind to update deviation notes on Server table? are you selecting any servers in your catalog form and in return your updating the selected servers in server table?

 

 

Regards
Harish

Yes i have server names field. Whatever servers i am selecting there, it should update deviation notes with the request item no and the reason user selected and mentioned if its failed.