+ Start a Discussion
jbardetjbardet 

java alert recognizing related list. (easy answer, i'm just dumb!)

Hi everyone,

 

In professional edition I have a JS alert pop up that says "remember to submit this opportunity for approval" that goes off if the quote estimate is > $50,000. We submit approvals by using tasks. "approval" (let's say) would be the title of the task.

 

I want the alert to not pop up if it finds "Approval" in a Task Name.

 

But I can't get it to recognize data in a related list. How do I do this? I think this is a simple issue but no idea.

 

original button code:

 

 <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 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 {!Opportunity.Quote_Estimate__c}. Remember to submit this opportunity for approval.";

if ((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>

 

here is what i was thinking for the additional code but i am missing the part about making it recognize what is listed under tasks and/or activity history.

 

    var task = "{!Task.Subject}";
if ( (quoteest >= 50000)
&& (isstatus == "Proposal/Price Quote")
&& (task.toLowerCase().indexOf("approval") < 0 ) )
{
...