[javascript] Getting missing ; before statement (debugger$debugger.user#13)

I am getting the following error:

missing ; before statement (debugger$debugger.user#13)

when I send my code through the SuiteScript debugger.  Since it is basically just JavaScript, I was hoping someone might know what the issue is. Below is my code:

function psTrigEmail(type)
{
	var proSupportMail 		= ['Pro Services Premium','Pro Services Basic'];
	var proSupport_set		= nlapiGetFieldValue('custmomer.custentitysc_type');
	var proSupport_confirm	= nlapiGetFieldValue('contact.custentity30');

	//boolean value to check if Welcome Message was sent before
	var bolTermSent = (nlapiGetFieldValue('custentity_terms_email') && nlapiGetFieldValue('custentity_terms_email')=='T' ));
	var bolWelSent 	= (nlapiGetFieldValue('custentity_welcome_email') && nlapiGetFieldValue('custentity_welcome_email')=='T'));
	//internal ID of email template to merge with.
	var ps_termsEmail = '94';
	var ps_welEmail = '95';

	//uses bolTermSent and bolWelSent functions and checks the status of the two 
	if ((!bolTermSent || !bolWelSent) && (proSupport_set.stringContains(status) && proSupport_confirm.stringContains(status))
	{
		// Get customer Point Of Contact email and send first email to them.
		//conduct mail merge with this customer record by calling
		//nlapiMergeRecord() method.
		//nlapiGetNewRecord().getId() returns internal ID of this record.
		var mail = nlapiMergeRecord(ps_termsEmail,'customer', nlapiGetNewRecord().getId());
		//return value of Subject from Email Template
		var sbj = mail.getName();
		//return value of Message body from Email Template
		var msg = mail.getValue();
		//set sendto as Internal ID of this customer.
		//	- Using this method allows customers' response (When Reply is used) is automatically logged
		//	- This method also automatically attaches this message to THIS customer
		var sendto = nlapiGetNewRecord().getId();

		//Send out the email using nlapiSendEmail
		nlapiSendEmail('-5',sendto,sbj,msg,null,null,null,null);

		//update Welcome Message Sent flag.
		nlapiSubmitField('customer',nlapiGetNewRecord().getId(),'custentity_welcome_email','T');

		alert ("Pro Support declared and POC set and emails have not been sent.");
	};
};

Open in new window

prileyosborneAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
Please load your page into Firefox and look in the console.

you have a lot of code you did not show
0
prileyosborneAuthor Commented:
Actually, that could be my issue.  This is the only script, except for a library script that has this function:

function stringContains(superstring, substring){
	if (superstring.indexOf(substring) !== -1){
	return true;
	}
	return false;
}

Open in new window


I will look into the firefox console and see what I can find. Thank you!
0
Michel PlungjanIT ExpertCommented:
nlapiGetFieldValue is not there.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

prileyosborneAuthor Commented:
That is actually from the NetSuite API... sorry, this is using the NetSuite API to generate many of the custom function calls.
0
Michel PlungjanIT ExpertCommented:
Impossible to say what is going on with the snippet of code you gave. Sorry
0
prileyosborneAuthor Commented:
Thanks for the feedback!  To make sure that this is not a total waste and to get you some points for your time, I have updated my script a bit but I have a question on two parts:

I have a series of variables that use calls from the NetSuite API:

var proSupportMail 	= ['Pro Premium','Pro Plus','Pro Basic'];
var proSupport_set		= nlapiGetFieldValue('custmomer.custentitysc_type');

Open in new window


I have a conditional statement that I want to have triggered by the variable proSupport_set equaling any of the three proSupportMail values.  How would you write a statement like that?

I am not sure if I will need to write a custom function that compares the two and looks for any similarities or if there is a way to write it like:

proSupport_set    = proSupportMail

Open in new window


If I need to write a function, any hints on where to start. i am not very versed in JavaScript so any help is appreciated.  Thanks!
0
Michel PlungjanIT ExpertCommented:
I think you mean something like this

function isPro(str) {
  for (var i=0;i<proSupportMail.length;i++) {
    if (str==proSupportMail[i]) return true; // yes we found it
  }
  return false; // not found
}

var proSupportMail = ['Pro Premium','Pro Plus','Pro Basic'];
var proSupport_set  = nlapiGetFieldValue('custmomer.custentitysc_type');
if ( isPro(proSupport_set)) {
  alert("Yes we found Pro")
}

Open in new window


or simpler (assuming you do not have something like "Product")
if (proSupport_set.indexof("Pro")==0) {
  alert("we found Pro as the first part of the set")
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
prileyosborneAuthor Commented:
So awesome, that works perfectly! The first solution was actually perfect.

I have one quick question in terms of the function.

The for statement is basically loading each of the options for the variable into an array and then when you run the function on the other variable, it just matches that variable to any one of the results in the array?

I just want to make sure I understand the method in case I have to update it...  Thanks again!
0
prileyosborneAuthor Commented:
Thanks so much for all your help!
0
Michel PlungjanIT ExpertCommented:
The for statement compares the value given with each of the items in the array and stops when found and returns true - if not found it returns false
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.