-1

I am attempting to add attendee line items on an event record using a user-event suitescript. However when I save the record, it is not adding the attendee from the script.

Any assistance on why this code is not working correctly would be greatly appreciated!

ahomsher
  • 23
  • 1
  • 7

1 Answers1

1

Your code mixes dynamic/client and standard record access mode.

For a user event before submit script you don't need the insert call. Just:

var newAt = nlapiGetLineItemCount('attendee') + 1;
nlapiSetLineItemValue('attendee', 'attendee', newAt, '95001');

For a user event after submit script similar but:

var eventRec = nlapiLoadRecord(nlapiGetRecordType(), nlapiGetRecordId());
var newAt = eventRec.getLineItemCount('attendee') + 1;
eventRec.setLineItemValue('attendee', 'attendee', newAt, '95001');
//add more?
nlapiSubmitRecord(eventRec);
bknights
  • 14,408
  • 2
  • 18
  • 31
  • Thank you bknights! Worked perfectly! – ahomsher Jun 16 '17 at 20:32
  • on the same attendee sublist we have a column with a checkbox for Email, to send an email to the attendee, is there a way for me to find out what that checkboxs internal id would be? I dont see anything about email checkbox on the attendee sublist event record on the schema browser. I apologize for posting a link to the image, i am new here http://imgur.com/a/TA2ow – ahomsher Jun 19 '17 at 16:14
  • I believe its scriptid is `sendemail` – bknights Jun 19 '17 at 19:23
  • I am unable to get the email event invitations to send out. Is it because I am not actually creating the record in the UI but from within my script. By scripting it, is netsuite missing something it needs to push these emails out? – ahomsher Jun 27 '17 at 13:42
  • Are you also setting the body level 'sendemail' field? Normally when you are trying to script something in Netsuite it helps to think of simulating the GUI process. – bknights Jun 27 '17 at 16:44
  • https://stackoverflow.com/questions/44662708/send-email-checkbox-on-attendee-sublist-user-event-script I had a secondary question going just referencing the email, no replies yet, but that has my code in it. I appreciate your help @bknights – ahomsher Jun 27 '17 at 18:15