Wednesday, September 26, 2018

Keep Sales Rep Field Blank on New Customer Record when User is Marked as Sales Rep


Image

When user with Sales Rep enabled on Employee record creates a new record (Customer, Prospect, Lead), the user gets assigned automatically as the Sales Rep. Existing Sales Rules and Territories are overridden since NetSuite assigns the user as the owner of the record.
 
Depending on the feature enabled, this can be addressed by a Workflow or a Script.
 
Requirements:
 
 1. Navigate to Setup > Company > Enable Features.
 
 2. Click the CRM tab.
 
 3. In the Sales section, locate Team Selling.
 
If Team Selling is not checked, create a workflow to set the Sales Rep field to blank. To create the workflow, perform the following steps:
 
 1. Navigate to Customization > Scripting > Workflows > New.
 
 2. Provide a Name.
 
 3. Select Customer for the Record Type.
 
 4. Select Lead, Prospect, Customer for the Sub Types.
 
 5. Set Release Status to Released.
 
 6. Under Initiation, select Event Base then check On Create.
 
 7. Set Trigger Type to All.
 
 8. Click Save.
 
 9. In the Diagram section, click New State.
 
 10. Provide a State Name.
 
 11. Click Save.
 
 12. Click the State created.
 
 13. Under the Actions tab, click New Action.
 
 14. Select Set Field Value.
 
 15. In the Basic Information section, set Trigger on Entry.
 
 16. In the Parameters section, set Field to Sales Rep
 
 17. In the Value section, select Formula then use NULL.
 
 18. Click Save.
 
Verify if the Workflow works by creating a new lead, prospect or customer record.
 
If Team Selling is checked, create a script to remove the sales team sublist. To create the script, perform the following steps:
 
 1. Open Notepad.
 
 2. Copy and paste the code below:
 
 function pageInit()
 {
 nlapiRemoveLineItem('salesteam', 1);
 }
 
 3. Go to File > Save As.
 
 4. Change Save type as to All Files.
 
 5. Use the File name: Clear SR.js .
 
 6. Click Save.
 
 7. In NetSuite, navigate to Customization > Scripting > Scripts > New.
 
 8. Select User Event.
 
 9. Provide a Name.
 
 10. In the Scripts tab, select New in the Script File field.
 
 11. Click Browse to locate the script file.
 
 12. Click Save.
 
 13. In the Script tab, enter the function name in the Before Load Function field (e.g. pageInit).
 
 14. Click the Deployments tab.
 
 15. In the Applies To field, select Lead.
 
 16. Check the Deploy.
 
 17. Set Status to Released.
 
 18. Set Event Type to Create.
 
 19. Add a new line for Prospect and Customer using the same settings from Step  16 - 18.
 
 20. Click Save.
 
Verify if the script works by creating a new lead, prospect or customer record.
 
Note: Enhancement# 125184 has been filed for ability to not link the setting of sales rep as set on the employee record to the assignment of sales rep when creating new records.

No comments:

Post a Comment