Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.
Creating Quote from Project Record Script
I'm trying to create a quote via a script from a project record. The project record contains all the information I need to create the quote, but for some reason when I use a client side script to create the quote - I get the following error message:
An unexpected error occurred in a script running on this page.
createChangeOrderButton (button)
customscript_g5_cs_project
INVALID_CUSTOMER_RCRD
This customer record -1 is not valid. Please create the customer first.
I've created a client side button with the following code:
function createChangeOrderButton(){ var projectId = nlapiGetRecordId(); var customer = nlapiGetFieldValue('parent'); //create quote var recQuote = nlapiCreateRecord('estimate'); var recQuoteId = recQuote.getId(); nlapiSetFieldValue('custbody_reseller',3415); nlapiSetFieldValue('custbody_distributor',3414); nlapiSetFieldValue('custbody_end_user',13814); nlapiSetFieldText('custbody_order_type','Contract - New'); nlapiSetFieldValue('custbody_bill_to_tier',1); nlapiSetFieldValue('custbody_ship_to_tier',1); nlapiSetFieldText('probability','60%'); nlapiSetFieldValue('entity',3415); recQuote.selectNewLineItem('item'); recQuote.setCurrentLineItemValue('item', 'item', 24); recQuote.setCurrentLineItemValue('item', 'project', projectId); recQuote.commitLineItem('item'); var reqQuoteId = nlapiSubmitRecord(recQuote, false, true); var quoteURL = nlapiResolveURL('RECORD', 'estimate', recQuoteId, true); window.open(quoteURL, '_blank'); } 0