= 3) { $ticket_nr = trim($argv[1]); $ticket_id = trim($argv[2]); $otrs_username_to_link = 'cmoeller'; log_message($own_path.$logfile_name,'Link CI to Ticket script started. Ticket ID '.$ticket_id.', Number '.$ticket_nr); $query_get_form_rid = sprintf("CALL get_ticket_dynamic_field_value('%s', 'RIDNr')", $ticket_id); $res1 = execute_sp_read_single_value($query_get_form_rid, 'value_text'); if (($res1[0]==True) && ($res1[1]!='')){ log_message($own_path.$logfile_name,'RID in Ticket '.$ticket_id.' is '.$res1[1]); $query_create_link = sprintf("CALL otrs5.link_cmdb_ci_computer_to_ticket('%s', '%s', '%s');", $ticket_id, $res1[1], $otrs_script_user_loginname); $res_link = execute_sp_read_single_value($query_create_link, 'result'); if (($res_link[0]==True) && ($res_link[1]=='0')){ log_message($own_path.$logfile_name,'Successfully linked'); } else { log_message($own_path.$logfile_name,'Linking failed'); } } } else { echo 'Call me as a OTRS script'; } ?>