I was wondering in respect to the vcomp function, we have a list of forms associated to this function but not sure how the counting is being done..i understand its starting from 0 and counting from the top but is the first item on the list 0? is the first blank selection 0? if there's no first blank selection, is the first item 0? Still kinda new at this but any help is appreciated. Thanks in advance.
var vcomp = nlapiGetFieldValue('custevent_caseform');
var vnewformnumber = 10;
// emp and sales french
if (vcomp == 2)
{
vnewformnumber = 23;
}
// emp and sales english
if (vcomp == 1)
{
vnewformnumber = 24;
}
// JS english
if (vcomp == 4)
{
vnewformnumber = 22;
}
//JS French
if (vcomp == 3)
{
vnewformnumber = 25;
}
vnewformnumber is the form(support case form) that vcomp will reference. Let me know if you need anymore info. Thanks alot.
thanks for responding JMRKER. I'm fairly new at JavaScript and not sure how much code to post..do I post all the code thats applicable to the form is question or just a portion of it and if just a portion, how much is necessary for you to figure out the issue?? I guess the easiest thing for me to do is just post all applicable..sorry for rambling. Although, even with the lil snippet I provided your response looks fairly similar to what the code looks like now. I'm quite impressed
For your info, 'var vnewformnumber = 10' is like a place value..where we have 4 forms in use..2 English and 2 French. the reason for Form 10 is that our web application cannot user the functionality in this script if there is no place value, hence Form 10, which would essentially be a 0 value lets say.
Here's the whole code:
function validateonexit()
{
var vcomp = nlapiGetFieldText('custevent4');
if (vcomp == 'Please Select')
{
alert("Please select a product type");
return false;
}
else
{
return true;
}
}
function changeform(type,name)
{
if (name == 'email'){ nlapiSetFieldValue('custevent22',nlapiGetFieldValue('email')); }
if (name == 'customform')
{
var userName = nlapiGetUser();
var ventityid = nlapiGetRecordId();
var vlastformnumber = nlapiGetFieldValue('custevent_v_lastformnumber');
var vemail = nlapiGetFieldValue('custevent22');
var vcomp = nlapiGetFieldValue('customform');
//alert(vcomp);
var vnewformnumber = 10;
// emp and sales french
if (vcomp == 23)
{
vnewformnumber = 23;
}
// emp and sales english
if (vcomp == 26)
{
vnewformnumber = 26;
}
// JS French
if (vcomp == 22)
{
vnewformnumber = 22;
}
//JS English
if (vcomp == 24)
{
vnewformnumber = 24;
}
var tranid = 'To Be Generated';
tranid = nlapiGetFieldValue('casenumber');
if (tranid == 'To Be Generated')
{
var new_url = nlapiResolveURL('RECORD','supportcase',ventityid, 'EDIT');
new_url = new_url + "&cf=" + vnewformnumber;
}
else
{
var new_url = nlapiResolveURL('RECORD','supportcase',ventityid, 'EDIT');
new_url = new_url + "&cf=" + vnewformnumber;
}
window.location = new_url;
}
}
function samplePageInit()
{
var userName = nlapiGetUser();
var tranid = 'To Be Generated';
tranid = nlapiGetFieldValue('casenumber');
if (tranid == 'To Be Generated')
{
//do nothing
//nlapiSetFieldValue('assigned', userName)
}
else
{
var ventityid = nlapiGetRecordId();
var vlastformnumber = nlapiGetFieldValue('custevent_v_lastformnumber');
var vemail = nlapiGetFieldValue('custevent22');
//----->
var vcomp = nlapiGetFieldValue('category');
var vnewformnumber = 10; //W Custom Support Case Form //inactive
// 23 Employer Inquiry
// 24 Sales Inquiry
if (vcomp == 23 || vcomp == 24)
{
vnewformnumber = 26; //Employer English Support Form
}
// emp28 and sales27 french
if (vcomp == 27 || vcomp == 28)
{
vnewformnumber = 23; //Employer French Support Form
}
// JS english //Job Seeker Inquiry
if (vcomp == 25)
{
vnewformnumber = 24; //Job Seeker English Support Form
}
//JS French //Enquête du candidat
if (vcomp == 26)
{
vnewformnumber = 22; //Job Seeker French Support Form
}
// Internal cases //Do Not Use/Val Only - Internal Cases
if (vcomp == 29)
{
vnewformnumber = 25; //Workopolis Inquiry Case Form
}
if (vnewformnumber == vlastformnumber || vlastformnumber == -9 )
{
if (vlastformnumber == vnewformnumber)
{
//alert("new = last");
//nlapiSetFieldValue('assigned', userName)
Hi, I see that you're familiar with the case forms in NetSuite, I need to make the Email(s) field on all new cases blank on creation of a new case record. Can you please help me? My SuiteScript is very, very limited and rusty at that - I had very little training about 3 years ago.
I have tried nlapisetFieldValue('email',null) and it is not working.
Thank you in advance.
Jocelyn
Originally Posted by JMRKER
Still have not given very much information so this is just a guess as to your requirements...
Code:
<html>
<head>
<title>VComp Function</title>
<script type="text/javascript">
// From: http://www.webdeveloper.com/forum/showthread.php?p=1055173#post1055173
function nlapiGetFieldValue(IDS) {
var sel = document.getElementById(IDS);
return sel.value;
}
function VComp() {
var vnewformnumber = 10;
var vcomp = nlapiGetFieldValue('custevent_caseform');
// if (vcomp == '') { return ''; }
// may not need line above if you always want vnewformnumber to equal 10
switch (vcomp) {
case '1' : // emp and sales english
vnewformnumber = 24; break;
case '2' : // emp and sales french
vnewformnumber = 23; break;
case '3' : //JS French
vnewformnumber = 25; break;
case '4' : // JS english
vnewformnumber = 22; break;
default : vnewformnumber = 10; break;
}
return vnewformnumber;
}
</script>
</head>
<body>
VComp information:
<select id="custevent_caseform" onchange="alert('Form # '+VComp())">
<option value="">Select</option>
<option value="1">Employee and Sales English</option>
<option value="2">Employee and Sales French</option>
<option value="3">JS French</option>
<option value="4">JS English</option>
</select>
</body>
</html>
Still have not given very much information so this is just a guess as to your requirements...
Code:
<html>
<head>
<title>VComp Function</title>
<script type="text/javascript">
// From: http://www.webdeveloper.com/forum/showthread.php?p=1055173#post1055173
function nlapiGetFieldValue(IDS) {
var sel = document.getElementById(IDS);
return sel.value;
}
function VComp() {
var vnewformnumber = 10;
var vcomp = nlapiGetFieldValue('custevent_caseform');
// if (vcomp == '') { return ''; }
// may not need line above if you always want vnewformnumber to equal 10
switch (vcomp) {
case '1' : // emp and sales english
vnewformnumber = 24; break;
case '2' : // emp and sales french
vnewformnumber = 23; break;
case '3' : //JS French
vnewformnumber = 25; break;
case '4' : // JS english
vnewformnumber = 22; break;
default : vnewformnumber = 10; break;
}
return vnewformnumber;
}
</script>
</head>
<body>
VComp information:
<select id="custevent_caseform" onchange="alert('Form # '+VComp())">
<option value="">Select</option>
<option value="1">Employee and Sales English</option>
<option value="2">Employee and Sales French</option>
<option value="3">JS French</option>
<option value="4">JS English</option>
</select>
</body>
</html>
Good Luck!
Hi, I'm out of practice with my NetSuite script and need to write one that will make the 'Email(s)' field on the case form null in NetSuite. I have tried nlapiSetFieldValue & nlapiSubmitField without success. Can you please help me?
For "JocelynM" in posts #6 and #7:
I, personally, have never used "NetSuite", whatever it is. I am not aware of what 'nlapiSetFieldValue' and 'nlapiSubmitField' do if they are functions, although I could hazard a guess based on the label.
I don't have enough information to respond to your request unless you can generalize your question a bit more.
For "max.davy" in post #5:
You did not seem to incorporate any of the changes I recommended in the earlier post.
I am still unclear as to what you want to do, especially if you don't say why the provided code is of no use to you.
For both, I cannot help if I don't see or understand the questions.
I'm not trying to be harsh, just honest!
NetSuite is an online accounting & crm platform, their 'SuiteScript' naming convention is nlapi..., custevent_..., etc. The reply you posted to max.davy contained references to their platform so I assumed you knew NetSuite's 'SuiteScript'
NetSuite is an online accounting & crm platform, their 'SuiteScript' naming convention is nlapi..., custevent_..., etc. The reply you posted to max.davy contained references to their platform so I assumed you knew NetSuite's 'SuiteScript'
Never ass-u-me!
I modified 'max.davy's code with a JS solution. He is the one to contact if you have questions about a NetSuite solution.
Bookmarks