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
jgrossjgross 

Help with Visualforce page

I am new at coding and am probably way over my head. However I need to get this figured out.

 

Below is the code I have for a current visualforce page. I need to add a trigger that updates the opportunity master-detail lookup field with the id from the custom field opportunity name text.

 

Fields in Custom Object (Project)

Opportunity Name            Opportunity_Name__c      Lookup(Opportunity)

Opportunity name text     Opportunity_name_text__c     Formula (Text)--This formula was setup to pull the Opportunity id that I want the master detail lookup to relate to.

 

 

This visualforce page is setup for a cloning button of a custom object. Thank you for your help on this issue!

 

-->
<apex:page standardController="Milestone1_Project__c"
           extensions="Milestone1_Clone_Project_Controller">
           
    <apex:form >
        <apex:pageBlock title="Project Clone">
            <apex:pageBlockButtons >
                <apex:commandButton value="Save"
                                    action="{!createClone}"/>
                <apex:commandButton value="Cancel"
                                    action="{!cancel}"/>
            </apex:pageBlockButtons>
            
            <apex:pageBlockSection columns="1">
                <apex:pageBlockSectionItem > 
                    <apex:outputLabel value="New Project Name"
                                      for="new_name"/> 
                    <apex:inputText id="new_name"
                                    value="{!dummyProj.name}"
                                    required="true"/> 
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
            
        </apex:pageBlock>
    </apex:form>
           
</apex:page>

 btw, I received this coding from: Milestones PM - Project Planning and Task Management Application - Force.com Labs. They have a copywrite on the coding as is. However they do allow changes to the coding. I am adding this info because there is copywrite stuff on the visualforce page I pulled it from.

TheSwamiTheSwami

On the page, there is a button called "Save" which calls a method "createClone" - is this the action you want to modify?

 

There should be a method called createClone in your Milestone1_Clone_Project_Controller Apex Class.  That is where you would put the logic.