• NYCMeghan
  • NEWBIE
  • 25 Points
  • Member since 2006

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 4
    Replies
So I hate doing this but I have no developer help in house.  I have a trigger that is supposed to take the Closed amount off of the RevenueForecast and populate a field on a Custom Object with the Closed value.  I have used this trigger to do the same with the Quota value and it works - but for some reason when I try to amend it to populate the Closed value I get an error message:
 

Error: Compile Error: Variable does not exist: OwnerId at line 24 column 21

 

 

 

 

trigger updateClosed on QuotaManagement__c (before insert, before update) {

set<Id> ownerIds = new Set<Id>();

for(QuotaManagement__c qm : Trigger.new) {
ownerIds.add(qm.User__c);
}

List<Period> listOfPeriods = [SELECT Id, Number FROM Period where startDate = THIS_YEAR and endDate = THIS_YEAR and type = 'Month'];

Map<Integer, Id> periodIds = new Map<Integer, Id>(); for(Period p : listOfPeriods) {
periodIds.put(p.Number, p.Id);
}

System.debug('OwnerIds : ' + ownerIds);

List<Schema.RevenueForecast> rfs = [Select Closed, PeriodId, OwnerId from RevenueForeCast where OwnerId in :ownerIds and PeriodId in :periodIds.values() and Closed > 0];

Map<Id, double> closedvals = new Map<Id, double>(); Map<Id, RevenueForecast> ownerClosed = new Map<Id, RevenueForecast>();

for( RevenueForecast rf : rfs)
{
System.debug('Revenue forecast: ' + rf);
ownerClosed.put(rf.OwnerId, rf);
closedvals.put(rf.periodId, rf.Closed); } System.debug('Owner map: ' + ownerClosed); System.debug('Closed map: ' + closedvals);

RevenueForecast revforcast = new RevenueForecast();

for(QuotaManagement__c qm1 : Trigger.new) {
revforcast = ownerClosed.get(qm1.OwnerId);

qm1.January_Closed_Business__c = closedvals.get(periodIds.get(1));
qm1.February_Closed_Business__c = closedvals.get(periodIds.get(2));
qm1.March_Closed_Business__c = closedvals.get(periodIds.get(3));
qm1.April_Closed_Business__c = closedvals.get(periodIds.get(4));
qm1.May_Closed_Business__c = closedvals.get(periodIds.get(5));
qm1.June_Closed_Business__c = closedvals.get(periodIds.get(6));
qm1.July_Closed_Business__c = closedvals.get(periodIds.get(7));
qm1.August_Closed_Business__c = closedvals.get(periodIds.get(8));
qm1.September_Closed_Business__c = closedvals.get(periodIds.get(9));
qm1.October_Closed_Business__c = closedvals.get(periodIds.get(10));
qm1.November_Closed_Business__c = closedvals.get(periodIds.get(11));
qm1.December_Closed_Business__c = closedvals.get(periodIds.get(12));


}
}

 

 

Another newbie question here.  I have created a page using the revenue forecast object that lists the forecast owner/start date/quota/closed

 

I'd like to add one more column after closed that shows the percentage of quota achieved.  There is no field on the Revenue Forecast object to pull this from, nor can  I add it as a custom field.  I'm pretty sure this can be calculated with a controller extention, but the few attempts I have made have not resulted in anything.

 

Controller:

 

 

public class retrieveQuota{
private List<Schema.RevenueForecast> revenueforecast;
public List<Schema.RevenueForecast> getRevenueForecast()

{
revenueforecast = [Select Closed,Pipeline,OpportunityRollupPipeline,OwnerId,Quota,StartDate
from RevenueForecast where StartDate>=2009-01-01 AND Quota<>NULL Order By OwnerId];

return revenueforecast;

}
}

 

 Page:

 

<apex:page controller="retrieveQuota" tabStyle="Opportunity">
<apex:pageBlock title="List">

<apex:pageBlockTable value="{!RevenueForecast}" var="f">
<apex:column value="{!f.OwnerId}"/>
<apex:column value="{!f.StartDate}"/>
<apex:column value="{!f.Quota}"/>
<apex:column value="{!f.Closed}"/>
</apex:pageBlockTable>


</apex:pageBlock>
</apex:page>

 

 Any help is most appreciated.  Thanks!

 

 

I'm a newbie who has encountered a compile error that I suspect is caused by a basic syntax error, but despite many searches and attempts to fix myself no luck.  Any help is much appreciated!

 

exact error:

 

Error: Compile Error: Illegal assignment from LIST:SOBJECT:RevenueForecast to LIST:RevenueForecast at line 6 column 5

  

 

  

 

  

public class showRevenue{
private List<RevenueForecast> revenueforecast;
public List<RevenueForecast> getRevenueForecast()

{
revenueforecast = [Select Closed,Pipeline,OpportunityRollupPipeline,OwnerId,Quota,StartDate
from RevenueForecast where StartDate<=2009-01-01 Order By OwnerId];

return revenueforecast;

}


}

 

First off I preface by saying that I am not a developer, however with a shortage of developer talent at my firm I have taken on some projects a bit over my head.

 

I have created a custom object that is essentially a quota tracker.  As part of the ability to track monthly achievements, I want to include some information on monthly commission payout information.  I've got the custom fields to track monthly achievement metrics, where I am having trouble is with the display of monthly payout info (we pay our sales reps their commission when we receive the first half of a 2 invoice deal)

 

I have an S-Control that shows all closed/won opportunities for all reps in a given month (dates hardcoded).  When I change it to a specific userID it limits the results to that user - makes sense.  However, while the query works in apex explorer, it renders a blank section on the page layout.

 

The bigger issue is that I don't want to have to hardcode the userid into 12 separate s-controls and create 16 separate record types off of this object (16=number of salespeople).

 

Is it possible to generate the results off of a user ID related field?  The custom object (Quota Management) is related to both the opportunity and User via lookups.  I can't create a Master/Detail between it and opportunities as we already have several years worth of opportunities established.  Each Quota Management record can have multiple opportunities, so a Master/Detail off of the opportunity won't work either.

 

And yes, I realize that this can probably be very easily achieved using visualforce, but when I tried to create the standard controller and custom extension I nearly tore my hair out.   

 

And then there is the issue of why it is not displaying on the page layout.  I was getting errors, but now no errors - just blank. 

 

Much rambling, I know - but hopefully someone will take pity on me and see what the heck I have screwed up in this code and how I might be able to reference a UserId rather than have to hardcode one in:

 

<html> <head> <script src="/soap/ajax/10.0/connection.js"></script> <script src="/js/dojo/0.4.1/dojo.js"></script> <script type="text/javascript" src="/js/functions.js"></script> <link href="/dCSS/Theme2/default/common.css" type="text/css" media="handheld,print,projection,screen,tty,tv" rel="stylesheet" > <link href="/dCSS/Theme2/default/custom.css" type="text/css"media="handheld,print,projection,screen,tty,tv" rel="stylesheet"> <script> dojo.addOnLoad(init); function init() { var callback = { onSuccess : displayResult, onFailure : displayError }; sforce.connection.query("SELECT Id, OwnerId, Name, StageName, Amount, CloseDate, Type, Sale_Type__c, Payment_Status__c, Payment_Received__c, Commissioned_On__c, Commission_Percentage__c, Commission_Amount__c FROM Opportunity WHERE IsWon=TRUE AND CloseDate >=2009-04-01 AND CloseDate <2009-05-01 AND Payment_Status__c <> null AND OwnerId='00560000000ygeIAAQ' Order By CloseDate LIMIT 500, callback"); } function displayResult(result) { var it = new sforce.QueryResultIterator(result); var html = []; html.push("<table class='list'>"); html.push("<tr class='headerRow'> "); html.push("<th class='table detail'>Opportunity Owner</th>"); html.push("<th>Name</th>"); html.push("<th>Stage</th>"); html.push("<th>Amount</th>"); html.push("<th>Close Date</th>"); html.push("<th>Type</th>"); html.push("<th>Client Payment Status</th>"); html.push("<th>Commissioned On</th>"); html.push("<th>Sale Type</th>"); html.push("<th>Commission Percentage</th>"); html.push("<th>Commission Amount</th></tr>"); while(it.hasNext()) { var record = it.next(); html.push("<tr class='headerRow'><td> " + record.OwnerId + "</td>"); html.push("<td>" + record.Name + "</td>"); html.push("<td>" + record.StageName + "</td>"); html.push("<td>" + record.Amount + "</td>"); html.push("<td>" + record.CloseDate + "</td>"); html.push("<td>" + record.Type + "</td>"); html.push("<td>" + record.Payment_Status__c + "</td>"); html.push("<td>" + record.Commissioned_On__c + "</td>"); html.push("<td>" + record.Sale_Type__c + "</td>"); html.push("<td>" + record.Commission_Percentage__c + "</td>"); html.push("<td>" + record.Commission_Amount__c + "</td></tr>"); } html.push("</table>"); document.getElementById("output-div").innerHTML = html.join(""); } function displayError(error) { document.getElementById("output-div").innerHTML = "oops something went wrong ... " + error; } </script> </head> <body>

SControl Display Issue

 

First off, apologies for the fact that I am a non-developer posting in the developers forum - but I can't seem to solve this elsewhere.
 
Has anyone come up with a fix that would auto create a contract off of an opportunity?  Ideally, upon closure, but really at any stage would do.
 
We sell a subscription based product and want to take advantage of the features available with the contracts tab, but without requiring duplicative data entry.
 
I have a feeling that this could be done with Apex, but I have no idea where to start.
 
Any feedback would be most appreciated!
 
 
Our sales process runs through several stages, with "Contract Signed" serving as a key trigger for several processes, including a nightly reconcilliation with Quickbooks resulting in invoice creation.
 
One issue we are having is this: the opportunity reaches "contract signed", the invoice is created, and on occasion at some point following that invoice creation, a salesperson might have a conversation with a client, change or modify the opportunity resulting in a pricing/product change.  However, the invoice has already been created, and possibly sent out by our accounts payable department.
 
I need to create a workflow that alerts or creates a task assigned to a specific user in A/P that this change has occurred, so that she can then go into Quickbooks and adjust the invoice accordingly, and send a new one to the client.
 
All of my attempts thus far have failed.  Any suggestions?
Our Sales Team has asked to have the account billing state listed on all tasks.  I've built the appropriate S-Control to do this, but instead of showing the data on one line it comes across as a large chunk of space.

Any thoughts on how to reduce the size to one line?
I have two profiles for our sales users - a "Senior Account Executive" that needs (and has) r/w access to all opportunities.  The users assigned to the other profile, "Account Executive"  need to be able to see all accounts, but should not create opportunities on accounts they do not own.  The only way I can think to prevent this is to put in a validation rule to check account ownership and error on any attempts to create the opp.  Every attempt I have made at this gives me a syntax error.  I know this should be a very basic rule - but I can't seem to get it to work.

Any suggestions?
I am trying to set up a workflow that changes an account owner once an opportunity is in closed/won.  We have created a stage when a contract is signed - its at this point that I want to reassign the account to our inside sales team.  For some reason I can't seem to be able to build this in your standard workflow rule - I can only update opportunity fields off of opportunity fields.

There has to be some way of changing account ownership.  Help!
I'm trying to create a value that tells me how long my salespeople are taking and how efficient they are in developing contact with their leads.  Basically I need a formula that tells:

LastActivityDate - CreatedDate

But I can't seem to subtract dates and get a value

Help!
So I hate doing this but I have no developer help in house.  I have a trigger that is supposed to take the Closed amount off of the RevenueForecast and populate a field on a Custom Object with the Closed value.  I have used this trigger to do the same with the Quota value and it works - but for some reason when I try to amend it to populate the Closed value I get an error message:
 

Error: Compile Error: Variable does not exist: OwnerId at line 24 column 21

 

 

 

 

trigger updateClosed on QuotaManagement__c (before insert, before update) {

set<Id> ownerIds = new Set<Id>();

for(QuotaManagement__c qm : Trigger.new) {
ownerIds.add(qm.User__c);
}

List<Period> listOfPeriods = [SELECT Id, Number FROM Period where startDate = THIS_YEAR and endDate = THIS_YEAR and type = 'Month'];

Map<Integer, Id> periodIds = new Map<Integer, Id>(); for(Period p : listOfPeriods) {
periodIds.put(p.Number, p.Id);
}

System.debug('OwnerIds : ' + ownerIds);

List<Schema.RevenueForecast> rfs = [Select Closed, PeriodId, OwnerId from RevenueForeCast where OwnerId in :ownerIds and PeriodId in :periodIds.values() and Closed > 0];

Map<Id, double> closedvals = new Map<Id, double>(); Map<Id, RevenueForecast> ownerClosed = new Map<Id, RevenueForecast>();

for( RevenueForecast rf : rfs)
{
System.debug('Revenue forecast: ' + rf);
ownerClosed.put(rf.OwnerId, rf);
closedvals.put(rf.periodId, rf.Closed); } System.debug('Owner map: ' + ownerClosed); System.debug('Closed map: ' + closedvals);

RevenueForecast revforcast = new RevenueForecast();

for(QuotaManagement__c qm1 : Trigger.new) {
revforcast = ownerClosed.get(qm1.OwnerId);

qm1.January_Closed_Business__c = closedvals.get(periodIds.get(1));
qm1.February_Closed_Business__c = closedvals.get(periodIds.get(2));
qm1.March_Closed_Business__c = closedvals.get(periodIds.get(3));
qm1.April_Closed_Business__c = closedvals.get(periodIds.get(4));
qm1.May_Closed_Business__c = closedvals.get(periodIds.get(5));
qm1.June_Closed_Business__c = closedvals.get(periodIds.get(6));
qm1.July_Closed_Business__c = closedvals.get(periodIds.get(7));
qm1.August_Closed_Business__c = closedvals.get(periodIds.get(8));
qm1.September_Closed_Business__c = closedvals.get(periodIds.get(9));
qm1.October_Closed_Business__c = closedvals.get(periodIds.get(10));
qm1.November_Closed_Business__c = closedvals.get(periodIds.get(11));
qm1.December_Closed_Business__c = closedvals.get(periodIds.get(12));


}
}

 

 

I'm a newbie who has encountered a compile error that I suspect is caused by a basic syntax error, but despite many searches and attempts to fix myself no luck.  Any help is much appreciated!

 

exact error:

 

Error: Compile Error: Illegal assignment from LIST:SOBJECT:RevenueForecast to LIST:RevenueForecast at line 6 column 5

  

 

  

 

  

public class showRevenue{
private List<RevenueForecast> revenueforecast;
public List<RevenueForecast> getRevenueForecast()

{
revenueforecast = [Select Closed,Pipeline,OpportunityRollupPipeline,OwnerId,Quota,StartDate
from RevenueForecast where StartDate<=2009-01-01 Order By OwnerId];

return revenueforecast;

}


}

 

We are trying to get a new web-to-lead form up and running and most of the code is working except for the following sections (we have all but three fields from the form coming into SFDC):

This section we are trying to set the lead record type to Education





In this next section of Code:
ED_Course Type Interest gets populated
ED_Date Request - does not get populated
ED_Staff Attending - does not get populated
And finally
ED_Comments does get populated



Interested In*

On-site Training
Hosting Course



Request Date*




Number of Staff Attending*





Comments



I'm trying to create a value that tells me how long my salespeople are taking and how efficient they are in developing contact with their leads.  Basically I need a formula that tells:

LastActivityDate - CreatedDate

But I can't seem to subtract dates and get a value

Help!