Saturday, June 22, 2019

Pass Internal ID from Saved Search Result as URL Parameter

The steps below describe how a parameter can be passed in a URL between records or between a saved search and record.

Example: Pass Internal ID of a call from the Phone Calls saved search result (based on Activities > Scheduling > Phone Calls) in URL as parameter to Contact record. Afterwards he parameter is used to change the Phone Call value of a custom field based on updated on the Contact record.
  1. Create a custom formula text field Formula (Text) in the Phone Calls saved search results, name it e.g. "Update Contact/Call"
  2. Set the Formula (Text) field value as follows (for the particular example delineated above):
    • The Formula field: '<a href="https://system.netsuite.com/app/common/entity/contact.nl?id=' || {internalid} || '&e=T&custcallid=' || {call.internalid} || '&e=T">Update Contact/Call</a>'
    • Note: The link of the field contains an additional parameter "custcallid" (for example "&custcallid=123"), where the ID is the ID of the call
    • Note: The custom field in the saved results is displayed as "Update Contact/Call" link to the Contact record
  3. Get the call parameter to variable named e.g. "varcallid", in User Event type script. Refer to SuiteAnswers article # 30392: (SuiteScript > Sourcing Field Value From One Record to Another (Using URL Parameter)).
  4. Create beforeRecordLoad function and use it to set a new custom body field in the script. Name it e.g. "URL Call ID" and set the ID to e.g. "url_call_id". The field can be also hidden.
  5. Set the value of the "url_call_id" field with the "varcallid" value.
  6. Create beforeRecordSubmit function, update the value of the custom Phone Call field using nlapiLoadRecord. Use the "url_call_id" value (ID of the Phone Call) and use setFieldValue() method to set desired value on the Phone Call record.

    No comments:

    Post a Comment