function WebApplet_PreInvokeMethod (MethodName)
{
// Created the New button : Unlock. This will change the Status to Planned. So that, the Record is Editable
// We are Invoking a WorkFlow which wil change the Status.
try
{
if(MethodName == "Unlock")
{
var lsCallId = this.BusComp().GetFieldValue("Id");
this.BusComp().ActivateField("NN Unlock Time");
this.BusComp().ActivateField("Calculated Current Time");
var ParseUnlockTime = Date.parse(this.BusComp().GetFieldValue("NN Unlock Time"));
var ParseTodayDate = Date.parse(this.BusComp().GetFieldValue("Calculated Current Time"));
if(ParseTodayDate > ParseUnlockTime)
{
TheApplication().RaiseError("NNIO UnLock Reported Calls");
return(CancelOperation);
}
else
{
// TheApplication().RaiseErrorText("You are allowed to Unlock as it is within the 14 days Timeline");
var bsWrkFlw = TheApplication().GetService("Workflow Process Manager");
var inputs = TheApplication().NewPropertySet();
var outputs = TheApplication().NewPropertySet();
var sWorkflw = "NNIO Unlocking of Reported Calls";
with (inputs)
{
SetProperty ("RowId", lsCallId);
SetProperty ("ProcessName", sWorkflw);
}
bsWrkFlw.InvokeMethod("RunProcess",inputs,outputs);
this.BusComp().InvokeMethod("RefreshRecord");
var llsCallId = this.BusComp().GetFieldValue("Id");
// this.BusComp().ParentBusComp().SetViewMode(AllView);
// this.BusComp().ParentBusComp().ClearToQuery();
// this.BusComp().ParentBusComp().SetSearchSpec("Id", lsCallId);
// this.BusComp().ParentBusComp().ExecuteQuery(ForwardOnly);
this.BusComp().SetViewMode(AllView);
this.BusComp().ClearToQuery();
this.BusComp().SetSearchSpec("Id", lsCallId);
this.BusComp().ExecuteQuery(ForwardOnly);
return (CancelOperation);
}
}
}
catch(e)
{
throw(e);
}
finally
{
ParseUnlockTime = null;
ParseTodayDate = null;
inputs = null;
outputs = null;
bsWrkFlw = null;
sWorkflw = null;
llsCallId = null;
}
}
No comments:
Post a Comment