0% found this document useful (0 votes)
4 views2 pages

Script Related Qustions

The document outlines the scripting capabilities within a web applet environment, detailing where scripts can be written and the sequence of events that occur during applet loading. It provides examples of how to query, activate, and manipulate business components and fields using Escript, including invoking workflows and business services. Additionally, it explains the difference between processing records in a forward or backward manner within the scripting context.

Uploaded by

doyebop667
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Script Related Qustions

The document outlines the scripting capabilities within a web applet environment, detailing where scripts can be written and the sequence of events that occur during applet loading. It provides examples of how to query, activate, and manipulate business components and fields using Escript, including invoking workflows and business services. Additionally, it explains the difference between processing records in a forward or backward manner within the scripting context.

Uploaded by

doyebop667
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Script Questions

Sunday, 20 October 2024 6:31 PM

What are the places we can write the Scripts?


Applet, business Component(BC), Client side BS, BS & Run time event.

In Script which web applet will run first

WebApplet_Load CRM calls this event immediately after it loads an applets


PreCanInvokeMethod Often easier to enable and disable methods at the applet level
PreInvokeMethod On every action PreInvoke Method will invoke(such as simple tab also)
InvokeMethod On specific method we use invoke method

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();

var strCEWOId = this.BusComp().GetFieldValue("Id");


var svc = TheApplication().GetService("Workflow Process Manager");
var Input = TheApplication().NewPropertySet();
var Output = TheApplication().NewPropertySet();

Input.SetProperty("ProcessName", "TSL PRM Send WorkOrder XML Workflow");


Input.SetProperty("Object Id", strCEWOId);
Input.SetProperty("WO Quotation Identifier", "Quotation Request");

svc.InvokeMethod("RunProcess", Input, Output);


}
return (CancelOperation);
}

// 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)

Active Bus Comp Get Bus Comp


When we need to perform Operation on BC, associate with the This is used to get BC which is not associate with
current applet. current BC.

var bc = this.BusComp("Dealer"); boEmp =


TheApplication().GetBusObject("Employee");
bcEmp =
TheApplication().GetBusComp("Employee");

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.

This is the default if no value is specified Focus cannot return to a record.

You might also like