This topic contains 5 replies, has 0 voices, and was last updated by HollieY 6 years, 11 months ago.
-
AuthorPosts
-
December 8, 2017 at 1:08 pm #21466
HollieYI have a user event script that copies data from a vendor bill into a new transaction, and at the end, we want to Cancel the Vendor Bill. Void does not work because of the accounting preferences, and because the Bill is in Pending Approval status and is never approved. Does anyone know if there is a method to do this? Setting the status field with script does not work. I can change the Approval Status field to Rejected, but that doesn't actually cancel the Vendor Bill. Help with the syntax to do this would be greatly appreciated.
This is a cached copy. Click here to see the original post. -
December 11, 2017 at 2:00 pm #21467
pcutlerCan you elaborate on what you mean when you say that doesn't actually cancel the vendor bill? In my testing, rejecting the bill as follows caused it not to post and have a status of "rejected:"
Code:
var bill=nlapiLoadRecord(nlapiGetRecordType(), nlapiGetRecordId()); bill.setFieldValue('approvalstatus', '3'); // rejected nlapiSubmitRecord(bill);
-
December 11, 2017 at 3:13 pm #21468
HollieYThat's correct, that's what I'm resorting to now, but it is not exactly what they want. A rejected vendor bill can still be edited, unless I add a workflow to Lock it.
When you look at a Vendor bill in Pending Approval status in the UI, you have a Cancel button. When you click this button, it changes the document status to Cancelled, removes the dollar amounts and does not allow editing. That's what we're looking for. I can't find a method that replicates this UI button in script.
Thanks, Hollie
-
December 11, 2017 at 4:02 pm #21469
pcutlerGot it, thanks for clarifying. Although undocumented, this works for me:
Code:
var bill=nlapiLoadRecord(nlapiGetRecordType(), nlapiGetRecordId()); bill.setFieldValue('cancelvendbill', 'T'); nlapiSubmitRecord(bill, true, true); -
December 12, 2017 at 12:58 am #21470
gerson.rodriguezHi HollieY, I have a unrelated question for you? Any plans to move to SS 2.0 ?
-
December 12, 2017 at 1:34 pm #21471
HollieYMr. Cutler, you are marvelous. Thank you, it was just what the doctor ordered. And Gerson, yes, plans to move to SS 2.0 but I have not overcome the learning curve yet!
Hollie
-
AuthorPosts
You must be logged in to reply to this topic.