I have built a custom function that creates new renewal potential when an opportunity closes.
The only problem is it creates the new potential in my name instead of the exisitng potential owners name, I have tried passing the OwnerID to "Potential Owner" in the map for creating the new Potential, then "Opportunity Owner" to "Potential Owner" in the map, they all seem to still create it in my name. The only way I can get it to create it in another users name is when I pass an email address from a field where it is manually inputted.
Is there a way to get a Potential owners email using some kind of get function and pass that into it?
CloseDate=input.CloseDate;
LiveDate=input.LiveDate;
Probability=20;
ParentOppName=input.OppName;
UParentOpp=input.UltimateParent;
KAccMan=input.KAM;
OppMap=map();
NewOppOwner=input.OpportunityOwner;
if((input.Term > 11) && (KAccMan != "N/A"))
{
NewOppOwner=input.KAMemail;
}
if(isBlank(input.UltimateParent))
{
NewOppName=input.OppName + "-Renewal-" + input.OppNumber;
}
else
{
NewOppName=UParentOpp + "-Renewal-" + input.OppNumber;
}
if(isNull(input.LiveDate))
{
NewCloseDate=input.CloseDate.addMonth(input.Term);
}
else
{
NewCloseDate=input.LiveDate.addMonth(input.Term);
}
if(isBlank(input.UltimateParent))
{
UParentOpp=input.OppName;
}
else
{
UParentOpp=input.UltimateParent;
}
OppMap.put("Closing Date",NewCloseDate);
OppMap.put("Parent Opportunity",input.OppName);
OppMap.put("Potential Name",NewOppName);
OppMap.put("Amount",input.RecTot);
OppMap.put("Terms in months",input.Term);
OppMap.put("Industry",input.Industry);
OppMap.put(("Account id"),input.AccountID);
OppMap.put(("Account Name"),input.AccountName);
OppMap.put("Stage","Sales Qualified");
OppMap.put("Probability",Probability);
OppMap.put("BDR - Lead Owner","N/A");
OppMap.put("Competitor","N/A");
OppMap.put("Worst Case VP Y/N","No");
OppMap.put("Worst Case Rep Y/N","No");
OppMap.put("Type","WTB Renewal Business");
OppMap.put("VP Commit Flag","No");
OppMap.put("PO Number Required?",input.PONum);
OppMap.put("Type","WTB Renewal Business");
OppMap.put("Ultimate Parent Opportunity",UParentOpp);
OppMap.put("Potential Owner",NewOppOwner);
OppMap.put("KAM",KAccMan);
if(isBlank(input.ChildOpp))
{
OppRsp = zoho.crm.create("Potentials",OppMap,1);
}