Jump to content

Update customer phone number from detail_cr employee form

Recommended Posts

Hey guys!

I need to update some customers data according to the information that he enters at the moment of the opening of the ticket, for example a phone_number field.

When filling this information in detail_cr, I need this phone data to be recorded in the phone_number attribute in the cnt factory. 

I found a spel code from @cdtj and thought it would work well.



  object inc_group_leader;
  send_wait(0, top_object(), "get_co_group");
  if (msg_error())
    logf(ERROR, "Error: '%s'", msg[0]);
  inc_group_leader = msg[0];
  string inc_where_clause;
  inc_where_clause = format("id = U'%s'", customer); // your UUID here, customer for example
  send_wait(0, top_object(), "call_attr", "cnt", "sync_fetch", "STATIC", inc_where_clause, -1, 0);
  object inc_zfound;
  inc_zfound = msg[0];
  object inc_zobj;
  send_wait(0, inc_zfound, "dob_by_index", "DEFAULT", 0, 0);
  inc_zobj = msg[0];
  send_wait(0, inc_group_leader, "checkout", inc_zobj);
  if (msg_error())
    logf(ERROR, "Cannot checkout");
  inc_zobj.phone_number = string4; // your attributes here
//  inc_zobj.z_some_another_attribute = z_value; // u can change multiple attributes
  send_wait(0, inc_group_leader, "checkin");
  if (msg_error())
    logf(ERROR, "Cannot checkin");
    send_wait(0, inc_group_leader, "uncheck");

I think I need to add some more details to the spel code or even improve the trigger.

My trigger: 

MODIFY cr POST_VALIDATE z_update_cnt( customer, string4 ) 
	9020 FILTER(EVENT("INSERT") && (status == "OP")) ;	

Do I need to add any other attributes to the spel code?


Edited by diegolimahif

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...