Can't fetch info from Samba

Hi guys,
i have a problem with custom script + rules

here my script :

function createorder(ticket_number,ticket_date,user_settle,total_bill,id_RC,id_OR,komisi_OR,voucher_OR){
	var client							= api_headers();
	var url								= api_url();
	
	//Order Customer RC
	var postData						= new Object();
		postData.customer				= new Object();
		postData.customer.id			= id_RC;
		postData.amount					= total_bill;
		postData.metadata				= new Object();
		postData.metadata.ticket_number	= ticket_number;
		postData.metadata.ticket_date	= ticket_date;
		postData.metadata.user_settle	= user_settle;
		postData.metadata.order_type	= 'Pribadi';
	var data_orderRC					= JSON.stringify(postData);
	var create_order_url				= url+'orders/';	
		var isSuccess = host.tryCatch
  			(
  		function() {
  			result1 = client.UploadString(create_order_url,data_orderRC);
  			},
  		function(exception) {
 			hostException = exception;
  			return true;
  				}	
  			);
  	//var testresult	= JSON.stringify(result1);
  	//return testresult;
	
	//Order Customer OR
	var postData						= new Object();
		postData.customer				= new Object();
		postData.customer.id			= id_OR;
		postData.amount					= total_bill;
		postData.metadata				= new Object();
		postData.metadata.ticket_number	= ticket_number;
		postData.metadata.ticket_date	= ticket_date;
		postData.metadata.user_settle	= user_settle;
		postData.metadata.order_type	= 'Downline';
	var data_orderOR					= JSON.stringify(postData);
	var create_order_url				= url+'orders/';	
		var isSuccess = host.tryCatch
  			(
  		function() {
  			result2 = client.UploadString(create_order_url,data_orderOR);
  			},
  		function(exception) {
 			hostException = exception;
  			return true;
  				}	
  			); 
	//var testresult	= JSON.stringify(result2);
  	//return testresult;
	
	//Update Balance Gift Card OR
	var postData						= new Object();
		postData.amount					= total_bill*komisi_OR;
	var data_giftcardOR					= JSON.stringify(postData);
	var update_giftcard_url				= url+'vouchers/'+voucher_OR+'/balance'
	var isSuccess = host.tryCatch
  			(
  		function() {
  			result3 = client.UploadString(update_giftcard_url,data_giftcardOR);
  			},
  		function(exception) {
 			hostException = exception;
  			return true;
  				}	
  			); 
	//var testresult	= JSON.stringify(result3);
  	//return testresult;

and here my rules :

{CALL:createorder.createorder('{TICKET NO}','{TICKET DATE}','{TICKET TAG:NAMA CAMPAIGN}','{TICKET TOTAL}','{TICKET TAG:CUSTOMER RC}','{TICKET TAG:CUSTOMER OR}',{TICKET TAG:KOMISI REFERRER}','{TICKET TAG:VOUCHER OR}')}

when i run, the field like {TICKET NO} didn’t fill the ticket_number in script

hope you can help me,
Regards,
Cynthia

On what event are you calling this script? Ticket number is not set until the Ticket Closing event.

2022-05-25_10;07_1653494853_Samba.Presentation

Ah, i set it before closing

I changed it to after ticket closing
But it’s still can’t run

You’re missing a single quote in your call tag in front of {TICKET TAG:KOMISI REFERRER}.

this is what I used:

{CALL:createorder.createorder('{TICKET NO}','{TICKET DATE}','{TICKET TAG:NAMA CAMPAIGN}','{TICKET TOTAL}','{TICKET TAG:CUSTOMER RC}','{TICKET TAG:CUSTOMER OR}','{TICKET TAG:KOMISI REFERRER}','{TICKET TAG:VOUCHER OR}')}

An exception is thrown for whatever reason. Hunting those down in a script is a pain.

2022-05-28_15;47_1653774439_Samba.Presentation