You need to sign in to do that
Don't have an account?
dreamhomescrm
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}";
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}";
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);
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>
setTimeout('updwindow.close()',1500);
var retURL = escape("/{!Opportunity.Id}");
setTimeout('parent.frames.location.replace("https://emea.salesforce.com" + retURL)',2000);
}
}
</script>
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...