I am working on a program that takes a users CVS file, and populates into a table while calculating the dollar amount then on submit the data table values will be sent using AJAX API. The problem that I am having is the create_sotransaction is a object-specific function which is a 2.1 XML version. My guess is that version does not work with AJAX, but need community support.
<script>
`function createBeforeSubmit(){
console.log("Within the function");
var fieldsArray = {
'transaction_type': 'Sales Invoice',
'datecreated' : {
'year': '2024',
'month': '3',
'day': '20'
},
'customerid': jq('#MY_CUSTOMER').val(),
'state': 'Pending',
'sotransitems': {
'sotransitem': {
'itemid': jq('#MY_ITEM').val(),
'price': jq('#MY_Amount').val(),
'quantity': 1,
'locationid': jq('#My_Revenue').val(),
'departmentid': jq('#MY_Department').val(),
}
}
}
var api = new API_Session();
var callback = function(responseText){
console.log(responseText)
}
api.ip_create('create_sotransactions', fieldsArray, callback);`
}
</script>
outcome: The values of the inputs will go into a Sales Invoice with the correct objects.