• azar khasim
  • NEWBIE
  • 120 Points
  • Member since 2019
  • Developer
  • SiraTek

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 26
    Questions
  • 42
    Replies
Hello Developers/Everyone,

Trying to create bulk records in Child Object from Parent Object using Visualforce Page .


Objects Names :
Opportunity  (Opportunity)
Product Schedule (Project_Schedule__c)
Schedule (Schedule__c)

Relation Between Them :
Master Detail
Opportunity to Schedule(MasterDetail)
Schedule to Product Schedule(Master Detail)

Actual Action to perform:


On Opportunity Record Page(Detail Page)
Create a custom Button. 
Custom Button contain Visualforce Page.
In that Visualforce Page we have fields of Schedule Object which is child of Opportunity.
User update Mandatory fields of Schedule Object, on that Visualforce Page and click on save at that time.
We need to create 10 or 12 or 20 records with the same data in all records.(Number of records will be dynamic)

Now Example : 
10 records have to get created on Schedule Object.
then at that time 
in Sub child Object(Product Schedule) their also 5 or 7 or 10 Records need to get create dynamically.


Final point is 
From Opportunity 
we need to create a record in child object as well as in super child(Child Child Object) Object.
These are to be bulk records and are dynamic in insertion.

***Please provide me a solution.
If any doubts please revert back.., 
I need this implementation and any suggestion will really helps me a lot.

Thanks and Regards,
Azar Khasim.
I need some help to overcome the issue.

Process is 
In opportunity object, Opportunity Owner will update a Chatter Post (Activities -- Post)
Then by use of Process builder we are creating a Task Record.


Now For example:
In Chatter Post(Body) we will type like in below


Send 150 Samples.
Product :  Diode  , Qty : 3 , Date : 14/05/2020


hereby using PB we are updating Chatter body in Task Description Field.

Now we want to autoupdate 
DueDate : as 14/05/2020 (Dynamically based on different records)
Qty : Dynamically
Product : Dynamically

By Using Parsing method.

Please provide me a solution for this.

Either through Apex Coding or through Formula field.
Anyway no problem.

Thanks and Regards,
Azar Khasim.
hello everyone,

Need to add a Custom button on Lead List Page?

 Controller Class :
 
/*
Developer : Azar khasim 
Created Date : 03 MAR 2020
Description : Global Duplicate Search. 
*/

public class GlobalDupSearch1 {
 // PE is for searching for duplicates//   
    public string PE{get;set;}
    public string a;
    
 // These booleans are for capturing the filtered records//
    public boolean cn1{get;set;}
    public boolean ac1{get;set;}
    public boolean ld1{get;set;}
    public boolean ld2{get;set;}
    public boolean opp1{get;set;}
    
 // For Capturing of lead status.   
    public boolean Editlead{get;set;}
    public boolean Createlead{get;set;}
    
 // These lists are to capture the filtered records and stored in the list//
    public list<Account> aclist{get;set;}
    public list<contact> cnlist{get;set;}
    public list<lead> ldlist{get;set;}
    public list<lead> ldlist1{get;set;}
    public list<opportunity> opplist{get;set;}
    
    
    public GlobalDupSearch1(apexpages.StandardController sc){
      a=apexpages.currentPage().getparameters().get('id');  
     //   PE= 'search here...'; 
     
    }
    
    public void search(){
        if(pe != null && pe != ''){
            
            aclist=[select id, name, PersonMobilePhone, PersonEmail, Phone, Owner.name, Owner.UserRoleId, Owner.MobilePhone, Owner.Email, OwnerId from account where PersonMobilePhone like :PE or PersonEmail like :PE]; 
            if(aclist.size() > 0){
                ac1=true;
             }
            else{ 
                ac1=false;
            }
            opplist=[SELECT name, Mobile__c, Email__c, StageName, Owner.name, Owner.UserRoleId, Owner.MobilePhone, Owner.Email, OwnerId from opportunity where Email__c like :PE or Mobile__c like :PE];
            if(opplist.size()>0){
                opp1=true;
             }
            else{
                opp1=false;
            }
            cnlist=[SELECT name, MobilePhone, Email, Owner.name, Owner.UserRoleId, Owner.MobilePhone, Owner.Email, OwnerId from contact where MobilePhone like :pe or Email like :PE]; 
            if(cnlist.size() > 0){
                cn1=true;
             }
            else{
                cn1=false;
            }
            ldlist=[SELECT id,name, MobilePhone, Email, Status, User_Mobile__c, Lead_Owner_Role__c, DUP_Mobile__c, Owner.name, Owner.UserRoleId, Owner.Email, OwnerId, DUP_Update_Owner__c from lead where (Status!= 'Converted' AND Status!= 'Prospect' ) AND (MobilePhone like : pe or Email like :pe or DUP_Mobile__c like : pe)];
            if(ldlist.size() > 0){
                ld1=true;
            }
            else{
                ld1=false;
            }            
            
            ldlist1=[SELECT id,name, MobilePhone, Email, Status, User_Mobile__c, Lead_Owner_Role__c, DUP_Mobile__c, Owner.name, Owner.UserRoleId, Owner.Email, OwnerId, DUP_Update_Owner__c from lead where (Status!= 'New' AND Status!= 'Assigned' AND Status!= 'Followup' AND Status!= 'Junk' ) AND (MobilePhone like : pe or Email like :pe or DUP_Mobile__c like : pe)];
            if(ldlist1.size() > 0){
                ld2=true;
            }
            else{
                ld2=false;
            }          
            
            if(ac1 == false && cn1 == false && ld1 == false && ld2 == false && opp1 == false){
             // To show create lead Button.
                Createlead=true;
                Editlead=false;
                apexpages.Message m=new apexpages.message(ApexPages.Severity.ERROR,'No records found!');
                apexpages.addMessage(m);
            }else{
                Createlead=false;
            }
            
        }else{
            
            Createlead=false;
            Editlead=false;
            apexpages.Message m1=new apexpages.message(ApexPages.Severity.ERROR,'Please enter a Mobile number or Email ID to search duplicates');
            apexpages.addMessage(m1);
            
        }
        
  /// This if action is to hide the Save Button when below creteria meets ///    
  
        if(ld1 == true){
        Editlead=true;
    }  
        
    /*    for(lead lds:ldlist){
             if((lds.Status!= 'converted' || lds.Status!= 'prospect')&&(lds.Lead_Owner_Role__c!= 'Internal Sales Agent' || lds.Lead_Owner_Role__c!= 'Internal Sales Team Lead' || lds.Lead_Owner_Role__c!= 'Internal Sales Team Director')){
                Editlead=true;
                 
             }
        }  */
       
        
    }
    
    public pagereference save(){
        
        //// Need to update OwnerId field of particular record in lead object////
  		list<lead> updateLead = new list<lead>();
        lead ldown = new lead();
        integer NoOfCheckes = 0;
        for(lead ld:ldlist){
            if(ld.DUP_Update_Owner__c == true){
               NoOfCheckes++;
               UpdateLead.add(ld);
            }
        }
        if(UpdateLead.size()==1&& Noofcheckes == 1){
        	    UpdateLead[0].DUP_Update_Owner__c = false;
            	Update UpdateLead[0];
        }else{
            apexpages.Message m2=new apexpages.message(ApexPages.Severity.ERROR,'Please Select one Lead at a time only');
            apexpages.addMessage(m2);
        }
        
        pagereference p1=new pagereference('/'+(UpdateLead.size()>0?UpdateLead[0].id:null));
        p1.setRedirect(true);
        return p1;
        
    }
    
    
    public pagereference createLead(){
       
        pagereference cl1=new pagereference('/lightning/o/Lead/new');
        cl1.setRedirect(true);
        return cl1;
    }
    
}

Visualforce :
 
<!--
Developer : Azar khasim 
Created Date : 03 MAR 2020
Description : Global Duplicate Search. 
-->

<apex:page StandardController="Lead" extensions="GlobalDupSearch1">
    
    <apex:form >
        <apex:pageBlock id="block">
            <apex:pageMessages ></apex:pageMessages>
            <style>
                .custom1 .pbSubheader {
                background-color: #2E9AFE !important;
                }
            </style> 
            
            <center>
                <apex:pageBlockButtons location="bottom" > 
                    <apex:commandButton style="color:black;background-image:none;width:50px;height:30px"  action="{!save}" value="Save" rendered="{!Editlead=true}"/>
                </apex:pageBlockButtons>
            </center> 
            
            
            <!---------- Duplicate Search ---------------------------------------------------------------->            
            <apex:outputPanel layout="block" styleClass="custom1">
                <apex:pageBlockSection title="Find Dulicates" collapsible="false" >               
                    <center>
                        <apex:inputText value="{!pe}" id="search" html-placeholder="Search here"/><br/>
                        <apex:commandButton value="Search" action="{!search}" rerender="block"/>
                    </center>             
                    <center>
                        <apex:commandButton style="width:75px;height:25px"  action="{!createLead}" value="Create Lead" rendered="{!Createlead=true}"/>
                    </center>
                </apex:pageBlockSection>
            </apex:outputPanel>
            
            
            <!------------------------------------------------------------ Lead Data(No Converted and Prospect Data)  to Display ------------------------------------------------------------------------>   
       
            <apex:outputPanel layout="block" styleClass="custom1">
                <apex:pageBlockSection title="Lead" rendered="{!ld1 != false}" >
                    
                    <!-- Regarding the Boolean Value in Lead Object ---------------------------------------->       
                    <apex:pageBlockTable value="{!ldlist}" var="Leaddata" cellspacing="10">
                        
                        <apex:column style="width:100px" value="{!Leaddata.Name}" headerValue="Lead Name"/>
                        <apex:column style="width:100px" value="{!Leaddata.Status}" headerValue="Lead Status"/>
                        <apex:column style="width:100px" value="{!Leaddata.Owner.Name}" headerValue="Owner Name"/>
                        <apex:column style="width:100px" value="{!Leaddata.Lead_Owner_Role__c}" headerValue="Owner Role"/>
                        <apex:column style="width:100px" value="{!Leaddata.User_Mobile__c}" headerValue="Owner Mobile"/>
                        <apex:column style="width:100px" value="{!Leaddata.Owner.Email}" headerValue="Owner Email"/>
                        <!----- OwnerId Field in Lead Object ----------------------------------------------->      
                       
                        <apex:column >
                            <apex:facet name="header">New Lead Owner</apex:facet>
                              <apex:inputField value="{!Leaddata.ownerId}" required="false" rendered="{!IF((Leaddata.Lead_Owner_Role__c ='Internal Sales Agent'||Leaddata.Lead_Owner_Role__c ='Internal Sales Team Lead'||Leaddata.Lead_Owner_Role__c ='Internal Sales Team Director'),false,true)}"/>
                        </apex:column> 
                        <apex:column headerValue="Change Ownership" >
                            <apex:inputCheckbox value="{!Leaddata.DUP_Update_Owner__c}"  label="Change Ownership" rendered="{!If((Leaddata.Lead_Owner_Role__c ='Internal Sales Agent'||Leaddata.Lead_Owner_Role__c ='Internal Sales Team Lead'||Leaddata.Lead_Owner_Role__c ='Internal Sales Team Director'),false,true)}"/> 
                        </apex:column> 
                        
                    </apex:pageBlockTable>
                    
                </apex:pageBlockSection>
            
            </apex:outputPanel> 
          
            
            <!------------------------------------------------------------ Lead 2 Data(No New, Assigned, Followup and Junk Data)  to Display ------------------------------------------------------------------------>   
       
            <apex:outputPanel layout="block" styleClass="custom1">
                <apex:pageBlockSection title="SalesOwner leads" rendered="{!ld2 != false}" >
                    
                    <!-- Regarding the Boolean Value in Lead Object ---------------------------------------->       
                    <apex:pageBlockTable value="{!ldlist1}" var="lds" cellspacing="10">
                        
                        <apex:column style="width:100px" value="{!lds.Name}" headerValue="Lead Name"/>
                        <apex:column style="width:100px" value="{!lds.Status}" headerValue="Lead Status"/>
                        <apex:column style="width:100px" value="{!lds.Owner.Name}" headerValue="Owner Name"/>
                        <apex:column style="width:100px" value="{!lds.Lead_Owner_Role__c}" headerValue="Owner Role"/>
                        <apex:column style="width:100px" value="{!lds.User_Mobile__c}" headerValue="Owner Mobile"/>
                        <apex:column style="width:100px" value="{!lds.Owner.Email}" headerValue="Owner Email"/>
                        <!----- OwnerId Field in Lead Object ----------------------------------------------->      
                       
                    </apex:pageBlockTable>
                    
                </apex:pageBlockSection>
            
            </apex:outputPanel> 
          
            <!------------------------------------------------------- Opportunity Data  to Display ---------------------------------------------------------------------------->             
       
            <apex:outputPanel layout="block" styleClass="custom1">
                <apex:pageBlockSection title="Opportunity" rendered="{!opp1 != false}">
                    
                    <!--- Values to display in Opportunity Object---------------------------------------->
                    <apex:pageBlockTable style="width:150%" value="{!opplist}" var="opp"  cellspacing="10">

                        <apex:column style="width:100px" value="{!opp.name}" />  
                        <apex:column style="width:100px" value="{!opp.StageName}" headerValue="Opportunity Stage"/>
                        <apex:column style="width:100px" value="{!opp.owner.Name}" headerValue="Owner"/>  
                        <apex:column style="width:100px" value="{!opp.owner.UserRoleId}" headerValue="Owner Role"/>
                        <apex:column style="width:100px" value="{!opp.owner.MobilePhone}" headerValue="Owner Mobile"/>
                        <apex:column style="width:100px" value="{!opp.owner.Email}" headerValue="Owner Email"/>   
                        <!----- OwnerId Field in Lead Object ----------------------------------------------->      
                        
                    </apex:pageBlockTable>
                </apex:pageBlockSection>
            </apex:outputPanel>

            <!---------------------------------------------------------- Account Data  to Display ---------------------------------------------------------------------->             
    <!--     
            <apex:outputPanel layout="block" styleClass="custom1">
                <apex:pageBlockSection title="Account" rendered="{!ac1 != false}">  -->
 
                    <!--- Values to display in Account Object---------------------------------------->
               <!--     <apex:pageBlockTable style="width:150%" value="{!aclist}" var="ac"  cellspacing="10">
 
                        <apex:column style="width:100px" value="{!ac.Name}" />  
                        <apex:column style="width:100px" value="{!ac.owner.Name}" headerValue="Owner"/>
                        <apex:column style="width:100px" value="{!ac.owner.UserRoleId}" headerValue="Owner Role" />
                        <apex:column style="width:100px" value="{!ac.owner.MobilePhone}" headerValue="Owner Mobile"/>
                        <apex:column style="width:100px" value="{!ac.owner.Email}" headerValue="Owner Email"/>   
                        
                         
                    </apex:pageBlockTable>
                </apex:pageBlockSection>
            </apex:outputPanel>  -->
            
            <!------------------------------------------------------------- Contact Data  to Display --------------------------------------------------------------------->             
         
            <apex:outputPanel layout="block" styleClass="custom1">
                <apex:pageBlockSection title="Account / Contact" rendered="{!cn1 != false}">

                    <!---  Values to display in Contact Object-------------------------------------------->
                    <apex:pageBlockTable style="width:150%" value="{!cnlist}" var="con"  cellspacing="10">

                        
                        <apex:column style="width:100px" value="{!con.Name}" />  
                        <apex:column style="width:100px" value="{!con.owner.Name}" headerValue="Owner"/>  
                        <apex:column style="width:100px" value="{!con.owner.UserRoleId}" headerValue="Owner Role"/>
                        <apex:column style="width:100px" value="{!con.owner.MobilePhone}" headerValue="Owner Mobile"/>
                        <apex:column style="width:100px" value="{!con.owner.Email}" headerValue="Owner Email"/> 
                        
                         
                    </apex:pageBlockTable>
                </apex:pageBlockSection>
            </apex:outputPanel> 
            
            <!-------- End of logics ------------------------------------------------------------------------------->     
        </apex:pageBlock>
    </apex:form>
</apex:page>

Now i need to create a List Button On Lead List Page.
to access this Vf page.

Please provide me a solution.

Thanks and Regards,
Azar Khasim.
want to make a dynamic url? for page reference to lead edit page in VF Page!

My PageReference Code:

 public pagereference createLead(){
       
        pagereference cl1=new pagereference('/lightning/o/Lead/new?count=1&nooverride=1&useRecordTypeCheck=1&navigationLocation=MRU_LIST&backgroundContext=%2Flightning%2Fo%2FLead%2Flist%3FfilterName%3DRecent');
        cl1.setRedirect(true);
        return cl1;
    }

Please give me a solution for this URL to be dynamic.

Thanks and Regards,
Azar Khasim.
Hello Everyone,
Need help in creation of validation rule.

When Lead Owner is Call Center Agent and Inbound Call checkbox is false you(Call Center Agent) cannot edit Source, Lead Source, Channel Source Fields.

Lead Owner Role: Call Center Agent
Lead Field : Inbound_Call__c
Lead Fields not to get update when Inbound_Call__c is false and Owner Role is Call Center Agent.


Lead Fields not to get update.

Channel :    Channel__c(Picklist) 
Source :      Source__c(Picklist) Dependent on Channel.
Campaign Source: DC_Campaign_Source__c(Picklist)Dependent on Source
Lead Source :   DC_Lead_Source__c(Picklist) Dependent on                                          Campaign Source


Validation Rule is required to show a message that
if
Lead Owner role is Call Center Agent
Field Inbound_Call__c is false
then you(Call Center Agent) cant update these fields.


Please help me for this Validation rule.

Thanks and Regards,
Azar Khasim.
 
Hello Everyone,

I need to write a batch class in which the criteria.

A Batch Class in Object Lead.
When a lead is unassigned for 1 hour from created date/time then
the lead has to be assigned to a queue(Queue has two Users).


API Names 
Lead             --- Lead
Lead Owner --- OwnerId
Users Name ---  Priya
                           Azar
Queue Name -- PA_System_Administrator.

Please help me with a solution.

Thanks and Regards,
Azar Khasim.
Hello Everyone,

Here I need some criteria to add to my existing code. i.e..,
We have 
Opportunity object
Project object.

In Project, we have two record types.
1. Project Template 
2.Interior Works Project.

In Project Template we have three records(We call them as templates)
A Checkbox field called Default Project Template is true in any one of the records.


Now as per current business 

Whenever Opportunity is Closedwon 
A need project is getting created.

(A New project is creating like in below
When oppty is closedwon
in Project Template record type on of the record has default project template checkbox is true, then we are cloning that record and creating as a new project in Other record type-- Interior Works Project )


Now my new criteria is 
I have created three checkboxes in Opportunity when I select 1st checkbox and make oppty closedwon then first update the default project template checkbox of the first record in the project has to get an update and then clone operation has to be performed.


Here below is my Code in Apex Class:

public class ProjectManagementUtility {
    public static List<Milestone1_Project__c> cloneProject(List<Opportunity> oppts) {
        Decimal [] lProjectValues = new List<Decimal>();
        DateTime [] lSignUpDatesOfProjects = new List<DateTime>();
        
        List<Opportunity> oppList  = [SELECT id, name, Account.Name, AccountId,Region__c, Amount, Designer__c, Offer_and_Discounts__c, CloseDate, Meeting_Venue__c, 
                                      Customer_ID__c, Enquiry_ID__c, OwnerId, Signup_Amount__c,Insert_60_days_Project_Milestones__c,Insert_90_days_Project_Milestones__c,
                                      Insert_120_days_Project_Milestones__c,(SELECT ContentDocumentId, Visibility, ShareType FROM ContentDocumentLinks),
                                      (SELECT id FROM Projects__r) FROM Opportunity WHERE Id IN :oppts];
        
        for(Opportunity lOpp : oppList) {
            lProjectValues.add(lOpp.Amount);
            lSignUpDatesOfProjects.add(DateTime.newInstance(lOpp.CloseDate, Time.newInstance(10, 0, 0, 0)));
        }
        
        
        return cloneProject(oppts, lSignUpDatesOfProjects, lProjectValues);
    }
    
    public static List<Milestone1_Project__c> cloneProject(List<Opportunity> oppts, DateTime [] aSignUpDatesOfProjects, Decimal [] aProjectValues) {
        List<Milestone1_Project__c> newProjs = new List<Milestone1_Project__c>();
        List<Milestone1_Milestone__c> newmiles = new List<Milestone1_Milestone__c>();
        List<Milestone1_Milestone__c> updatedMiles = new List<Milestone1_Milestone__c>();
        Map<Id,List<Milestone1_Milestone__c>> mapNewmiles = new Map<Id,List<Milestone1_Milestone__c>>();
        
        List<Opportunity> oppList  = [SELECT id, name, Account.Name, AccountId,Region__c, Amount, Designer__c, Offer_and_Discounts__c, CloseDate, Meeting_Venue__c, 
                                      Customer_ID__c, Enquiry_ID__c, OwnerId, Signup_Amount__c,Insert_60_days_Project_Milestones__c,Insert_90_days_Project_Milestones__c,
                                      Insert_120_days_Project_Milestones__c,(SELECT ContentDocumentId, Visibility, ShareType FROM ContentDocumentLinks),
                                      (SELECT id FROM Projects__r) FROM Opportunity WHERE Id IN :oppts];
        
        Map<Id, Opportunity> oppMap = new Map<Id, Opportunity>(oppList);
        
        Milestone1_Project__c proj = [SELECT Id, Name, Project_Duration_in_days__c, Offers_and_Discounts__c,Total_Hours_Budget__c,
                                      Total_Expense_Budget__c, First_Cut_Presentation_Date__c, X3D_Presentation_Date__c, Design_Finalization_Date__c FROM Milestone1_Project__c 
                                      WHERE Default_Template_Project__c = true LIMIT 1];
        
        if(proj != NULL) {
            Integer lIndex = 0;
            Id projRecordTypeId = Schema.SObjectType.Milestone1_Project__c.getRecordTypeInfosByDeveloperName().get('Interior_Works_Project').getRecordTypeId();
        
            for(Opportunity opp : oppList) {
                if(opp.Projects__r.size() > 0) {
                    continue;
                }
                
                DateTime  lProjectStartDate = aSignUpDatesOfProjects[lIndex];
                Milestone1_Project__c projCopy = proj.clone(false,true);
                projCopy.RecordTypeId = projRecordTypeId;
                projCopy.Name = 'DC - ' + opp.Account.Name + ' - ' + opp.Customer_ID__c;
                
                if(String.isNotBlank(opp.Meeting_Venue__c)) {
                    projCopy.Name += ' - ' + opp.Meeting_Venue__c;
                }
                
                projCopy.Customer__c = opp.AccountId;
                projCopy.Amount__c = aProjectValues[lIndex];
                projCopy.Opportunity__c = opp.id;
                projCopy.Enquiry_ID__c = opp.Enquiry_ID__c;
                projCopy.Signup_Amount__c = opp.Signup_Amount__c;
                projCopy.REGION__c = opp.Region__c;
                projCopy.Offers_and_Discounts__c=opp.Offer_and_Discounts__c;
                projCopy.Kickoff__c = lProjectStartDate.Date();
                System.debug('^^^ ' + projCopy.Project_Duration_in_days__c);
                
                projCopy.Deadline__c = lProjectStartDate.Date() + Integer.valueOf(projCopy.Project_Duration_in_days__c);
                projCopy.Survey_Date__c = lProjectStartDate + 2;
                projCopy.KYC_Date__c = lProjectStartDate + 7;
                projCopy.First_Cut_Presentation_Date__c = lProjectStartDate + 12;
                projCopy.X3D_Presentation_Date__c = lProjectStartDate + 31;
                projCopy.Kickoff_Meeting_Date__c = lProjectStartDate + 47;
                projCopy.Design_Finalization_Date__c = lProjectStartDate + 21;
                newProjs.add(projCopy);
                lIndex++;
            }
            
            if(newProjs.size() > 0) {
                insert newProjs;
            }
            
            Id milesRecordTypeId = Schema.SObjectType.Milestone1_Milestone__c.getRecordTypeInfosByDeveloperName().get('Project_Milestone').getRecordTypeId();
            List<Milestone1_Milestone__c> miles = [SELECT Id, Name, Type__c, EligibleAmountPercentage__c, Project__c, Assign_To_Role__c, Hours_Budget__c, 
                                                   MilestoneTemplateSFID__c,Predecessor_Milestone__c,Successor_Milestone__c,Expense_Budget__c,Description__c,
                                                   Collectable_Amount_Percent_Before_This__c, Order__c,
                                                   Previous_Payment_Milestone__c,Relative_Deadline_in_days__c,Relative_Kickoff_Date_in_days__c FROM Milestone1_Milestone__c 
                                                   WHERE Project__c = : proj.Id];
            
            if(miles != null && miles.size() > 0) {
                for(Milestone1_Project__c p : newProjs) {
                    List<Milestone1_Milestone__c> projMile = mapNewmiles.get(p.id);
                    
                    if(projMile == null) {
                        projMile = new List<Milestone1_Milestone__c>();
                        mapNewmiles.put(p.id, projMile);
                    }
                    
                    for(Milestone1_Milestone__c mile : miles) {
                        Milestone1_Milestone__c mileCopy = mile.clone(false,true);
                        mileCopy.RecordTypeId = milesRecordTypeId;
                        mileCopy.Name = mileCopy.Name.replaceAll('TEMPLATE - ', ''); 
                        mileCopy.MilestoneTemplateSFID__c = mile.Id;
                        mileCopy.Milestone_Template_PredecessorSFID__c = mile.Predecessor_Milestone__c;
                        mileCopy.Milestone_Template_SuccessorSFID__c = mile.Successor_Milestone__c;
                        mileCopy.Milestone_Template_Prev_Payment_SFID__c = mile.Previous_Payment_Milestone__c;
                        mileCopy.Project__c = p.Id;
                        mileCopy.Assign_To_Role__c =  mile.Assign_To_Role__c;
                        mileCopy.Type__c = mile.Type__c;
                        mileCopy.Kickoff__c = p.Kickoff__c + Integer.valueOf(mileCopy.Relative_Kickoff_Date_in_days__c);
                        mileCopy.Deadline__c = p.Kickoff__c + Integer.valueOf(mileCopy.Relative_Deadline_in_days__c);
                        mileCopy.Customer__c = p.Customer__c;
                        mileCopy.EligibleAmountPercentage__c = mile.EligibleAmountPercentage__c; 
                        newmiles.add(mileCopy);
                        projMile.add(mileCopy);
                    }
                }
                
                if(newmiles.size() > 0) {
                    insert newmiles;
                }
                
                Map<String, ID> MilesPredRef = new Map<String, ID>();
                
                for(Milestone1_Milestone__c mile : newmiles) {
                    MilesPredRef.put(mile.MilestoneTemplateSFID__c + '' + mile.Project__c, mile.Id);
                }
                
                Set<ID> lDupeCheckerSet = new Set<ID>();
                
                for(Milestone1_Project__c p : newProjs) {
                    for(Milestone1_Milestone__c lmile : mapNewmiles.get(p.id)) {
                        if(lmile.Milestone_Template_PredecessorSFID__c != null) {
                            lmile.Predecessor_Milestone__c = MilesPredRef.get(lmile.Milestone_Template_PredecessorSFID__c + '' + lmile.Project__c);
                            
                            if(!lDupeCheckerSet.contains(lmile.id)) {
                                lDupeCheckerSet.add(lmile.id);
                                updatedMiles.add(lmile);
                            }
                        }
                        
                        if(lmile.Milestone_Template_SuccessorSFID__c != null) {
                            lmile.Successor_Milestone__c = MilesPredRef.get(lmile.Milestone_Template_SuccessorSFID__c + '' + lmile.Project__c);
                            
                            if(!lDupeCheckerSet.contains(lmile.id)) {
                                lDupeCheckerSet.add(lmile.id);
                                updatedMiles.add(lmile);
                            }
                        }
                        
                        if(lmile.Milestone_Template_Prev_Payment_SFID__c != null) {
                            lmile.Previous_Payment_Milestone__c = MilesPredRef.get(lmile.Milestone_Template_Prev_Payment_SFID__c + '' + lmile.Project__c);

                            if(!lDupeCheckerSet.contains(lmile.id)) {
                                lDupeCheckerSet.add(lmile.id);
                                updatedMiles.add(lmile);
                            }
                        }
                    }
                }
                
                update updatedMiles;
                Map<String, ID> MilesRef = new Map<String, ID>();
                
                for(Milestone1_Milestone__c mile : newmiles) {
                    MilesRef.put(mile.MilestoneTemplateSFID__c+''+mile.Project__c, mile.Id);
                }
            }  
            
            if(newProjs.size() > 0) {
                ContentDocumentLink contDocLink;
                List<Project_Team_Member__c> ptms = new List<Project_Team_Member__c>();
                List<ContentDocumentLink> cdls = new List<ContentDocumentLink>();
                
                for(Milestone1_Project__c p : newProjs){
                    ptms.add(new Project_Team_Member__c(Role__c = 'Primary Designer', User__c =  oppMap.get(p.Opportunity__c).Designer__c, Project__c = p.Id));
                    ptms.add(new Project_Team_Member__c(Role__c = 'Sales Executive', User__c =  oppMap.get(p.Opportunity__c).OwnerId, Project__c = p.Id));
                    
                    for(ContentDocumentLink cdl : oppMap.get(p.Opportunity__c).ContentDocumentLinks) {
                        contDocLink = new ContentDocumentLink();
                        contDocLink =  cdl.clone();
                        contDocLink.LinkedEntityId = p.Id;
                        cdls.add(contDocLink);
                    }
                }
                
                if(ptms!= null && ptms.size() > 0) {
                    insert ptms;
                }
                
                if(cdls != null && cdls.size() > 0) {
                    insert cdls;
                }
            }
        }
        
        return newProjs;
    }
}

Please give me some solution for this.

Thanks and Regards,
Azar Khasim.
Hello Everyone,

I need help with my requirements.

Need help in writing a trigger between Opportunity and Project(Custom Object) to create Project wit specified Template(Record).

I have three objects.
Opportunity (Three Checkboxes)(Temp 60, Temp 90, Temp 120)
      ||
Project (Record Type -- ST Templates) Records(Temp 60, Temp 90, Temp 120)
      ||
MIlestones


criterias..,

1. When the Opportunity Stage is ClosedWon, create a Project.
2. The opportunity has three checkboxes names
    (Three Checkboxes -- Temp 60, Temp 90, Temp 120)
3. The project has Record Type as (Record Type -- DC Project Templates)
   These are the ST templates (Means records in Project Object with Record Type -- DC Project Templates) -- Temp 60, Temp 90, Temp 120.

Now, Whenever Opportunity is ClosedWon and Checkbox Temp 60 is true.
Create a New Project with Selecting Temp60 as the default template for Project because Temp 60 has Child Records(28 Milestones in Milestones Object.)



Please Help me in providing a trigger for two objects.

Trigger :
Opportunity Stage:  ClosedWon && Temp 60 Checkbox is true 
Create a Project with  Dc Project Template (Temp 60) as default.

If I select Temp 60 checkbox in Opportunity Temp 60 Record from Project is to be the default. Because of Every Template(Record) in the DC Project Template as a certain number of unique Child Records.

If I select Temp 90 checkbox in Opportunity Temp 90 Record from Project is to be the default. Because of Every Template(Record) in the DC Project Template as a certain number of unique Child Records.

If I select Temp 120 checkbox in Opportunity Temp 120 Record from Project is to be the default. Because of Every Template(Record) in the DC Project Template as a certain number of unique Child Records.


Please Provide me the trigger for this scenario.

Thanks and Regards,
Azar Khasim.



 
Hello Guys,

I need help in writing a test class for the below trigger.

trigger AccountNameUpdate on Booking_Link__c (before insert, before update) {
    List<Account> accountList = new List<Account>();
    String CustomNumber;
    for(Booking_Link__c bl : Trigger.new)
    {       
        CustomNumber = bl.Customer_Number__c;
       
    }
    accountList = [Select Id, OwnerId, Customer_Number__pc from Account where Customer_Number__pc =:CustomNumber ];
    for(Booking_Link__c bl : Trigger.new)
    {
        for(Account a : accountList)
        {
           if(bl.Customer_Number__c == a.Customer_Number__pc && bl.T2G__c==True)
            {
                bl.Account__c = a.Id;
                bl.OwnerId = a.OwnerId;
                  
            }
        }
    }  
}

*********************************************************************
My test Class which got 0% code coverage.
***********************************************************************
@isTest
public class AccountNameUpdate {  
  @isTest  static void updateAccount(){
        Account a = new Account();
        a.Name = 'Abhishek Gupta';
        insert a;
        Booking_Link__c bl= new Booking_Link__c();
        bl.Customer_Number__c = a.Customer_Number__pc;
        bl.T2G__c =True;
        bl.Account__c = a.Id;
        bl.OwnerId = a.OwnerId;
        update bl;
    }

}

*************************************************
Help me out from this...
Azar Khasim.
Hello Guys,

I need some help regarding writing a test class for the below controller class for a VF page.

Here is my Controller Class

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 Accept(){
        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 help me out from this...,

Thanks and Regards,
Azar Khasim.
Hello All,

I need some help in writing a Test Class for the below Trigger.

My Trigger:
********************************************************************************
trigger AccountNameUpdate on Booking_Link__c (before insert, before update) {
    List<Account> accountList = new List<Account>();
    String CustomNumber;
    for(Booking_Link__c bl : Trigger.new)
    {       
        CustomNumber = bl.Customer_Number__c;
       
    }
    accountList = [Select Id, OwnerId, Customer_Number__pc from Account where Customer_Number__pc =:CustomNumber ];
    for(Booking_Link__c bl : Trigger.new)
    {
        for(Account a : accountList)
        {
           if(bl.Customer_Number__c == a.Customer_Number__pc && bl.T2G__c==True)
            {
                bl.Account__c = a.Id;
                bl.OwnerId = a.OwnerId;
                bl.Mobile__c = bl.Mobile__c;
                bl.Alternate_Mobile__c= bl.Alternate_Mobile__c;
                bl.Phone__c= bl.Phone__c;
                bl.Home_Phone__c= bl.Home_Phone__c;
                bl.Other_Phone__c= bl.Other_Phone__c;
            }
        }
    }  
}
********************************************************************************

Please Help me with this requirement.

Thanks and Regards,
Azar Khasim.
Hello Everyone,

Here is my requirement is i have created a Visualforce page and i need the page to convert into Lightning View by using SLDS and i have done the work of it.

But while using the Visualforce Page in Sites  the visualforce page is not viewing in Lightning mode and it was showing in Classic Mode.

Here Below is my VF Page:
*****************************************************************************

<apex:page controller="BookingController" lightningStylesheets="true">
     <html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" lang="en">
    <head>
      <meta charset="utf-8" />
      <meta http-equiv="x-ua-compatible" content="ie=edge" />
      <title>SLDS ResponsiveDesign Visualforce Page in Salesforce Mobile</title>
      <meta name="viewport" content="width=device-width, initial-scale=1" />

       <!-- Import the Design System style sheet -->
       <apex:slds />
    </head>
    <body>

      <!-- REQUIRED SLDS WRAPPER -->
      <div class="slds-scope">

        <!-- PRIMARY CONTENT WRAPPER -->

          <!-- RESPONSIVE GRID EXAMPLE -->
    <style>
        body {
        
        background-image: url("https://bren--c.ap5.visual.force.com/resource/1528783675000/repeatlatestlogo");
        background-repeat:repeat;
        }
        
    </style>       
    <apex:form >
        <apex:slds />
        <style>
            body .bPageBlock .pbBody .fontcolor .pbSubheader h3{
            color:#000;
            }
        </style>
        <apex:sectionHeader title="Bren Online Booking Form" /> 
        <apex:pageBlock rendered="{!isboolean}" >    
            <apex:pageBlockButtons location="bottom">
                <font size="3" style="color:red"><b>NOTE : After clicking on Save button, No further changes can be done.</b> </font>
                <apex:commandButton styleClass="slds-button slds-button_success" action="{!save}" value="Save"  />
                <apex:commandButton styleClass="slds-button slds-button_destructive" action="{!cancel}" value="Cancel"  />
            </apex:pageBlockButtons>
            <center>
            <font size="5" style="color:blue" ><b>Welcome to Bren Online Booking Portal</b> </font>
            </center>
            <center>
                 <font size="3" style="color:red" ><b>Please start by inserting your customer number as in the email.</b> </font>
                </center>
            <apex:outputPanel styleClass="fontcolor" layout="blue">
                <apex:pageBlockSection title="Customer Number" collapsible="false"  columns="1">
                    <apex:inputField required="true" value="{!booking.Customer_Number__c}"/>
                   
                </apex:pageBlockSection>    
                <apex:pageBlockSection title="First Applicant Details"  collapsible="false" columns="2" > 
                    <apex:inputField style="color:blue" required="true" value="{!booking.Salutation__c}"/>
                    <apex:inputField style="color:blue" required="true" value="{!booking.Pan_Number__c}"/>
                    <apex:inputField style="color:blue" required="true" value="{!booking.First_Name__c}"/>
                    <apex:inputField style="color:blue" required="true" value="{!booking.Aadhar_Number__c}"/>
                    <apex:inputField style="color:blue" required="true" value="{!booking.Last_Name__c}"/>
                    <apex:inputField style="color:blue" required="true" value="{!booking.Mobile__c}"/>                    
                    <apex:inputField style="color:blue" required="true" value="{!booking.Gender__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Alternate_Mobile__c}"/> 
                    <apex:inputField style="color:blue" required="true" value="{!booking.Relation__c}"/>
                    <apex:inputField style="color:blue" required="true" value="{!booking.Date_Of_Birth__c}"/>
                    <apex:inputField style="color:blue" required="true" value="{!booking.Father_Husband__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Wedding_Anniversary__c}"/>
                    <apex:inputField style="color:blue" required="true" value="{!booking.Email__c}"/>  
                </apex:pageBlockSection>
                <apex:pageBlockSection title="Professional Information" collapsible="false" columns="2">
                    <apex:inputField style="color:blue" required="true" value="{!booking.Designation__c}"/>
                    <apex:inputField style="color:blue" required="true" value="{!booking.Professional_Email__c}"/>
                    <apex:inputField style="color:blue" required="true" value="{!booking.Employed_by__c}"/>
                     <apex:inputField style="color:blue" value="{!booking.Office_State__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Office_Street__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Office_Country__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Office_City__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Office_PinCode__c}"/>
                </apex:pageBlockSection>
                <apex:pageBlockSection title="Permanent Address Information" collapsible="false" columns="1">   
                    <apex:inputField style="color:blue" required="true" value="{!booking.ShippingStreet__c}"/>
                    <apex:inputField style="color:blue" required="true" value="{!booking.Shipping_City__c}"/>
                    <apex:inputField style="color:blue" required="true" value="{!booking.ShippingState__c}"/>
                    <apex:inputField style="color:blue" required="true" value="{!booking.ShippingCountry__c}"/>
                    <apex:inputField style="color:blue" required="true" value="{!booking.Shipping_PinCode__c}"/>
                </apex:pageBlockSection>
                <apex:pageBlockSection title="Correspondence Address Information" collapsible="false" columns="1">   
                    <apex:inputField style="color:blue" value="{!booking.BillingStreet__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Billing_City__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.BillingState__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.BillingCountry__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Billing_PinCode__c}"/>
                </apex:pageBlockSection>
                <apex:pageBlockSection title="Children School Address" collapsible="false" columns="2" >
                    <apex:inputField style="color:blue" value="{!booking.Children_School_Name__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Children_School_State__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Children_School_Street__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Children_School_Country__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Children_School_City__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Children_School_PinCode__c}"/>  
                </apex:pageBlockSection>
                
                <apex:pageBlockSection title="Second Applicant Details" collapsible="false" columns="2">
                    <apex:inputField style="color:blue" value="{!booking.Salutation_Second_Applicant__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Date_of_Birth_Second_Applicant__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.First_Name_Second_Applicant__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Pan_Number_Second_Applicant__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Last_Name_Second_Applicant__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Aadhar_Number_Second_Applicant__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Gender_Second_Applicant__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Mobile_Second_Applicant__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Relation_Second_Applicant__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Email_Second_Applicant__c}"/>
                    <apex:inputField style="color:blue" value="{!booking.Father_Husband_Second_Applicant__c}"/>
                </apex:pageBlockSection>
                   
                
                <table border="2" width="1000"  HEIGHT="500" cellspacing="0">
                    <th style='color: #0000A0;' align="center">TERMS OF ALLOTMENT</th>  
                    
                    
 
                    <body style="font-size: 14px;">
                        
                        
                        
                        <tr ><td colspan="3">1. Allotment / Booking is at the sole discretion of Bren Corporation.</td> </tr>  
                        <tr ><td colspan="3">2. Allottee shall not re-negotiate / bargain with the agreed price once the Allotment is confirmed. </td> </tr>        
                        <tr ><td colspan="3">3. Allotment will be confirmed only after the realization of the Booking Advance Amount.</td> </tr>        
                        <tr ><td colspan="3">4. Allottee on confirmation of Allotment shall within 30 Days sign and execute Agreement of Sale as per the Format supplied by Bren Corporation and shall pay
                            the outstanding amount/due amount as per the time line/payment schedule mentioned therein.</td> </tr>        
                        <tr ><td colspan="3">5.Failing to sign and execute Agreement of Sale within 30 days as per the Format supplied by the Bren Corporation, the Allotment shall be treated as cancelled without
                            any further notice to the Allottee.</td> </tr>        
                        <tr ><td colspan="3">6. On Cancellation of the Booking for any reason by the Allottee including the cancellation as per para-5 above,  Bren Corporation shall be entitled to deduct 
                            Rs.50,000 /-(Rupees Fifty Thousand only) from the Booking amount and the balance if any shall be refunded to the Allottee within 60 Days of such Cancellation without
                            any interest.</td> </tr>        
                        <tr ><td colspan="3">7. If the Allottee is availing housing finance from any of the Financial Institutions/Banks/NBFCs, it is the sole responsibility of the Allottee to avail finance from such
                            Banks/Financial Institutions/NBFCs. However, Bren Corporation will provide such documentation as may be required. Failure to obtain Loans from such Banks, shall not be
                            a ground for withdrawal / Cancellation of booking.</td> </tr>        
                        <tr ><td colspan="3">8.  In case any payments are delayed, the Allottee shall be liable to pay the interest as per the Agreement of Sale and if the delay persists, Bren Corporation is entitled 
                            to terminate the Agreement/Booking.</td> </tr>
                        <tr><td colspan="3">9. The Allottee shall be liable and responsible to pay the GST and / or any other taxes / statutory payments that would be applicable on the transaction.</td></tr>
                        <tr><td colspan="3">10. Allottee shall also be liable and responsible to deduct TDS as required under IT Act on the amount payable to Bren Corporation and shall submit the proof of such 
                            deduction within 7 working days of such deduction.</td></tr>
                        <tr><td colspan="3">11. The Allottee shall not be entitled to shift / cancel / transfer the Booking to any other person(s) without the written consent of Bren Corporation.</td></tr>
                        <tr><td colspan="3">12. All payments needs to be made in favour of BREN CORPORATION by way of Demand Drafts / Cheques / Wire Transfers.</td></tr>
                        <tr><td colspan="3">13. Allottee shall be liable and responsible to pay the Stamp Duty, Registration Charges as may be applicable on the Agreement of Sale and the Sale Deed.</td></tr>
                        <tr><td colspan="3">14. The Booking shall be subject to the exclusive Jurisdiction of Bangalore City.</td></tr>
                        <tr><td colspan="3">15. Booking is subject to rate approval / cheque realization.</td></tr>
                        
                    </body></table>
                <font size="2" style="color:red"><b>DECLARATION :
                    
                    I / WE the Applicant/s do hereby declare that the above-mentioned particulars / information given by me / us are true and genuine to my / our best knowledge and the same are irrevocable. 
                    I / WE also declare the booking terms referred to above at SL.No.1 to 14 are read over to me / us and I / WE, after understanding the said conditions are willing to book the Apartment noted above.
                    I / We also declare that Bren Corporation has not induced / misrepresented to me / us while sharing the information about the project and / or the Unit I am / we are booking.
                    I / WE also declare that in the event of non-allotment of the Apartment which we booked, my / our claim would be limited to the booking amount only
                    </b> </font>           
            </apex:outputPanel>
        </apex:pageBlock>
        <apex:pageBlock rendered="{!booleans}">
            <apex:outputText >
                <center>
                    <font size="5" style="color:blue" ><b>Bren Corporation</b> </font>
                </center>
                <center>
                    <font size="5" style="color:black"><b> Thank you for submitting your personal details. The Sales Executive will shortly reach out to you.</b> </font>  
                </center> 
            </apex:outputText>
        </apex:pageBlock>
    </apex:form>
           <!-- / RESPONSIVE GRID EXAMPLE -->
      </div>
    </body>
  </html>
</apex:page>
********************************************************************************
Class Controller:
*************************************************************************
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();
    }
     
}


Help me out with a solution.

Thanks and Regards,
Azar Khasim.
Hello Guys,

Actually i have done some Testing of the API Link in POSTMAN Tool whether is it working fine or not, Thus the API Link is working and it is pulling the leads for Salesforce.

Now i am in major part is writing Apex Rest Callouts and Apex Test class for it.

Here i have 
Start Date  ----------- Epoch Converter
End Date  ------------ Epoch Converter
Current Time--------- Epoch Converter
HASH ------- (SHA 256)  UTF-16
hash = %%=SHA256('Insert Text Here','UTF-16')=%%
and
ID 
by using the above Parameters.
I need to write the Callouts and Test Class for it.
GET -- Method,
PUSH -- Integration.

Can anyone please help me from thiss...,


Here is my  Sample code which i have written till now.
****************************************************************************
public class **************Callouts {
 public void getData(Date start_date,Date end_date,Date current_time){
        ***************__mdt data =[select UserName__c,Password__c,url__c from *************__mdt ];
        Http h = new Http();
        HttpRequest req = new HttpRequest();
        request.setEndpoint(data.url__c);
        request.setMethod('POST');
        
     hash = %%=SHA256('Insert Text Here','UTF-16')=%%
        request.setBody(body);
        HttpResponse res = h.send(req);
        result=res.getBody();
        system.debug('result----'+result);
        system.JSONParser jp=json.createParser(result);
 }
     public void invoke(){
        string endpoint= 'https://leads.housing.com/api/v0/get-builder-leads?start_date=&end_date=&current_time=&hash=&id=';
        system.debug('endpoint===='+endpoint);
        http h =new http();
        httpRequest request=new httpRequest();
        request.setEndpoint(endpoint);
        request.setMethod('GET');
        request.setHeader('Authorization','OAuth'+hash);
        system.debug(request.getHeader('Authorization'));
        httpResponse response=h.send(request);
        system.debug('response===='+response);
        result=response.getBody();
    }
     
}

********************************************************************************

Please Help me out from thisss...,

Thanks and Regards,
Azar Khasim.
Hi All,

I have a Booking Link(Custom Object) and Account Object. There is a relation between both of them using Lookup. and i had a field called Customer Number in Accounts. 

By using Sites i am storing a record which contains Customer number as one of the field in that record in BookingLink Object.
Now By using this Customer Number i need to update the Account Name and Owner of that Customer Number(Which already had a record in Account object).

Please help me out from thiss.

""When ever a Record is created in BookingLink Object, by using Customer Number it need to update the Account name and Owner of the record"". 

Thanks and Regards,
Azar Khasim.
I have a Booking Link(Custom Object) and Account Object. There is a relation between both of them using Lookup. and i had a field called Customer Number in Accounts. 

By using Sites i am storing as a record which contains Customer number as one of the field in that record in BookingLink Object.
Now By using this Customer Number i need to update the Account Name and Owner of that Customer Number(Which already had a record in Account object).


Please help me out from thiss.

""When ever a Record is created in BookingLink Object, by using Customer Number it need to update the Account name and Owner of the record"". 
I have a Booking Link(Custom Object) and Account Object. There is a relation between both of them using Lookup. and i had a filed called Customer Number in Accounts. 

By using Sites i am storing as a record which contains Customer number as one of the field in that record in BookingLink Object.
Now By using this Customer Number i need to update the Account Name and Owner of that Customer Number(Which already had a record in Account object).


Please help me out from thiss.

""When ever a Record is created in BookingLink Object by using Customer Number it need to update the Account name and Owner of the record""
I was facing some error while using this visualforce page with adding Rendered as PDF. Please Help me out.

VF Page:

<!-- RecieptForMail -->
<apex:page standardController="Reciept__c"   extensions="Reciepts" showHeader="false" applyBodyTag="true" applyHtmlTag="true" renderAs="pdf">
    <apex:form >
        <div style="font-size:13px;">
        <center>
        <h2 style="color:green;">
            Receipt
        </h2>
            </center>
           <img src="https://bren--c.ap5.visual.force.com/resource/1523623530000/BrenLogo" width="150" height="60"/>
           <br/>
        
            
        
        <div align="right">
             #61,Bren Balavana Koramangala,<br/>
             5th 'A' Block,Bangalore 560095<br/>
             Tool free : 18001028800
        </div><br/><br/>
        <b><br/>
            RECEIVED WITH THANKS FROM :<br/><br/>
            
        </b>
        <b>{!ua.emtcustomername__c}&nbsp;{!coownerName}</b><br/>
        {!ua.DMNCustomerStreet__c}<br/>
         {!ua.DMNCustomercity__c}<br/>
         {!ua.DMNCustomerstate__c}<br/>
        {!ua.DMNCustomercountry__c}-{!ua.DMNCustomerpostalcode__c}<br/><br/>
        <b>
           THE SUM OF {!wordText}<br/>
            VIDE Wire Transfer No.{!rc.InstrumentNumber__c} DATED &nbsp;  <apex:outputText value="{0,date,dd'/'MM'/'yyyy}">    
                            <apex:param value="{!rc.InstrumentDate__c}" /> 
            </apex:outputText>&nbsp; DRAWN ON {!rc.DrawnonBank__c}<br/></b>
            {!ua.unit__R.name} &nbsp; {!ua.project__R.name}<br/>
            On A/c of {!rc.CRMComments__c} payment of purchase price of Unit Number {!ua.unit__r.name}, 
            Block No {!ua.Block__r.name} at {!ua.project__r.name}. <br/><br/>
          
   <table border="1" cellspacing="0" align="left">
       <tr>
       <td width="190" height="40" style="font-size:15px;">
    Rs.
    <apex:outputText value="{0,number,###,###.00}">
                        <apex:param value="{!rc.Amount__c}" />
                    </apex:outputText>
     
       </td>
           </tr>
        </table>
        <div align="right">
            <b>
                {!ua.project__r.Legal_Entity__c}   <br/><br/>
                Authorised signatory
                </b>
        </div><br/>
        
          <div style="font-size:10px;">  Payments by Cheque are subject to realisation</div>
             <div style="font-size:8px;" align="center"> <span style="color:#848484"> Customer Copy</span></div>
        <hr/> 
      

 </div>
    </apex:form>
</apex:page>

 
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.
I am working on Sites and have created a VisualForce Page on Custom Object (Booking Link). While using Visualforce Page in Preview it was creating a record,  But While using the same Visualforce Page in Site the data was not getting stored in Custom Object(Booking Link).

Please Help me out from this...

My Visualforce Page Code:

<apex:page controller="BookingController">
    <apex:form >
        <apex:sectionHeader title="Person Customer Edit" subtitle="New Customer"/>
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <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:form>
</apex:page>

Controller Class:

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

Please give me a solution for this...
I just want a Controller Class for the Below Visualforce Page.
Please Help me in it.

Here below is my VF Page.


<apex:page controller="Booking_Link__c">
    <apex:form >
        <apex:sectionHeader title="Person Customer Edit" subtitle="New Customer"/>
        <apex:pageBlock >
            <apex:pageBlockButtons >
                <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 link__c.Name}"/>
                <apex:inputField value="{!booking link__c.Salutation__c}"/>
                <apex:inputField value="{!booking link__c.First_Name__c}"/>
                <apex:inputField value="{!booking link__c.Middle_Name__c}"/>
                <apex:inputField value="{!booking link__c.Last_Name__c}"/>
                <apex:inputField value="{!booking link__c.Gender__c}"/>
                <apex:inputField value="{!booking link__c.Relation__c}"/>
                <apex:inputField value="{!booking link__c.Father_Husband__c}"/>
                <apex:inputField value="{!booking link__c.    Pan_Number__c}"/>
                <apex:inputField value="{!booking link__c.    Aadhar_Number__c}"/>
                <apex:inputField value="{!booking link__c.Date_Of_Birth__c}"/>
                <apex:inputField value="{!booking link__c.Wedding_Anniversary__c}"/>
                <apex:inputField value="{!booking link__c.Mobile__c}"/>
                <apex:inputField value="{!booking link__c.Alternate_Mobile__c}"/>
                <apex:inputField value="{!booking link__c.Phone__c}"/>
                <apex:inputField value="{!booking link__c.Other_Phone__c}"/>
                <apex:inputField value="{!booking link__c.Home_Phone__c}"/>
                <apex:inputField value="{!booking link__c.Email__c}"/>  
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Professional Information" collapsible="false" columns="2">
                <apex:inputField value="{!booking link__c.Profession__c}"/>
                <apex:inputField value="{!booking link__c.Designation__c}"/>
                <apex:inputField value="{!booking link__c.Professional_Email__c}"/>
                <apex:inputField value="{!booking link__c.Annual_Income__c}"/>
                <apex:inputField value="{!booking link__c.CompanyMobile__c}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Office Address" collapsible="false" columns="2">
                <apex:inputField value="{!booking link__c.Employed_by__c}"/>
                <apex:inputField value="{!booking link__c.OfficeStreet__c}"/>
                <apex:inputField value="{!booking link__c.OfficeCity__c}"/>
                <apex:inputField value="{!booking link__c.OfficeState__c}"/>
                <apex:inputField value="{!booking link__c.OfficeCountry__c}"/>
                <apex:inputField value="{!booking link__c.OfficePinCode__c}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Children School Address" collapsible="false" columns="2">
                <apex:inputField value="{!booking link__c.School_Name__c}"/>
                <apex:inputField value="{!booking link__c.SchoolStreet__c}"/>
                <apex:inputField value="{!booking link__c.SchoolCity__c}"/>
                <apex:inputField value="{!booking link__c.SchoolState__c}"/>
                <apex:inputField value="{!booking link__c.SchoolCountry__c}"/>
                <apex:inputField value="{!booking link__c.SchoolPinCode__c}"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection title="Address Information" collapsible="false" columns="2">
                <apex:inputField value="{!booking link__c.BillingCountry__c}"/>
                <apex:inputField value="{!booking link__c.ShippingCountry__c}"/>
                <apex:inputField value="{!booking link__c.BillingStreet__c}"/>
                <apex:inputField value="{!booking link__c.ShippingStreet__c}"/>
                <apex:inputField value="{!booking link__c.BillingCity__c}"/>
                <apex:inputField value="{!booking link__c.ShippingCity__c}"/>
                <apex:inputField value="{!booking link__c.BillingState__c}"/>
                <apex:inputField value="{!booking link__c.ShippingState__c}"/>
                <apex:inputField value="{!booking link__c.BillingPinCode__c}"/>
                <apex:inputField value="{!booking link__c.ShippingPinCode__c}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>
Hello Developers/Everyone,

Trying to create bulk records in Child Object from Parent Object using Visualforce Page .


Objects Names :
Opportunity  (Opportunity)
Product Schedule (Project_Schedule__c)
Schedule (Schedule__c)

Relation Between Them :
Master Detail
Opportunity to Schedule(MasterDetail)
Schedule to Product Schedule(Master Detail)

Actual Action to perform:


On Opportunity Record Page(Detail Page)
Create a custom Button. 
Custom Button contain Visualforce Page.
In that Visualforce Page we have fields of Schedule Object which is child of Opportunity.
User update Mandatory fields of Schedule Object, on that Visualforce Page and click on save at that time.
We need to create 10 or 12 or 20 records with the same data in all records.(Number of records will be dynamic)

Now Example : 
10 records have to get created on Schedule Object.
then at that time 
in Sub child Object(Product Schedule) their also 5 or 7 or 10 Records need to get create dynamically.


Final point is 
From Opportunity 
we need to create a record in child object as well as in super child(Child Child Object) Object.
These are to be bulk records and are dynamic in insertion.

***Please provide me a solution.
If any doubts please revert back.., 
I need this implementation and any suggestion will really helps me a lot.

Thanks and Regards,
Azar Khasim.
want to make a dynamic url? for page reference to lead edit page in VF Page!

My PageReference Code:

 public pagereference createLead(){
       
        pagereference cl1=new pagereference('/lightning/o/Lead/new?count=1&nooverride=1&useRecordTypeCheck=1&navigationLocation=MRU_LIST&backgroundContext=%2Flightning%2Fo%2FLead%2Flist%3FfilterName%3DRecent');
        cl1.setRedirect(true);
        return cl1;
    }

Please give me a solution for this URL to be dynamic.

Thanks and Regards,
Azar Khasim.
Hello Everyone,
Need help in creation of validation rule.

When Lead Owner is Call Center Agent and Inbound Call checkbox is false you(Call Center Agent) cannot edit Source, Lead Source, Channel Source Fields.

Lead Owner Role: Call Center Agent
Lead Field : Inbound_Call__c
Lead Fields not to get update when Inbound_Call__c is false and Owner Role is Call Center Agent.


Lead Fields not to get update.

Channel :    Channel__c(Picklist) 
Source :      Source__c(Picklist) Dependent on Channel.
Campaign Source: DC_Campaign_Source__c(Picklist)Dependent on Source
Lead Source :   DC_Lead_Source__c(Picklist) Dependent on                                          Campaign Source


Validation Rule is required to show a message that
if
Lead Owner role is Call Center Agent
Field Inbound_Call__c is false
then you(Call Center Agent) cant update these fields.


Please help me for this Validation rule.

Thanks and Regards,
Azar Khasim.
 
Hi all,

I created status field in message_log custom object.
Whenever a new message comes i want to update status field to new incoming message.
How can i achieve it can any suggest me.

Thanks InAdvance.
  • March 10, 2020
  • Like
  • 0
Hello Everyone,

I need help with my requirements.

Need help in writing a trigger between Opportunity and Project(Custom Object) to create Project wit specified Template(Record).

I have three objects.
Opportunity (Three Checkboxes)(Temp 60, Temp 90, Temp 120)
      ||
Project (Record Type -- ST Templates) Records(Temp 60, Temp 90, Temp 120)
      ||
MIlestones


criterias..,

1. When the Opportunity Stage is ClosedWon, create a Project.
2. The opportunity has three checkboxes names
    (Three Checkboxes -- Temp 60, Temp 90, Temp 120)
3. The project has Record Type as (Record Type -- DC Project Templates)
   These are the ST templates (Means records in Project Object with Record Type -- DC Project Templates) -- Temp 60, Temp 90, Temp 120.

Now, Whenever Opportunity is ClosedWon and Checkbox Temp 60 is true.
Create a New Project with Selecting Temp60 as the default template for Project because Temp 60 has Child Records(28 Milestones in Milestones Object.)



Please Help me in providing a trigger for two objects.

Trigger :
Opportunity Stage:  ClosedWon && Temp 60 Checkbox is true 
Create a Project with  Dc Project Template (Temp 60) as default.

If I select Temp 60 checkbox in Opportunity Temp 60 Record from Project is to be the default. Because of Every Template(Record) in the DC Project Template as a certain number of unique Child Records.

If I select Temp 90 checkbox in Opportunity Temp 90 Record from Project is to be the default. Because of Every Template(Record) in the DC Project Template as a certain number of unique Child Records.

If I select Temp 120 checkbox in Opportunity Temp 120 Record from Project is to be the default. Because of Every Template(Record) in the DC Project Template as a certain number of unique Child Records.


Please Provide me the trigger for this scenario.

Thanks and Regards,
Azar Khasim.



 
User-added image
While clicking on button called Visualforce page.
Hello Guys,

I need some help regarding writing a test class for the below controller class for a VF page.

Here is my Controller Class

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 Accept(){
        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 help me out from this...,

Thanks and Regards,
Azar Khasim.
Hello All,

I need some help in writing a Test Class for the below Trigger.

My Trigger:
********************************************************************************
trigger AccountNameUpdate on Booking_Link__c (before insert, before update) {
    List<Account> accountList = new List<Account>();
    String CustomNumber;
    for(Booking_Link__c bl : Trigger.new)
    {       
        CustomNumber = bl.Customer_Number__c;
       
    }
    accountList = [Select Id, OwnerId, Customer_Number__pc from Account where Customer_Number__pc =:CustomNumber ];
    for(Booking_Link__c bl : Trigger.new)
    {
        for(Account a : accountList)
        {
           if(bl.Customer_Number__c == a.Customer_Number__pc && bl.T2G__c==True)
            {
                bl.Account__c = a.Id;
                bl.OwnerId = a.OwnerId;
                bl.Mobile__c = bl.Mobile__c;
                bl.Alternate_Mobile__c= bl.Alternate_Mobile__c;
                bl.Phone__c= bl.Phone__c;
                bl.Home_Phone__c= bl.Home_Phone__c;
                bl.Other_Phone__c= bl.Other_Phone__c;
            }
        }
    }  
}
********************************************************************************

Please Help me with this requirement.

Thanks and Regards,
Azar Khasim.