This topic contains 4 replies, has 0 voices, and was last updated by stephanie.burris 7 years, 8 months ago.
-
AuthorPosts
-
October 5, 2016 at 4:28 pm #6117
nameunknown01Hi everyone,
We have an old but established function running in our account that creates deposit records against sales orders. It has been running for a long time. and only in the last week has it started to fail by not applying the submitted amount to the deposit record.
The payment amount is always changing to the total in the sales order and not to the payment value that we submit. The below JSON is a dump of the record as we create it and logged to the suitescript logger in Netsuite.
everything saves in Netsuite, but the amount is never what we submit, its always the total of the sales order
PHP Code:
{“tranid”:”11″,”exchangerate”:1,”trandate”:”01/11/2016″,”currencyname”:”USA”,”salesorder”:{“internalid”:”1083″,”name”:”Sales Order #246″},”undepfunds”:true,”isrecurringpayment”:false,”ccapproved”:false,”postingperiod”:{“internalid”:”3″,”name”:”Jan 2002″},”recordtype”:”customerdeposit”,”currency”:{“internalid”:”1″,”name”:”USA”},”payment”:99.25,”id”:”1094″,”customer”:{“internalid”:”-5″,”name”:”John Smith”}}
Below is the function we used / have used for over a year
PHP Code:
/* this function records a deposit payment */
function createDeposit(objData)
{
try
{
var depositData = objData.data[0];
var recDeposit = nlapiCreateRecord(‘customerdeposit’);
recDeposit.setFieldValue(‘account’, setValue(depositData.account));
recDeposit.setFieldValue(‘payment’, setValue(depositData.payment));
recDeposit.setFieldValue(‘salesorder’, setValue(depositData.salesorder));
recDeposit.setFieldValue(‘trandate’, setValue(depositData.trandate));
recDeposit.setFieldValue(‘customer’, setValue(depositData.customer));
recDeposit.setFieldValue(‘paymentMethod’, setValue(depositData.paymentMethod));depositID = nlapiSubmitRecord(recDeposit, true, true);
objResponseData.internal_id = depositID;
}
catch (e)
{
var stErrMsg = ”;
if (e.getDetails != undefined)
{
stErrMsg = e.getCode() + ‘ ‘ + e.getDetails() + ‘ ‘ + e.getStackTrace();
}
else
{
stErrMsg = e.toString();
}
}
}
// end functionThis is currently deployed in my netsuite sandbox / developer testrdrive account and no matter what we do, it continually overrides the amount with the sales order amount.
We can apply any values we want via the UI, but cannot apply it via suitescript.
Any help greatly appreciated
This is a cached copy. Click here to see the original post. -
October 5, 2016 at 4:44 pm #6118
KCSF BudI can’t speak to precisely what changed, but we had the same issue on a script that has been running for quite some time. Netsuite support came through and advised to use the following: nlapiCreateRecord(‘customerdeposit’, {recordmode: ‘dynamic’});
They must have changed the default record mode or something. This fixed it for us, previously it was nlapiCreateRecord(‘customerdeposit’) and 2016.2 broke the amount being charged in the same way.
nameunknown01 replied on 10/05/2016, 05:15 PM: thanks for the suggestion, its definitely doing something, but now throwing an error indicating the customer ID is NULL.
-
October 11, 2016 at 2:47 pm #6119
nameunknown01Hi everyone,
hoping I might be able to get a bit of assistance, possibly from Netsuite,
Ive added in the nlapiCreateRecord(‘customerdeposit’, {recordmode: ‘dynamic’}); to my code, it appears to not throw any major errors, but still isnt recording a partial amount against the deposit records Im trying to create.
Any ideas on why this would possibly be the case ?
-
October 14, 2016 at 1:37 pm #6120
KCSF BudLooking through the help on this – the order in which you set the fields does matter in dynamic mode. So, maybe the payment amount is being set to the value you want but then when you load customer/order it is being overidden to SO amount? I’d try with the ‘payment’ field being set last. Just a thought, I am new to dynamic mode.
-
February 28, 2017 at 7:41 am #6121
stephanie.burrisIn case anyone comes across this post, I was having the same issue and moving the payment amount to be the last field set fixed the issue for me. Thanks KCSF Bud!
-
AuthorPosts
You must be logged in to reply to this topic.