Discussions
Simple script that pulls the original sales order number to a custom field on a copied sales order
I was following SuiteAnswers: Answer Id: 44790, but am obviously missing something. I will first note that I am working in our Sandbox and have no experience with scripting. I am hoping this would be an easy answer for someone in this forum. 
1. I started by creating a custom transaction body field on our Sales Order form. Field ID: 'custbody_dlw_originating_record'
2. Create a Client Script with a pageInit function using the sample code below
3. The script looks like this:
function getSourceID(type){
    if (type = 'copy'){
        var entryForm = nlapiGetFieldValue('entryformquerystring');
              if (entryForm.charAt(0) == 'r'){
              var entryForm_substr =  entryForm.substr(8);
              var start_pos = entryForm_substr.indexOf("=");