You send emails from a transaction record in NetSuite, and you want the email to contain a link to the transaction it references. However, you use the same template for multiple transaction types, and the URL path changes depending on the transaction type.
For example, in NetSuite, the sales order URL path contains this string:
‘app.netsuite.com/app/accounting/transactions/salesord'
While the invoice path contains this string:
‘app.netsuite.com/app/accounting/transactions/custinvc’
Normally, we could use the following line to wrap the transaction ID in a link:
<a href="https://0123456-sb1.app.netsuite.com/app/accounting/transactions/salesord.nl?id=${transaction.id}&whence=">
${transaction.tranId}
</a>
This yields the transaction ID string with a hyperlink in the email content.
However, when created from an invoice record or record type other than a sales order, the hyperlink in the email breaks due to the differences in the URL paths between transaction types.
Edit the source code of the email template:
Copy and paste the following code segment where you want the link to occur in the email template:
<a href="LINK_HERE${transaction.type}.nl?id=${transaction.id}">${transaction.tranId}</a>
Open the transaction record you want the email to link to and copy the URL up to the ID number - it should look something like this (notice the last segment ends with 'transactions/’):
https://0123456-sb1.app.netsuite.com/app/accounting/transactions/
Return to the email template source code and paste the URL to replace the ‘LINK_HERE’ text in the code segment provided.
The following code section replaces the last sections of the URL path with the transaction type and the transaction ID. The code displays a functional link in the email content for any transaction record:
<strong>
<span style="font-size: 14px;">
<a href="https://0123456-sb1.app.netsuite.com/app/accounting/transactions/${transaction.type}.nl?id=${transaction.id}">
${transaction.tranId}
</a>
</span>
</strong>
We like to update our blogs and articles to make sure they help resolve any troubleshooting difficulties you are having. Sometimes, there is a related feature to enable or a field to fill out that we miss during the instructions. If this article didn't resolve the issue, please use the chat and let us know so that we can update this article!
If you have general questions about SuiteCommerce or more specific questions about how our team can support your business as you implement NetSuite or SuiteCommerce, feel free to contact us anytime. Anchor Group is a certified Oracle NetSuite Alliance Partner and Commerce Partner equipped to handle all kinds of NetSuite and SuiteCommerce projects, large or small!
Tagged with Training