Professional Documents
Culture Documents
BusComp: Opportunity
Control: Sales Team
Field: Sales Rep
MVG : Sales Team Mvg Applet
MVG BusComp: Position
return(ContinueOperation);
}
General Sction:-
/*
Author: Jonthan Lee
Date: 7/10/03
Desc: This function adds Sales Team members of the selected employee
to the opportunity team.
*/
function AddOpportunityTeam(BOOpty)
{
var BCOptyPosNetApp = BOOpty.GetBusComp("Opportunity Position NetApp");
var BCOpty = BOOpty.GetBusComp("Opportunity");
if (sCurrEmpId != "")
{
var BOEmp = TheApplication().GetBusObject("Employee");
var BCEmp = BOEmp.GetBusComp("Employee Sales Team NetApp");
while (isRecordEmp)
{
var sEmpId = BCEmp.GetFieldValue("Employee Id NetApp");
var sEmpPostnId = BCEmp.GetFieldValue("Primary Position Id");
BCOptyPosNetApp.ClearToQuery();
BCOptyPosNetApp.SetViewMode(AllView);
BCOptyPosNetApp.SetSearchSpec("Opportunity Id", sOptyId);
//BCOptyPosNetApp.SetSearchSpec("Employee Id", sEmpId);
BCOptyPosNetApp.SetSearchSpec("Position Id", sEmpPostnId);
BCOptyPosNetApp.ExecuteQuery();
if (BCOptyPosNetApp.FirstRecord())
{
//employee already part of team
}
else
{
//adds sales team members of current member to opportunity
team
BCOptyPosNetApp.NewRecord(NewAfter);
BCOptyPosNetApp.SetFieldValue("Opportunity Id", sOptyId);
//BCOptyPosNetApp.SetFieldValue("Employee Id", sEmpId);
BCOptyPosNetApp.SetFieldValue("Position Id", sEmpPostnId);
BCOptyPosNetApp.WriteRecord();
}
isRecordEmp = BCEmp.NextRecord();
}
this.BusComp().ClearToQuery();
this.BusComp().ExecuteQuery();
}
BCEmp = null;
BOEmp = null;
BCOpty = null;
BCOptyPosNetApp = null;
}
/*
Author: Jonthan Lee
Date: 7/10/03
Desc: This function adds Sales Team members of the selected employee
to the respective team.
*/
function AddTeam()
{
var BOActive = TheApplication().ActiveBusObject();
if (BOActive.Name() == "Opportunity")
{
AddOpportunityTeam(BOActive);
}
BOActive = null;
}
function AddTeamORIG()
{
/*
This code is valid only when there is one one to one relationship between Position and Login Id
ie User.
*/
try
{
var posBC ;
var searchExpr = "";
var newLine = String.fromCharCode(10);
var noPosAdded = true;
posBC = this.BusComp();
var empID = posBC.GetFieldValue("Active Emp Id");
while (isRecordEmp)
{
if (searchExpr == "" )
{
searchExpr = "EXISTS([Login Name] = '" ;
searchExpr = searchExpr + empBC.GetFieldValue("Employee
Login NetApp") ;
searchExpr = searchExpr + "')";
}
else if (searchExpr != "")
{
searchExpr = searchExpr + " OR EXISTS([Login Name] = '" ;
searchExpr = searchExpr + empBC.GetFieldValue("Employee
Login NetApp")
searchExpr = searchExpr + "')";
}
isRecordEmp = empBC.NextRecord();
}
if (searchExpr != "")
{
accntposBC.ClearToQuery();
accntposBC.SetSearchExpr(newExpr);
accntposBC.ExecuteQuery();
var isRecord = accntposBC.FirstRecord();
if (isRecord == false)
{
accntposBC.NewRecord(NewAfter);
accntposBC.SetFieldValue("Account Id"
,posBC.ParentBusComp().GetFieldValue("Id"));
accntposBC.SetFieldValue("Position Id"
,newPosBC.GetFieldValue("Id"));
noPosAdded = false;
accntposBC.WriteRecord();
}
/*
else
{
intValue = newPosBC.NextRecord();
}
// newPosBC.AllowNotification();
if (noPosAdded )
TheApplication().RaiseErrorText("All the team members are
already added.");
}
else
{
TheApplication().RaiseErrorText("There are no team members for the
person selected");
}
}
catch(e)
{
}
finally
{
posBC.ClearToQuery();
posBC.ExecuteQuery();
accntposBC = null;
accntposBO = null;
newPosBC = null;
posBC = null;
}
}
________________________________________________________________________
Assoc Applet: Team Member Assoc Applet
Assoc BusComp: NetApp CE Position
/********************************************************************
Author: Mohana Jaganathan
This function is written for MOP# 1381146
/********************************************************************/
function WebApplet_PreInvokeMethod (MethodName)
{
try
{
switch(MethodName)
{
case "NAEmp":
{
NetAppEmp();
SetButtonFlags(false, true);
return(CancelOperation);
}
case "NAPartner":
{
if(lConsolidator != "")
{
if(lSearchDCExpr != "")
lSearchDCExpr += " OR ";
if(lMyOrgSearchString != "")
lMyOrgSearchString += " OR ";
lMyOrgSearchString += GetPartnersForMyOrg();
if(lMyOrgSearchString == "")
lMyOrgSearchString = "[Id] IS NULL";
GetPositionData(lMyOrgSearchString);
SetButtonFlags(true, false);
bcOpty = null;
boOpty = null;
return(CancelOperation);
}
}
return(ContinueOperation);
}
catch(e)
{
throw(e);
}
}
______________________________________________________________________________
________
/********************************************************************
Author: Mohana Jaganathan
This function is written for MOP# 1381146
/********************************************************************/
function WebApplet_PreCanInvokeMethod (MethodName, &CanInvoke)
{
switch(MethodName)
{
case "NAEmp":
{
if(gNetAppEmp)
CanInvoke = "TRUE";
return(CancelOperation);
}
case "NAPartner":
{
if(gNetAppPartner)
CanInvoke = "TRUE";
return(CancelOperation);
}
}
return(ContinueOperation);
}
______________________________________________________________________________
________
function WebApplet_Load ()
{
this.BusComp().ClearToQuery();
this.BusComp().ExecuteQuery();
this.BusComp().SetViewMode(3); // All
this.BusComp().ExecuteQuery();
}
}
NetAppEmp();
SetButtonFlags(false, true);
}
Declarations :
//Mohana Jaganathan
var gNetAppEmp;
var gNetAppPartner;
______________________________________________________________________________
________
/********************************************************************
Author: Mohana Jaganathan
This function is written for MOP# 1381146
/********************************************************************/
function GetChannelPartnerIDForMyOrg(iSearchExpr)
{
try
{
var boChannelPartner = TheApplication().GetBusObject("Channel Partner");
var bcChannelPartner = boChannelPartner.GetBusComp("Channel Partner");
bcChannelPartner.ClearToQuery();
bcChannelPartner.SetViewMode(AllView);
bcChannelPartner.SetSearchExpr(iSearchExpr);
bcChannelPartner.ExecuteQuery();
return(oSearchString);
}
catch(e)
{
throw e;
}
finally
{
bcChannelPartner = null;
boChannelPartner = null
}
}
/********************************************************************
Author: Mohana Jaganathan
This function is written for MOP# 1381146
/********************************************************************/
function GetPartnersForMyOrg()
{
try
{
var boOpty = TheApplication().ActiveBusObject();
var bcAccountOpty = boOpty.GetBusComp("Account Opportunity NetApp");
bcAccountOpty.ClearToQuery();
bcAccountOpty.SetViewMode(AllView);
bcAccountOpty.ActivateField("Opportunity Id")
bcAccountOpty.ActivateField("Account Id");
bcAccountOpty.SetSearchSpec("Opportunity Id",
TheApplication().GetSharedGlobal("gCurrOptyId"));
bcAccountOpty.ExecuteQuery();
return(oSearchExpr);
}
catch(e)
{
throw e;
}
finally
{
bcAccountOpty = null;
boOpty = null;
}
}
/********************************************************************
Author: Mohana Jaganathan
This function is written for MOP# 1381146
/********************************************************************/
function GetPositionData(iSearchExpr)
{
try
{
var bcNetAppPosition = this.BusComp();
bcNetAppPosition.ClearToQuery();
bcNetAppPosition.SetViewMode(AllView);
bcNetAppPosition.SetNamedSearch("CECollSearch", iSearchExpr);
bcNetAppPosition.ExecuteQuery();
}
catch (e)
{
throw(e);
}
finally
{
bcNetAppPosition = null;
}
}
/********************************************************************
Author: Mohana Jaganathan
This function is written for MOP# 1381146
/********************************************************************/
function NetAppEmp()
{
var bcNetAppPosition = this.BusComp();
bcNetAppPosition.ClearToQuery();
bcNetAppPosition.ExecuteQuery();
/********************************************************************
Author: Mohana Jaganathan
This function is written for MOP# 1381146
/********************************************************************/
function SetButtonFlags(iNetAppEmp, iNetAppPartner)
{
gNetAppEmp = iNetAppEmp;
gNetAppPartner = iNetAppPartner;
}