You need to sign in to do that
Don't have an account?

javascript alert based on IF task.subject field
Hi all,
I'd like to add a javascript alert to an opportunity page. I've gotten it to be able to alert if criteria are met on Opportunity fields, but what about including Task information in this criteria?
i only want the alert to go off if there isn't a task on the opp page that has the word "approved" or "approval" in it. What can I add as the var task to do this?
Thanks so much for anyone who can steer me in the right direction. I'm pretty new to this, (clearly..)
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 = ?????????? if ((quoteest >= 50000) && (isstatus == "Proposal/Price Quote")) { alert(msgg); } else { window.parent.location.replace = "{URLFOR($Action.Opportunity.View, Opportunity.Id,null,true)};" } }
Hi,
Since an opportunity may have more than one tasks we need to look out for each tasks. Hence a query to task table would do here. Following may help with your req.
the variable isApproval will determine if there are any tasks with subject having 'Approv*' and you can use this variable for your use.
hope this helps.
Cheers..
im having trouble putting it all together.
and at first it said that function requirescript could not be used in this formula. after some searching i reformatted it to:
<apex:includeScript value="/soap/ajax/17.0/connection.js"/>
<apex:includeScript value="/soap/ajax/17.0/apex.js"/>
but i am having trouble getting the functionality to work properly.
thanks very much and my apologies for my ignorance.