Wednesday, March 6, 2019

SuiteScript > Sourcing Field Value From One Record to Another (Using URL Parameter)

Scenario:
Pre-populating the issue record fields with the related case record field values after selecting "New Issue" button on the case record.

Eg:

To accomplish this you would need to create a script with the following code in it:

function userEventBeforeLoad(type, form, request){

    var case_rec = nlapiLoadRecord('supportcase', request.getParameter('case'));

    // request.getParameter('case') Grabs the case record ID from the URL Parameter of the issue record, then loads that record using nlapiLoadRecord

    nlapiSetFieldValue('product', case_rec.getFieldValue('product'));

}

The script above can be used for both Script Type: User Event and Suitelet.

No comments:

Post a Comment