Setting Integer and Bool values in triggers

lock
push_pin
done
Answered
2

I'm making a new message trigger that should set an extra field on a ticket/request. for extra fields of type String this works as expected, but for Integer and Boolean I'm unable to set the value:

  Integer ticketId = Integer(ed.getInputValue("outbox.ticketId"));
  NSTicketAgent ticketAgent;
  NSTicketEntity ticket = ticketAgent.GetTicketEntity(ticketId);
  Map extras;
  extras.insert("x_snorre", "string value inserted");    //works
  extras.insert("x_snorre2", "34");       //don't work
  extras.insert("x_snorre2", "[34]");     //don't work
  extras.insert("x_snorre2", "[I:34]");   //don't work
  ticket.SetExtraFields(extras);
  ticketAgent.SaveTicketEntity(ticket);

 

Any suggestions?

22 Apr 2024 | 05:45 AM

All Replies (2)

It looks like if I set the field manually first through the GUI, then the script works every time afterwords. I have tried to set a default value to 0 for the Integer field, but that does not seem to help. For Boolean fields a default value for the extra field solves the problem.

22 Apr 2024 | 06:03 AM

Hi Snorre,

Extra Fields (for service entities) and User-Defined Fields (for Sales entities) are in transition to unifiy. If you use the CustomFields property instead, you should get better results. CustomFields is the new replacement that unifies them when applicable.

Best regards. 

22 Apr 2024 | 07:18 AM

Add reply