The requested resource was not found error while trying to use a NetSuite Link externally

If we use url.resolveRecord(options) to generate a record URL and attempt to access it externally, such as from an email, we may encounter an error like:

404 Not Found

The requested resource was not found.

This occurs because the generated URL does not include the domain.

To avoid this, we should create the record URL using the following syntax:

let recordUrl = `https://${url.resolveDomain({

          hostType: url.HostType.APPLICATION

        })}${url.resolveRecord({

          isEditMode: false,

          recordId: recordId,

          recordType: “customrecord_csv_upload”

        })}`;

recordUrl += ‘&login=T’;

The login=T parameter ensures the user is authenticated by forcing a login before accessing the specified page if the user is not already logged in.

Leave a comment

Your email address will not be published. Required fields are marked *