You need to sign in to do that
Don't have an account?
PerGeert
S-control doesn't always like RevenueForecast object
I have a scontrol, which basically does this:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <script type="text/javascript" src="/js/functions.js"></script> <script src="/soap/ajax/12.0/connection.js"></script> <script type="text/javascript"> window.onload=init_page(); function init_page() { var result; var strSQL = "Select Id,StartDate,ProductFamily,Quota,Closed,Commit,Upside,Pipeline,CurrencyIsoCode from RevenueForecast where OwnerId='{!$User.Id}' and StartDate >= 2008-04-01 and StartDate <= 2009-03-31 order by ProductFamily"; try { result = sforce.connection.query(strSQL); } catch(err) { alert(err); alert('SQL blowup');} } </script> </head> <body></body> </html>
When I execute it as System Administrator, it works as expected. However, when I execute with another profile, I get an error:
{faultcode:'sf:INVALID_TYPE', faultstring:'INVALID_TYPE: sObject type 'RevenueForecast' is not supported.', ...}
Which security settings (besides API enabled) must the user's profile have in order to read RevenueForecast?
Well, I can give the user profile 'View all Data' authority,
but that is definately not acceptable since the idea with this s-control is on the Home Page for each sales rep to show graphically,
how they stand comparing quotas to actuals within current FY.
I also thought about a trigger, which copies RevenueForecast to a custom object with the necessary security settings.
However, it does not seem possible to make triggers for RevenueForecast object, not even via Eclipse.
Other ideas?
Well, I found a way: Put all the code into an APEX page controller, make a VF page and call that page from an s-control.
The page controller will execute in system mode, thus avoiding security issues.
The s-control is the added to a dashboad available for all relevant users.
Simple, Watson!