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
suresh143suresh143 

Pls Give that code

 Set the Stage = “New Opportunity” , Probablity = “10%”  3. Do NOT put values in OEM or Total fields.

 

test script:

 

Please enter "OEM" field!
2. Please enter "Total Value" field!

GlynAGlynA

Suresh,

 

Can you be more descriptive?  What are you trying to do?

 

-Glyn

suresh143suresh143
Opportunity level field stage =“New Opportunity” , Probablity = “10% then fire trigger and asking pls enter total value field and oem field write trigger in opportunity level
GlynAGlynA

OK - I think you want a trigger that enforces a validation rule: If the opportunity stage is "New Opportunity" and the probability is "10%", then make sure the Total Value and OEM fields have values, otherwise, display error messages.  This code does that:

 

trigger ValidateTotalValueAndOEM on Opportunity ( after insert, after update )
{
    for ( Opportunity opp : Trigger.new )
    {
        if ( opp.StageName != 'New Opportunity' || opp.Probability != 10 ) continue;

        if ( opp.Total_Value__c == null )
        {
            opp.addError( 'Please enter a Total Value.' );
        }
        if ( opp.OEM__c == null )
        {
            opp.addError( 'Please enter a value for OEM.' );
        }
    }
}

Please let me know if I misunderstood your problem.

 

If this helps, please mark it as a solution, and give kudos (click on the star) if you think I deserve them. Thanks!

 

-Glyn Anderson
Certified Salesforce Developer | Certified Salesforce Administrator

suresh143suresh143
Hi thnks for giving that one
suresh143suresh143
Hi Account object is there one button is creted called download click that button account detail page data converted into excel format pls give that code And kindely share that one
thisisnotaprilthisisnotapril
Is this part of a test or something you're taking?
GlynAGlynA

You should post this as a new question.