Script Related Qustions
Script Related Qustions
How to Query, Activate, Get BO, Get BC, Get Field & Set Field in Escript :-
boEmp = TheApplication().GetBusObject("Employee");
bcEmp = boEmp.GetBusComp("Employee");
with (bcDealer) {
SetViewMode(3);
ClearToQuery();
ActivateField("Dealer Name");
ActivateField("Dealer Code");
ActivateField("Status");
SetSearchSpec("Dealer Type", "RESP UPD");
SetSearchSpec("Status", "PENDING");
ExecuteQuery(ForwardOnly);
while (FirstRecord())
var strDealerCode = GetFieldValue("Dealer Code");
var strResp = GetFieldValue("Dealer Name");
SetFieldValue("SSA Primary Field", "Y");
WriteRecord();
}
Pre-invoke method we write script to invoke WF, or BS
if (MethodName == "TSLEstimationCharge")
{
var TSLConsumptionType = this.BusComp().GetFieldValue("TSL Consumption Type");
var ResolutionCode = this.BusComp().GetFieldValue("Resolution Code");
var TSLActivityReasonCode = this.BusComp().GetFieldValue("TSL Activity Reason Code");
if (!TSLConsumptionType || !ResolutionCode || !TSLActivityReasonCode)
{
TheApplication().RaiseErrorText("Resolution Code, Reason Code, or Consumption Type is null");
return (CancelOperation);
}
else
{
TheApplication().SetProfileAttr("TSLCharge","N");
this.BusComp().SetFieldValue("TSL Quotation Status", "In Progress");
this.BusComp().WriteRecord();
// for WF
Var svc = TheApplication().GetService("Workflow Process Manager");
Var input = TheApplication().NewPropertySet();
Var Output = TheApplication().NewPropertySet();
Input.SetProperty("ProcessName", "Workflow Name")
Svc.InvokeMethod("RunProcess", input, output)
// for BS
var subid = TheApplication().GetFieldValue("Account Id")
Var svc = TheApplication().GetService("Our Custom BS name")
Var input = TheApplication().NewPropertySet();
Var Output = TheApplication().NewPropertySet();
input.SetProperty("Object Id", subid)
Svc.InvokeMethod("Our custom method name", Input, Output)
ForwardBackward ForwardOnly
Selected Records can be Processed from first to last or Selected record can be processed only from the first
from Last to first. record to the last record.