Wednesday, December 26, 2018

Set Default Case Type on Online Case Form

User created an online case form using a Default Form Template. In the Select Fields tab, Case Type field was added. User would like the Case Type field to be set to a specific value (e.g. Ask a Question). However in the Set Up Workflow tab  > Preferences section, there's no option to Set Case Type just like the Set Case Origin option.

To accomplish this, use a script that would set the value of the field.

 1. Navigate to Setup > Support > Case Types.
 
 2. Take note of the Internal ID of the Case Type you want to set as default value. For example, the Internal ID of 'Ask a Question' Type is 5.
 
 3. Open Notepad (Start > Run > Notepad > OK).
 
 4. Copy and Paste the code below:
 
  function setCaseType(type, fld)
   {
   nlapiSetFieldValue('category',5);
   }
 
 *Note: Replace 5 with the actual internal ID of the Case Type you want to use.
 
 5. In Notepad, go to File > Save As then use:
 
  File Name: Set Case Type.js
  Save as Type: All Files
  
 6. Click Save.
 
 7. In NetSuite, navigate to Setup > Support > Online Case Forms.
 
 8. Edit the Online Case Form.
 
 9. In the Select Fields tab, click the Case Type field and check the Hide column.
 
 10. Click the Custom Code tab.
 
 11. In the Script File field, click New.
 
 12. In the File popup window, select a Folder then click Browse to locate the file created earlier.
 
 13. Click Save.
 
 14. In the Custom Code tab, set Page Init Function field to setCaseType.
 
 15. Click Save.
 
To test, access the form via the External tab > Publishable Form URL, fill out the form then click Submit. Check the case that will be created to confirm if the Case Type will be set correctly. 

No comments:

Post a Comment