• Julian Davis 7
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
Hello

I'm possibly a bit too new to coding in Salesforce, so please bear with the newbie, but I am getting an error when trying to create an Apex class that I am really struggling to get beyond, though its probably super-simple (hopefully!).

Here is the code for my class...
 
public class dynamicaddresslist {
    
public List<address__c> addressTemp = new List<Address>();
    public dynamicaddresslist()
    {
     
    }
     
    public List<SelectOption> addresslist
    {
        get
        {
            addressTemp = [Select Address_Type__c,City__c,Country__c,Postal_Code__c,State__c,Street__c from address__c];
            
            addresslist = new List<SelectOption>();
             
            for(address adr : addressTemp)
            {
                addresslist.add(new SelectOption(adr.AddressType, adr.Street__c, adr.City__c, adr.State__c, adr.Postal_Code__c, adr.Country__c));
            }
            return addresslist;
        }
        set;
    }
}

the object that I am hoping to pull the records from is a custom one, titled "Address__c"

Any points in the right direction of where I am going wrong would be much appreciated.

Thank you in advance for your help.

Julian
Hello

I'm looking for some help on some formula code that sits within an opp validation rule which pre-existed in the organisaiton that I work for, but that we now want to try and amend in order to get any record with a newly added opp record type to ignore.

The formula code is as follows: 
---------------------------------------------------------------------------------------------------------------------------------
AND(

OR(ISPICKVAL( StageName , "Complete - Won"),
ISPICKVAL( StageName , "Complete - Won (Products Dropped)")
),

OR(ISPICKVAL( Contract__r.Status, "Draft" ),
ISPICKVAL( Contract__r.Status, "In Approval Process" )

),

OR (RecordTypeId <> $Setup.RecordTypeID__c.Opportunity_Consulting_Opportunity__c,
RecordTypeId <> $Setup.RecordTypeID__c.Opportunity_MC_Credit__c)
)
---------------------------------------------------------------------------------------------------------------------------------

We added the "RecordTypeId <> $Setup.RecordTypeID__c.Opportunity_MC_Credit__c" line to try to get the formula to ignore any opps that come through with a record type of "Opportunity_MC_Credit__c".
 
The test record that we’re struggling with has the following values:StageName = "Complete - Won"
Contract__r.Status = "Draft"
RecordTypeID__c = “Opportunity_MC_Credit__c” 
When the record goes through this code it fires an error message and stops us closing the opportunity that its on.
 
What we want to know is - does this code make sense in terms of its logic? Which of the three blocks of code is actually running when we pass our record through with the above parameters? Just one of the blocks? More than one? Does the code run in a particular order? If the criteria is met on the first block of code does it then stop there? Or does it continue until its checked all three blocks?
 
Really hoping I’m making some sense! and many thanks in advance for your help.