• rtuck2009
  • NEWBIE
  • 0 Points
  • Member since 2009

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

Good day to those reading this.  I am an administrator by design with very little code experience.  Recently, we lost our developer and I am now responsible for taking this challenge on......okay, I will pause here and allow those playing the violin to finish.  :)

 

I am wanting to create a trigger, based off the information below:

 

When an Opportunity is created, it creates/converts to Stage=Intake. 

 

At this point, we wait for one of our Associates to schedule an Appointment for this Opportunity.  Appointment is a custom object (Appointment__c). 

 

The trigger I am needing assistance with is:

 

Opportunity stage=Intake and Opportunity field Initial_Appointment_Date__c is NULL. 

 

When a first appointment record is created and seen associated to the opportunity where the criteria above is true, then populate Initial_Appointment_Date__c with the date that first Appointment record was added and change the Opportunity stage to Scheduled.

 

Can anyone be so kind as to help me with this trigger?  Thank you in advance....

 

Robert

I am trying to accomplish the following, using a custom controller along with a VisualForce Page.

 

I have a series of accounts that act as "Retail Stores", each store can schedule appointments on any given day.   A VisualForce page that does two things currently, it has a drop down list where each store is listed.  You pick the store you want, click Search, and the appointments for that location appear.  The code that grabs those "Locations" is as follows:  (I believe)

 

Customer Controller Code:

 

public List<SelectOption> getLocations() {
        List<SelectOption> locations = new List<SelectOption>();
        for (Account acct : [SELECT Id, Name FROM Account WHERE (Type = 'Retail')]) {
            locations.add(new SelectOption(acct.Id, acct.Name));
        }
        return locations;
    }

 

VisualForce Page Code:

 

<apex:pageBlock title="Criteria">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!refresh}" value=" Search "/>
            </apex:pageBlockButtons>
            <apex:PageBlockSection columns="1" title="1. Location">
                <apex:PageBlockSectionItem >
                    <apex:outputLabel value="Location" for="location"/>
                    <apex:selectList value="{!locationId}" id="location" size="1" multiselect="false">
                        <apex:selectOptions value="{!Locations}" />
                    </apex:selectList>
                </apex:PageBlockSectionItem>
            </apex:PageBlockSection>

 

What I am trying to accomplish is updating the above code where it still pulls the accounts as listed above, but adds an additional element by looking at the current users ID, seeing what "Location" they are associated with and defaulting that location's name in the drop down list.  Currently, it is done alphabetically. 

 

I am not sure if this has been explained well enough, and if not, my apologies.  is there anyone that can offer any insight or assistance with this issue?  Thanks in advance.