www.webdeveloper.com
Results 1 to 10 of 10

Thread: vcomp items list numbering

  1. #1
    Join Date
    Dec 2009
    Posts
    6

    vcomp items list numbering

    Hello,

    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.

    Max

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,350
    OK, I'll bite.

    What is a 'vcomp function'?
    How about posting some code!

  3. #3
    Join Date
    Dec 2009
    Posts
    6
    hey JMRKER,

    here a portion of the code:

    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.

  4. #4
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,350

    Lightbulb Consider this ...

    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!

  5. #5
    Join Date
    Dec 2009
    Posts
    6
    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&#234;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)

    if (vcomp == 25 || vcomp == 26)
    {
    nlapiSetFieldValue('email',vemail);
    }

    if (vcomp == 25 || vcomp == 26)
    {
    //nlapiSetFieldText('company','JOBSEEKER');
    }
    }
    else
    {
    //alert("last=-9");
    nlapiSubmitField('supportcase',ventityid,'custevent_v_lastformnumber',vnewformnumber,true);
    var new_url = nlapiResolveURL('RECORD','supportcase',ventityid, 'EDIT');
    new_url = new_url + "&cf=" + vnewformnumber;
    window.location = new_url;
    }
    }
    else
    {
    //alert('last # new');
    nlapiSubmitField('supportcase',ventityid,'custevent_v_lastformnumber',vnewformnumber,true);
    var new_url = nlapiResolveURL('RECORD','supportcase',ventityid, 'EDIT');
    new_url = new_url + "&cf=" + vnewformnumber;
    window.location = new_url;
    }
    }
    }

  6. #6
    Join Date
    Sep 2011
    Posts
    3

    Please help!

    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

    Quote Originally Posted by JMRKER View Post
    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!

  7. #7
    Join Date
    Sep 2011
    Posts
    3
    Quote Originally Posted by JMRKER View Post
    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?

  8. #8
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,350

    Question Need more information and clarification...

    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!

  9. #9
    Join Date
    Sep 2011
    Posts
    3

    Reply

    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'

  10. #10
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,350

    Arrow

    Quote Originally Posted by JocelynM View Post
    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.

    Sorry.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles