+ Start a Discussion
azar khasimazar khasim 

need to update the owner name in VF page of custom object.

I have a VF Page on Booking LInk (Custom Object) and also a controller class for it. As i have used this VF Page in "Site.com". Where i have successfully saving the data fro VF Page to Booking Link Object, Which is a child object for Account and had data of that person and we need to Update the Owner Name and Update the record details in Account.

Please Help me out from this..,
My Idea was Process Builder whether is it useful or Trigger!!??

VF Page For Booking Link ( Custom Object):

<apex:page controller="BookingController">
    <apex:form >
        <apex:sectionHeader title="Person Customer Edit" subtitle="New Customer"/>
        <apex:pageBlock rendered="{!isboolean}">
            <apex:pageBlockButtons >
               <font size="2" style="color:red"><b>NOTE : After Clicking on Save Button, No further changes will be done.</b> </font>
                <apex:commandButton action="{!save}" value="Save"/>
                <apex:commandButton action="{!cancel}" value="cancel"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Customer Information" collapsible="false" columns="2">           
                <apex:inputField value="{!booking.Salutation__c}"/>
                <apex:inputField value="{!booking.Name}"/>
                <apex:inputField value="{!booking.First_Name__c}"/>
                <apex:inputField value="{!booking.Date_Of_Birth__c}"/>
                <apex:inputField value="{!booking.Middle_Name__c}"/>
                <apex:inputField value="{!booking.Wedding_Anniversary__c}"/>
                <apex:inputField value="{!booking.Last_Name__c}"/>
                <apex:inputField value="{!booking.Mobile__c}"/>
                <apex:inputField value="{!booking.Gender__c}"/>
                <apex:inputField value="{!booking.Alternate_Mobile__c}"/>
                <apex:inputField value="{!booking.Relation__c}"/>
                <apex:inputField value="{!booking.Phone__c}"/>
                <apex:inputField value="{!booking.Father_Husband__c}"/>
                <apex:inputField value="{!booking.Other_Phone__c}"/>
                <apex:inputField value="{!booking.Pan_Number__c}"/>
                <apex:inputField value="{!booking.Home_Phone__c}"/>
                <apex:inputField value="{!booking.Aadhar_Number__c}"/>
                <apex:inputField value="{!booking.Email__c}"/>  
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Professional Information" collapsible="false" columns="1">
                <apex:inputField value="{!booking.Profession__c}"/>
                <apex:inputField value="{!booking.Designation__c}"/>
                <apex:inputField value="{!booking.Professional_Email__c}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Office Address" collapsible="false" columns="1">
                <apex:inputField value="{!booking.Employed_by__c}"/>
                <apex:inputField value="{!booking.OfficeStreet__c}"/>
                <apex:inputField value="{!booking.OfficeCity__c}"/>
                <apex:inputField value="{!booking.OfficeState__c}"/>
                <apex:inputField value="{!booking.OfficeCountry__c}"/>
                <apex:inputField value="{!booking.OfficePinCode__c}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Children School Address" collapsible="false" columns="1">
                <apex:inputField value="{!booking.School_Name__c}"/>
                <apex:inputField value="{!booking.SchoolStreet__c}"/>
                <apex:inputField value="{!booking.SchoolCity__c}"/>
                <apex:inputField value="{!booking.SchoolState__c}"/>
                <apex:inputField value="{!booking.SchoolCountry__c}"/>
                <apex:inputField value="{!booking.SchoolPinCode__c}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Address Information" collapsible="false" columns="2">   
                <apex:inputField value="{!booking.BillingStreet__c}"/>
                <apex:inputField value="{!booking.ShippingStreet__c}"/>
                <apex:inputField value="{!booking.BillingCity__c}"/>
                <apex:inputField value="{!booking.ShippingCity__c}"/>
                <apex:inputField value="{!booking.BillingState__c}"/>
                <apex:inputField value="{!booking.ShippingState__c}"/>
                <apex:inputField value="{!booking.BillingCountry__c}"/>
                <apex:inputField value="{!booking.ShippingCountry__c}"/>
                <apex:inputField value="{!booking.BillingPinCode__c}"/>
                <apex:inputField value="{!booking.ShippingPinCode__c}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
        <apex:pageBlock rendered="{!booleans}">
            <apex:outputText >
               <center>Thank You for choosing Bren Corporation.</center> 
            </apex:outputText>
        </apex:pageBlock>
    </apex:form>
</apex:page>



Apex Code Controller for above VF Page Booking Link(Custom Object).

public class BookingController {
    public Booking_Link__c booking {get;set;}
    public Boolean isboolean {get;set;}
     public Boolean booleans {get;set;}
    public BookingController(){
        booking = new Booking_Link__c();
        isboolean=true;
        booleans=false;
    }
    public void save(){
        try {  
            INSERT booking;
            isboolean=false;
            booleans=true;
        }
        catch (Exception e) {
            ApexPages.addMessages (e);
           // return null;
        }
       // PageReference pr = new ApexPages.StandardController(booking).view();
        //return null;
    }
    
    public void cancel(){
        booking = new Booking_Link__c();
    }



Please give me a way to complete this task.