function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
dreamhomescrmdreamhomescrm 

HELP - Why does this S-Control only work for Sys Admins?? Pro Version

Hello,
 
On the Opps page we use a second field that can handle formula calcuations to calculate the final value that we need in the AMOUNTS field (the key field that SF uses for forecasting). Then we have created a S-Control that passes the caculated value into the AMOUNTS field based on the user´s role when the go into the Opportunity.
 
The javascript works fine and only works for the user roles we have identified but with one big problem. It only works if the person is a Sys Admin. It will not execute the S-Control if the person is a Standard User.
 
Any ideas on how to solve this. We have the Pro Version.
 
Here is the S-Control . . .
 
<script language="JavaScript">
// Check the roles allowed to do this
var myrole = "{!$UserRole.Name}";
if(myrole == 'Marketing Manager' || myrole == 'Client Services Manager' || myrole == 'Client Services Assistant Manager' || myrole == 'Client Services Admin' || myrole == 'CRM Manager' || myrole == 'Operations Director' || myrole == 'Broker Sales Manager')
{
    var theformula = "{!Opportunity.Amount_Formula_Result__c}";
    var theamount = "{!Opportunity.Amount}";
    // If they are not the same (which they should be) then enter here
    if(theformula != theamount)
    {
        // Loop across the formula field and remove anything thats not a number, comma or full stop
        for (var i=0, currencyasnumber ='', valid="1234567890.,"; i<theformula .length; i++)
        if (valid.indexOf(theformula .charAt(i)) != -1)
        currencyasnumber += theformula .charAt(i);
        updwindow = window.open('/{!Opportunity.Id}/e?retURL=%2F{!Opportunity.Id}&opp7=' + currencyasnumber + '&save=1','mywindow','width=100,height=100,location=1,status=1,scrollbars=1');
        setTimeout('updwindow.close()',1500);
        var retURL = escape("/{!Opportunity.Id}");
        setTimeout('parent.frames.location.replace("https://emea.salesforce.com" + retURL)',2000);
    }
}
</script>
gsickalgsickal

sounds like a permissions issue.  go to setup | manage users | profiles and select the profile that the user trying to logon is.  click edit and make sure "API Enabled" is checked under the section Administratvie Permissions. This checkbox means users with this profile can run scontrols which access salesforce through the api.  If this doesn't solve your problem, it may be that the user doens't have the correct permissons on the objects you are trying to manipulate...

dreamhomescrmdreamhomescrm
Hello gsickal,
 
Thank you for the feedback but I do not have access to "profiles" under the "manage users" section. I have the Professional Edition of Salesforce.
 
Do you have any other ideas?