Objective: This post is intended to show a very simple but practical example of 3rd Party Dictionary Customization. The target product is Field Service Contract Administration.
Field Service Product Details:
1. Product Name: FieldService
2. Product ID: 949
Sample Customization Description: I am going to retrieve the Contract Header information, when an existing Contract is entered. I am using SanScript runtime code executions and Dex object Triggers.
Procedure: STARTUP
{
Procedure: Startup
Series: System (Not mandatory to select System)
Summary: This script registers all dex object triggers required for this customization product.
}
local integer l_nResult;
l_nResult = Trigger_RegisterFocusByName
(
949, {Product ID}
“‘Contract Number’ of window SVC_Contract_Maintenance of form SVC_Contract_Maintenance”, {Object on which the trigger is registered}
TRIGGER_FOCUS_CHANGE, {execute this trigger on the CHANGE event of the object}
TRIGGER_AFTER_ORIGINAL, {execute this trigger after the original CHANGE event script is processed}
script FS_Get_Contract_Hdr_Info
);
if l_nResult <> SY_NOERR then
warning “Error registering the trigger: FS_Get_Contract_Hdr_Info. ” +
“Object: ‘Contract Number’ of window SVC_Contract_Maintenance of form SVC_Contract_Maintenance, ” +
“Event: CHANGE, ” +
“Scope: AFTER_ORIGINAL.”;
end if;
Procedure: FS_Get_Contract_Hdr_Info
{
Procedure: FS_Get_Contract_Hdr_Info
Series: Sales (Not mandatory to select Sales)
Summary: This script retrieves the contract header information on Contract Entry/Update form once an existing Contract is entered.
If the Contract is new, then it is not touched.
}
{Local Variables Declaration}
local integer l_nResult;
local string l_sCompileMsg, l_sContractNo, l_sCustomerID, l_sAddressID, l_sContractType, l_sCurrencyID;
local integer l_nContractLength, l_nContractPeriod;
local datetime l_dtStartDate;
local text l_sCode;
{Construct the SanScript code to execute it inside Field Service and retrive the Contract values}
l_sCode = “”;
l_sCode = l_sCode + “out string O_sContractNo;”;
l_sCode = l_sCode + “out string O_sCustomerID;”;
l_sCode = l_sCode + “out string O_sAddressID;”;
l_sCode = l_sCode + “out string O_sContractType;”;
l_sCode = l_sCode + “out string O_sCurrencyID;”;
l_sCode = l_sCode + “out integer O_nContLength;”;
l_sCode = l_sCode + “out integer O_nContPeriod;”;
l_sCode = l_sCode + “out datetime O_dtStartDate;”;
l_sCode = l_sCode + “if ‘Customer Number’ of window SVC_Contract_Maintenance of form SVC_Maintenance <> “” then”;
l_sCode = l_sCode + ” O_sContractNo = ‘Contract Number’ of window SVC_Contract_Maintenance of form SVC_Contract_Maintenance;”;
l_sCode = l_sCode + ” O_sCustomerID = ‘Customer Number’ of window SVC_Contract_Maintenance of form SVC_Contract_Maintenance;”;
{If any runtime compilation errors occurred, throw the corresponding error message}
if l_nResult <> 0 then
warning “Error executing the constructed code. Error Message: ” + l_sCompileMsg;
abort script;
end if;
{Do some Planned Process}
———
Vaidy