As a default behavior, Sales Rep field will automatically populate in any transactions if Sales Rep is set on the customer record. To set the Sales Rep field to blank in any transaction, user can upload a Client side script trigger on Page Init and Field Changed function on the form to set it to blank by perform the following steps:
1. Create the script below and save it as javascript file
function customer_PageInit()
{
if(!nlapiGetFieldValue('entity') || nlapiGetFieldValue('entity') == 'Copied From Name')
{
nlapiSetFieldValue('salesrep', '');
}
}
function customer_FieldChanged(type,name)
{
if(name == 'entity' && (!nlapiGetFieldValue('entity') || nlapiGetFieldValue('entity') == 'Copied From Name'))
{
nlapiSetFieldValue('salesrep', '');
}
}
2. Navigate to Customization > Forms > Transaction Forms
3. Click the Edit link next to the transaction form (e.g. Custom Estimate Form)
4. Navigate to Custom Code subtab
5. In the Script File, click on the plus icon then File pop up window will appear
6. Click Choose File button then select the script file created on Step 1
7. In the Page Init Function , enter the name of the function that will execute on page load
8. In the Field Changed Function, enter the name of the function that will execute when user select a customer on Customer field
9. Click Save
10. Navigate to Lists > Relationships > Customers
11. Click View link next to one of the customers with a Sales Rep assigned to it
12. Navigate to Sales tab > Transaction subtab
13. Click on New Estimate button
14. On the Estimate page, Sales Rep field is set to blank
15. Navigate to Transaction > Sales > Prepare Estimates
16. Select a customer on the Customer field , notice that Sales Rep field is set to blank
No comments:
Post a Comment