I am trying to add a button to the Cash Sale screen that will automatically redirect the user to the Edit Item Fulfillment Screen associated with the same sales order as the original Cash Sale. I was provided pseudo code to make this happen and here is what I translated this to:
function myBeforeLoadFunc(type,form) { if (type == 'view') { form.setScript('customscript5'); form.addButton('custpage_edit_fulfillment_button','Edit Fulfillment','editfulfillment()'); } }This is set as a type "user event" deployed on the Cash Sale screen before loading the page. This is currently running correctly, at least to the point that it is displaying the desired button on the screen.The second part is this:function editfulfillment() { var createdFrom = nlapiGetFieldValue('createdfrom'); var arrSearchFilters=new Array(); arrSearchFilters[0]=nlobjSearchFilter('createdfrom', null, 'anyof', createdFrom); var arrSearchResults = nlapiSearchRecord('itemfulfillment', 'customsearch131', arrSearchFilters); if (arrSearchResults != null) { var searchRecord = arrSearchResults[0]; var itemfulfillmentid = searchRecord.getValue(columns[0]); var redirectUrl = nlapiResolveURL('RECORD', 'itemfulfillment', itemfulfillmentId, 'EDIT'); window.location = redirectUrl; } }This is set as a type "Client," is not deployed on any particular screen but should be called by the button.Currently when the button is clicked it does not appear to do anything, no errors, no redirect, nothing.customsearch131 that is referenced in the second section when defining the arrSearchResults is a search with two filters, "Type" is "Item Fulfillment" and "Main Line" is "True." The results are a single column containing the Internal ID.Any help is appreciated. Thanks.