Вы находитесь на странице: 1из 3

function Service_PreInvokeMethod (MethodName, Inputs, Outputs)

{
if(MethodName=="Deal Product Update1")
{
try
{
var boOpp = TheApplication().GetBusObject("Opportunity ICM");
var bcOpp = boOpp.GetBusComp("Opportunity ICM");
with(bcOpp)
{
InvokeMethod("SetAdminMode", "TRUE");
var searchExp = "[Sales Stage] = '01-Prospect' OR [Sales Stage] = '02-
Needs Analysis' OR [Sales Stage] = '03-Solutions Fit' OR [Sales Stage] = '04-Presentation/Proposal sent'
OR [Sales Stage] = '05-Negotiation' OR [Sales Stage] = '06-Final Stage / Customer Decision' OR [Sales
Stage] = '07-Pending Implementation' OR [Sales Stage] = '08-Active Implementation'";
ClearToQuery();
SetSearchExpr(searchExp);
ExecuteQuery();
var oMvgBC = GetMVGBusComp("Product");
var oMvgBCPos=GetMVGBusComp("Active First Name");
if(FirstRecord())
{
do
{
oMvgBC.InvokeMethod("SetAdminMode", "TRUE");
oMvgBC.ClearToQuery();
oMvgBC.SetSearchSpec("Product Name
Type","Trade");
oMvgBC.ExecuteQuery();
if (oMvgBC.FirstRecord())
{

oMvgBCPos.InvokeMethod("SetAdminMode", "TRUE");
oMvgBCPos.ClearToQuery();
oMvgBCPos.ActivateField("Name");
oMvgBCPos.SetSearchSpec("Name",
"BASINGH");
oMvgBCPos.ExecuteQuery();
var iSRecord=oMvgBCPos.FirstRecord();
if(!iSRecord)
{
var oAssocBC =
oMvgBCPos.GetAssocBusComp();
with(oAssocBC)
{
SetViewMode(AllView);
ClearToQuery();
ActivateField("Name");
SetSearchSpec("Name",
"BASINGH");
ExecuteQuery();
if(FirstRecord())
{

Associate(NewBefore);
}
}
}
}
}while(NextRecord());
}
}
}
catch(e)
{
TheApplication().RaiseErrorText(e);
}
finally
{
oAssocBC = null;
oMvgBCPos = null;
oMvgBC = null;
bcOpp = null;
boOpp = null;
}
return (CancelOperation);
}
else
{
return(CancelOperation);
}
return (ContinueOperation);
}

function WebApplet_PreInvokeMethod (MethodName)


{
/*if(MethodName=="EventMethodAATest")
{
this.BusComp().SetFieldValue("Status","Closed");
this.BusComp().WriteRecord();

}*/
/*if(MethodName=="EventMethodAATest")
{
var boAAAccount;
var bcAAAccount;
var sIsRecord;
boAAAccount=TheApplication().GetBusObject("AA Account");
//boAAAccount=this.BusObject();
bcAAAccount=boAAAccount.GetBusComp("AA Account");
with(bcAAAccount)
{
ClearToQuery();
ActivateField("Status");
SetSearchSpec("Status","In Progress");
ExecuteQuery(ForwardOnly);
sIsRecord=FirstRecord();
while(sIsRecord)
{
SetFieldValue("Status","Closed");
WriteRecord();
sIsRecord=NextRecord();
}
}
this.BusComp().InvokeMethod("RefreshBusComp");

}*/
if(MethodName=="EventMethodAATest")
{
//var sAccountId;
//sAccountId=this.BusComp().GetFieldValue("Id");
/*var bsAATest;
var iInput;
var oOutput;
bsAATest=TheApplication().GetService("AA Test");
iInput=TheApplication().NewPropertySet();
oOutput=TheApplication().NewPropertySet();
iInput.SetProperty("Row_Id",sAccountId);
bsAATest.InvokeMethod("AATest",iInput,oOutput);*/
var boAccount;
var bcAccount;
var bcServiceReq;
var sAccountId;
var sIsRecord;
sAccountId=this.BusComp().GetFieldValue("Id");
boAccount=TheApplication().GetBusObject("AA Account");
bcAccount=boAccount.GetBusComp("AA Account");
bcServiceReq=boAccount.GetBusComp("AA Service Request");
with(bcAccount)
{
ClearToQuery();
SetSearchSpec("Id",sAccountId);
ExecuteQuery(ForwardOnly);
if(FirstRecord())
{
with(bcServiceReq)
{
ClearToQuery();
ActivateField("Comments");
ActivateField("Status");
SetSearchSpec("Account Id",sAccountId);
SetSearchSpec("Status","Y");
ExecuteQuery(ForwardOnly);
sIsRecord=FirstRecord();
while(sIsRecord)
{
SetFieldValue("Comments","Mohan");
WriteRecord();
sIsRecord=NextRecord();
}
}
}
}
this.BusComp().InvokeMethod("RefreshBusComp");
}

return (ContinueOperation);
}

Вам также может понравиться