Nour Khaled
01/09/2025, 8:56 AMCeligo AI
01/09/2025, 8:56 AMAI generated answer (using internal Slack threads):Based on the conversations, you can create a function in an Advanced PDF/HTML template in NetSuite that reads a numeric number and outputs the amount in words by using SuiteScript. Here is a sample code provided in the threads:
javascript
function amtinWordsAfterSubmit(type)
{
var Rec = nlapiGetRecordId();
var rectype = nlapiGetRecordType();
var InvRec = nlapiLoadRecord(rectype,Rec);
var TotalAmount;
var currency = InvRec.getFieldValue('currency')
nlapiLogExecution('DEBUG', 'after Submit', 'currency=' + currency);
if(type==='customerpayment'){
TotalAmount = InvRec.getFieldValue('payment');
} else {
TotalAmount = InvRec.getFieldValue('total');
}
nlapiLogExecution('DEBUG', 'after Submit', 'TotalAmount=' + TotalAmount);
//... rest of the code
}
This function is triggered after a record is submitted. It gets the record ID and type, loads the record, and retrieves the total amount and currency. Depending on the type of the record (customer payment or other), it gets the total amount from the appropriate field. Then it logs the currency and total amount for debugging purposes.
The rest of the code (not shown here) handles the conversion of the total amount into words, taking into account the currency. The converted amount is then set in a custom field 'custbody_amtwords' on the record.
Please note that you need to replace the ... rest of the code
with the actual code that handles the conversion of the total amount into words.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
01/09/2025, 8:57 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.849171102
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.846603453
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.825839221
Celigo AI
01/09/2025, 8:57 AM