I am developing an online form for new leads to be entered. When we create a lead we don't only create the Customer record but also several other custom records (IE: Medical Professional, Insurance Provider, etc)
After following the path of Web Services to accomplish this task and realizing that web services are far too unstable still to be used reliably I decided to take a look at SuiteScript.
For testing purposes I created a custom record and added an online form for this record.
When I access the online form (outside of a netsuite session) everything works fine and the new record is saved in Netsuite.
I then created a simple SuiteScript (my first) to turn that custom record data into a new Customer. I followed the guide and added the script, deployed it, etc. Once the script was active my online form stopped working, it now requires a login!
I'm wondering if there is a setting I'm missing or if it's the operatiosn being performed in the script that are causing the login screen to be triggered?
Here is my script:
function CreateLead(type) { var currentRecord; // create Task only when a new Opportunity is created if ( type == 'create' ) { // Get the Current Record currentRecord = nlapiGetNewRecord(); leadRecord = nlapiCreateRecord('customer'); leadRecord.setFieldValue('firstname', 'SuiteScript'); leadRecord.setFieldValue('lastname', 'Last'); leadRecord.setFieldValue('entityid', '123abc'); leadRecord.setFieldValue('entitystatus', '14'); nlapiSubmitRecord(leadRecord, true); } };I setup the script to email errors to me (very helpful!) and this is the email I get:Date & Time: 9/17/2006 8:41 am
Record Type: Call Center Solo Lead
Internal ID: 15
Script: CreateLead
Error: LOGIN_REQD
You must <a href='/pages/login.jsp' target='_self'>log in</a> before accessing this page.
Stack Trace:
#CreateLead.nlapiSubmitRecord(customer, true) #CreateLead
Any help would be greatly appreciated.Thanks for reading,Steve