Hi,
another script - I have tried writing (from various codes on the forums) but doesn't work... Please can someone have a look and tell me where I'm going wrong?
Problem :
currently we can print 100's of Picking Tickets of the same order. We don't have a system in place to show 'Copy' on the invoice or an alert if the picking ticket is already printed... This problem dupes tickets and multiple items can and have been sent out to customers..
What I am trying to achieve :
I want an alert poppping and also want to set a field to show that the picking ticket is already printed.. the field will be used in Searches to help users know not to duplicate it..
Other Optional Help I'm interested in - If users clicks twice on the 'Print Picking ticket' have an alert - "Are you sure you want to print?"....also is there a way to change the picket ticket to show copy? I guess I can customize the 'Transaction PDF' and have my field at the top or something...?
The Code :
function OnPageInit() { var ticket = nlapiSearchRecord('salesorder', null, new nlobjSearchFilter('internalid', null, 'is', nlapiGetRecordId()), [ new nlobjSearchColumn('field','systemnotes'), new nlobjSearchColumn('date','systemnotes'), new nlobjSearchColumn('newvalue','systemnotes'), ]); for(var i = 0; i < ticket.length; i++){ nlapiLogExecution('DEBUG',ticket[i].getText('field', 'systemnotes')); if (ticket[i].getText('field','systemnotes')== 'Printed Picking Ticket' && ticket[i].getValue('newvalue','systemnotes') == 'T') { alert("Picking Ticket is already PrintednThanksnMayur"); nlapiSetFieldValue('custbody10', 'Ticket Printed Already'); return false; } if (ticket[i].getText('field','systemnotes')== 'Printed Picking Ticket' && ticket[i].getValue('newvalue','systemnotes') == 'F') { return true; } } } Thanks Mayur