The Product field is currently not available as a field that can be used on an Online Case form, thus, setting up an Online Case Form and allowing customers to select the Product that they are filing a case against is not possible out of the box.
The workaround involves 3 major steps, creating a custom field that catches the value of product, creating a script that puts the value of product into the custom field, then creating the case rule and territory.
Steps to consider if this were to work on an Online Case form are discussed from Steps 4 to 8.
1. Create a custom CRM field. A custom field needs to be created as this will be the basis of the case rule. This field catches the numerical value Product whenever it is changed. To create the custom CRM field, follow steps below:
a. Navigate to Customization > Lists, Records, & Fields > CRM Fields > New.
b. Provide a Label (e.g. ProdCatch).
c. Provide an ID (e.g. custevent1).
d. Set the Type field to Free-Form Text.
e. Check Store Value.
2. Create a Script. A script needs to be created for the value of Product to be passed dynamically to the custom field, using just standard sourcing fields do not work as the Case Rule mechanism runs before the field value is stored, thus, the case rule does not fire because the custom field does not have a value when the Case Rule is ran.
The basic form of the script is:
function setProdAuto(type, fld) {
if(fld =='product')
{
var val = nlapiGetFieldValue('product');
nlapiSetFieldValue('custevent1', val, null, true);
}
}
Invoke setProdAuto on the Field Changed function when modifying the preferred form used for Cases. This allows the script to run when the field Product is changed and dynamically updates custevent1.
3. Create the case rule and territory. The script above passes the numerical value of product the custevent1, thus user needs to define a case rule for custevent1, set the value to the numerical value of the product needed, then set the territory.
4. For Online Case forms, an additional field needs to be created to catch the product field from the Front End, the custom CRM field can be set this way:
a. Navigate to Customization > Lists, Records, & Fields > CRM Fields > New.
b. Provide a Label (e.g. Product - External).
c. Provide an ID (e.g. custevent2).
d. Set the Type field to List/Record.
e. Set the List/Record field to Product.
f. Uncheck Store Value.
5. Use this field on the Online Case Form as this now mirrors the values coming from the Product field on a Case.
6. To set the values when the records are created, a script will need to be written with the basic logic of:
function setProdAutoOnSave(create) {
var val = nlapiGetFieldValue('custevent2');
nlapiSetFieldValue('product', val, null, true);
var val2 = nlapiGetFieldValue('product');
nlapiSetFieldValue('custevent1', val2, null, true);
}
This script gets the value of custevent2, passes it to the product field, and then uses the same mechanism from step 2 to place the numerical value for use with Case Rules and Territories.
7. Navigate to Customization > Scripting > Scripts > New.
8. Select User Event.
9. Invoke setProdAutoOnSave as a Before Submit Function. The Primary reason for this is that the Product field is unavailable at the Online Case Form level, thus the fields will need to be set just about before the case is submitted, and before case rules and territories kick in. Additionaly, under the Deployment tab, select that this applies to Case.
No comments:
Post a Comment