You are on page 1of 6

Scenario 1:

For enabling button through scripts:


(The button need to enable when we select any particular value in a field other wise it
should disable)

AppletServer ScriptPrecan InvokeMethod

function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)


{
//DESC:When ever the "Test Field" == "Reversed As Required" then the Test button will
Enable other wise it will disable

if (((MethodName == "Test") && (this.BusComp().GetFieldValue("Test Field") ==


"Reversed As Requested")) || MethodName =="Test")
{
CanInvoke = "TRUE";
return(CancelOperation);
}
return (ContinueOperation);
}

If you want to enable a button through Applet User Properties (With out scripting)

Create an Applet User Property


Solution: we need to create the “Named Method” user property under Applet UP

Name Val.ue
Named Method: Test 'INVOKE', ' Test '

After enabling the button what need to happen if we click on the button.

We need to writ a script in pre invoke method event


Scenario 2:

If you want to make the field as required at UI Level and you need to get the popup
message

Applet  Browser Script 

function Applet_PreInvokeMethod (name, inputPropSet)


{

if(actBC.GetFieldValue("Field Name")=="")
{
theApplication().SWEAlert("Please enter the So and so field");
return("CancelOperation");
}

if(actBC.GetFieldValue("Field Name")=="")
{
theApplication().SWEAlert("Please enter the so and field name");
return("CancelOperation");
} //END:

Browser script at action BC


---------------------------------------
if(name=="Cancel")
{
var actBC = this.BusComp();
var stat = actBC.GetFieldValue("Status");
if(stat == "Cancelled")
{
theApplication().SWEAlert("Te record is already
Cancelled");
}

}
Use of Set and Get Profiles:

We will use it in scripts and calculated fileds.

We will declare the Set Profiles like this

if(Disp.indexOf("Conc")>=0)
{
TheApplication().SetProfileAttr("ConSysCreated",1);
CreateConcession();
}

In the above condition if condition is satisfied the profile attribute will set as “1”

Then we will use that profile attribute by getting that

var syscre = TheApplication().GetProfileAttr("ConSysCreated");


if ((syscre = "1") && (Type == "Concessions"))
{ ErrorMsg(); }}//end
We need to display the follow up service requests based on Due Date = Today + 2

Current functionality is: It will display the non closed and cancelled and rejected Service
requests only. For this the search spec is

[Status Show]='Y' AND [Status] <> 'Closed' AND [Status] <> 'Cancelled' AND [Status]
<> 'Rejected' AND [Status] <> 'Not-Satisfactory'

For adding the additional Search spec for filtering based on Today + 2

([Respond By] <= (Today() + 2)) AND [Status Show]='Y' AND [Status] <> 'Closed'
AND [Status] <> 'Cancelled' AND [Status] <> Rejected ' AND [Status] <> 'Not-
Satisfactory'
function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)
{
/*if (MethodName == "TestRide")
{
CanInvoke = "TRUE";
return (CancelOperation);
}*/
if (MethodName == "TestAddress")
{
CanInvoke = "TRUE";
return (CancelOperation);
}
//Added
if (MethodName == "NewQuery" || MethodName == "RefineQuery")
{
CanInvoke = "FALSE";
return (CancelOperation);
}//End
return (ContinueOperation);
}

Calling WorkFlow through Applet level Server Script

var svc = app.GetService("Workflow Process Manager");


var Input = app.NewPropertySet();
var Output = app.NewPropertySet();
var rowId = actBC.GetFieldValue("Id");
Input.SetProperty("ProcessName", "Workflow Name");
Input.SetProperty("Object Id", rowId);
Input.SetProperty("Process Property Name",Value);

Calling a BS from the BC level server script:

try
{
var svc = TheApplication().GetService("Business Service Name");
var inputs = TheApplication().NewPropertySet();
var outputs = TheApplication().NewPropertySet();
svc.InvokeMethod("Method Name in BS",inputs,outputs);
var prompt = outputs.GetProperty("prompt");
return(prompt);
}
catch(e)
{
throw(e);
}
finally
{
var svc = null;
var inputs = null;
var outputs = null;
var prompt = null;
}

Application Pre Navigate Event script:

if(BO.Name() == "Service Request")


{
var currView = TheApplication().ActiveViewName();
if(currView == 'Service Request Detail View' && DestViewName ==
'Personal Service Request List View')
{
var SRBC = BO.GetBusComp("Service
Request");
var ActBC = BO.GetBusComp("Action");
var status = CaseBC.GetFieldValue("Status");

if (status != "Closed" && status != "Cancelled")


{

TheApplication().RaiseErrorText("Put Some text for the alert message.");


}
}
}

You might also like