I need to copy value of one of the custom ticket fields to another custom field. So, I am trying to get the value of field1 using "client.get()" and once it is returned, trying to assign it to field2 using "client.set()", as shown in the code.
But it isn't working. Can someone please suggest what's is wrong with this code or provide an alternative code to achieve this?
I am executing this on "ticket.save" event in ticket_sidebar location.
var client = ZAFClient.init();
client.invoke('resize', { width: '100%', height: '200px' });
client.on('ticket.save', function(data) {
client.get('ticket.customField:custom_field_900009336126').then(function(data){
console.log('fulfilled'); //this is printing
console.log("Field_1_Value", data['ticket.customField:custom_field_900009336126']); //this is printing
//Assign value of field_1(900010861363) to another field_2(900005555555)
client.set('ticket.customField:custom_field_900010861363', data['ticket.customField:custom_field_900005555555']); //this doesn't work
console.log('Print Last Line'); //this is printing
});
});
Just to make sure I answer appropriately, are you referring to pushing the fields from an incident into a different ticket's (the problem ticket) fields?
Thanks!