+ Start a Discussion
jbardetjbardet 

Simple alert via S-Control / Java

Using Professional Edition, I'd like to create an alert when the quote estimate field >= 50000 and is in the proposal/price quote stage. (And for testing purposes, I'm using an Opp named "Test".

 

Here's what I have so far. When I place it on the opp layout, it errors and shows upas a large blank space.

 

Any help appreciated! Thanks.

 

<html>
<head>

<script type="text/javascript" language="javascript" src="/js/functions.js"></script>
<script type="text/javascript" src="/soap/ajax/10.0/connection.js"></script>
<script type="text/javascript">

function throwalert()
{

// Begin by creating 3 variables for the criteria to be met.

var oppname = "{!Opportunity.Name}";

var isstatus = "{!Opportunity.StageName}";

var quoteest = "{!Opportunity.Quote_Estimate__c}"

// Now create a function which will decide if the criteria is met or not and throw alert message.

//var oppname= "Test"
//var quoteest >= "50000"
//var isstatus = "Proposal/Price Quote"

var msgg = "The quote estimate for this opportunity is equal to or greater than $50,000. Remember to submit this opportunity for approval. "

if ((oppname == "Test") && (quoteest >= 50000) && (isstatus == "Proposal/Price Quote"))
{
alert(msgg);
}
else
{
window.parent.location.replace = "{URLFOR($Action.Opportunity.View, Opportunity.Id,null,true)};"
}
}
</script>
</head>
<body onload="throwalert()";>
</body>
</html>
jbardetjbardet

Help would be very appreciated!

Simply trying to merge the field "Task.Subject" returns nothing...what do I do?

 

I want to have an alert go off depending on stage, and a quote estimate > $50k .. tricky part is trying to get it to go off when there is NOT a task on the opp page that includes the word "Approval" OR "Approved"

 

What should i set as var task?

 

<html>
<head>

<script type="text/javascript" language="javascript" src="/js/functions.js"></script>
<script type="text/javascript" src="/soap/ajax/10.0/connection.js"></script>
<script type="text/javascript">

function throwalert()
{
    // Begin by creating 3 variables for the criteria to be met.
    var oppname = "{!Opportunity.Name}";
    var isstatus = "{!Opportunity.StageName}";
    var quoteest = "{!Opportunity.Quote_Estimate__c}"
    quoteest = quoteest.replace(/[^\d\.]/g, "" ); // strip out all non-numeric characters
    quoteest = parseFloat( quoteest );

    var msgg = "The quote estimate for this opportunity is equal to or greater than $50,000. Remember to submit this opportunity for approval. ";

    var task = ?????


    var task = "{!Task.Subject}";
    if ( (quoteest >= 50000)
         && (isstatus == "Proposal/Price Quote")
 // if a task on the opportunity page has the subject title that includes the word "Approval"
         && (task.toLowerCase().indexOf("approval") < 0 ) )
    {
        alert(msgg);
       
    }
    else
    {
        window.parent.location.replace = "{URLFOR($Action.Opportunity.View, Opportunity.Id,null,true)};"
    }
}

</script>
</head>
<body onload="throwalert()";>
</body>
</html>