• kuldeep paliwal
  • NEWBIE
  • 60 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 31
    Replies
i want to create two picklist on one is project and another is projectTeamMember, When i select from first picklist project on second picklist we get its related projectteammember..Just like if we selecte Account on first picklist second picklist show its related contacts.
Something Like this Or not:-
public List<SelectOption> getObjectProject
             
            List<SelectOption> projectList = new List<SelectOption>();
             
            for(Project__c po : [Select Name from Project__c])
            {
                projectList.add(new SelectOption(po.Name, po.Name));
            }
            return projectList;
    }
Thank You
Here is criteria my validation rule on "Lastname":--
1. No more than two consecutive repeating characters are allowed 
2. No symbols except for hyphen and apostrophe 
3. No digits 
4. Minimum length of two characters 
5. No leading spaces or special characters 
6. No spaces allowed on either side of a hyphen 
7. Single space allowed between text 
8. Must not contain initial(s) with the exception of ‘#’ 
9. For 'Last Name' field : Must not contain initials(s) with the exception of ‘#’ 
‘#’ acceptable only when following a single alphabetic character (e.g. ‘Last Name: Jane#’ is allowed) 

Here i write and want add point '9' too...:-
​OR( 
ISPICKVAL( Account.Type , "Sole Traders"), 
NOT( CONTAINS( LastName , "PTY Ltd") ) , 
LEN(LastName ) < 2 , 
NOT(CONTAINS(LastName , "-")) , 
NOT(CONTAINS(LastName , "'")), 
CONTAINS(LastName , ' ') , REGEX(LastName , "^[a-zA-Z0-9-/]*$") 
)
can any one help me...Thanx
public static map<String, String> contactsave(String lstRecordId){
        system.debug('contactid'+lstRecordId);
        String data =  lstRecordId.substring(1, lstRecordId.length()-1);
        String data1 = '{'+data+'}';
        system.debug('contactid'+data1);
        ContactObject.Contact contacts = (ContactObject.Contact)JSON.deserialize(data, ContactObject.Contact.class); 
        system.debug('contactid'+data);
        system.debug('contacts=='+contacts);
        list<ContactObject.CustomerAccount> custacc = contacts.customerAccounts; 
        system.debug('contacts=='+custacc);
        system.debug('contacts=='+contacts.customerAccounts);
        system.debug('id'+contacts.birthDate);
        //return 'hii';
        //List < String > oErrorMsg = new List < String > ();
        map < String, String > oErrorMsg = new map <String , String> ();
        
        list<Contact> conlist = [SELECT UUID__c From Contact WHERE UUID__c =: contacts.id];
        system.debug('conlist'+conlist);
        
        if(conlist.size() > 0){
           oErrorMsg.put(Label.CONTACT_SEARCH_ERROR_ALREADY_EXISTS, '');
        }
        else{

            Contact c = new Contact();
            //c.AccountId = contacts.Id;
            c.Salutation = contacts.title;
            c.FirstName = contacts.firstName;
            c.LastName = contacts.LastName;
            c.MiddleName = contacts.middleName;
            c.UUID__c = contacts.id;
            if(contacts.birthDate != null && contacts.birthDate != ''){
                c.Birthdate = Date.valueOf(contacts.birthDate);    
            }
            c.Contact_Status__c = contacts.status;
            
               c.Contact_Type__c = custacc[0].ContactRelationship.contactType;
               c.Contact_Usage__c = custacc[0].ContactRelationship.contactUsage;
            c.Imported__c = true;
            c.Home_Email__c = contacts.homeContact.emailAddress;
            c.Home_Fax__c = contacts.homeContact.faxNumber;
            c.HomePhone__c = contacts.homeContact.phoneNumber;
            c.Mobile_Phone_Number__c = contacts.homeContact.mobileNumber;
            c.HomePhone__c = contacts.homeContact.phoneNumber;
            c.HomePhone__c = contacts.homeContact.phoneNumber;
            try {
                insert c; 
                 
                  oErrorMsg.put(Label.CUSTOMER_SEARCH_INFO_CONTACTS_IMPORT_SUCCESSFUL, String.valueOf(c.id+contacts.id));
            } 
            catch(Exception e) {
                
                oErrorMsg.put(Label.CONTACT_SEARCH_ERROR_IMPORT, ''    );
                return oErrorMsg;
            }
           
        }
        
        return oErrorMsg;
    }
trigger UpdateCustomerPOField on AcctSeedERP__Purchase_Order__c (after insert) {

    list<id> pOrderLineId = new list<id>();
    list<id> sOrderId = new list<id>();
    List<AcctSeedERP__Sales_Order__c> salesOrderFieldToInsert = new List<AcctSeedERP__Sales_Order__c>();
    
    List<AcctSeedERP__Purchase_Order__c> purchase = [SELECT Id,Customer_PO__c,(SELECT Id,Name FROM AcctSeedERP__Purchase_Order_Lines__r ) FROM AcctSeedERP__Purchase_Order__c LIMIT 1];
    
    map<id, AcctSeedERP__Purchase_Order__c> purOrderLineIdpurOrderIdMap = new map<id, AcctSeedERP__Purchase_Order__c>();
    
    for(AcctSeedERP__Purchase_Order__c  purchaseOrder : purchase){
        for(AcctSeedERP__Purchase_Order_Line__c purchaseOrderLine : purchaseOrder.AcctSeedERP__Purchase_Order_Lines__r ) {
        pOrderLineId.add(purchaseOrderLine.Id);
        purOrderLineIdpurOrderIdMap.put(purchaseOrderLine.Id,purchaseOrder);
        }
    }
    
    list<AcctSeedERP__Sales_Order_Line__c> salesOrderLineList = [Select id, AcctSeedERP__Purchase_Order_Line__c,AcctSeedERP__Sales_Order__c From AcctSeedERP__Sales_Order_Line__c Where AcctSeedERP__Purchase_Order_Line__c In: pOrderLineId LIMIT 1];
    map<id, id> salesOrderLinePurOrderLineMap = new map<id, id>();
    map<id, list<AcctSeedERP__Sales_Order_Line__c>> salesOrderSalesOrderLineMap = new map<id, list<AcctSeedERP__Sales_Order_Line__c>>();
    
    for(AcctSeedERP__Sales_Order_Line__c salesOrderLine : salesOrderLineList){
     list<AcctSeedERP__Sales_Order_Line__c> tempList = salesOrderSalesOrderLineMap.get(salesOrderLine.AcctSeedERP__Sales_Order__c);
        sOrderId.add(salesOrderLine.AcctSeedERP__Sales_Order__c);
        salesOrderLinePurOrderLineMap.put(salesOrderLine.Id, salesOrderLine.AcctSeedERP__Purchase_Order_Line__c);
        salesOrderSalesOrderLineMap.put(salesOrderLine.AcctSeedERP__Sales_Order__c,tempList);
    }
    
    list<AcctSeedERP__Sales_Order__c> salesOrderList = [Select id,Customer_PO__c,(SELECT Id,Name,AcctSeedERP__Sales_Order__c FROM AcctSeedERP__Sales_Order_Line__r)  From AcctSeedERP__Sales_Order__c Where Id In: sOrderId LIMIT 1];
    
    for(AcctSeedERP__Sales_Order__c salesOrder : salesOrderList){
    
        List<AcctSeedERP__Sales_Order_Line__c> SalesOrderLineId = salesOrderSalesOrderLineMap.get(salesOrder.Id);
        
        for(AcctSeedERP__Sales_Order_Line__c salesOrderLine : SalesOrderLineId){
        
            
            Id purOrderLineId = salesOrderLinePurOrderLineMap.get(salesOrderLine.Id);
            
            for(AcctSeedERP__Purchase_Order_Line__c purOrderLine : purOrderLineId){
            
            AcctSeedERP__Purchase_Order__c purOrder = purOrderLineIdpurOrderIdMap.get(purOrderLine.Id);
            purOrder.Customer_PO__c = salesOrder.Customer_PO__c;
            salesOrderFieldToInsert.add(purOrder);
            }
        }
    }
    
    if(salesOrderFieldToInsert.size()>0){
            insert salesOrderFieldToInsert;
            }
}

How i update the value of purchase order to sales order can anyone help me..
Thanx
trigger UpdateCustomerPOField on AcctSeedERP__Purchase_Order__c (after insert) {

    list<id> pOrderLineId = new list<id>();
    list<id> sOrderId = new list<id>();
    List<AcctSeedERP__Sales_Order__c> salesOrderFieldToInsert = new List<AcctSeedERP__Sales_Order__c>();
    
    List<AcctSeedERP__Purchase_Order__c> purchase = [SELECT Id,Customer_PO__c,(SELECT Id,Name FROM AcctSeedERP__Purchase_Order_Lines__r ) FROM AcctSeedERP__Purchase_Order__c LIMIT 1];
    
    map<id, id> purOrderLineIdpurOrderIdMap = new map<id, id>();
    
    for(AcctSeedERP__Purchase_Order__c  purchaseOrder : purchase){
        for(AcctSeedERP__Purchase_Order_Line__c purchaseOrderLine : purchaseOrder.AcctSeedERP__Purchase_Order_Lines__r ) {
        pOrderLineId.add(purchaseOrderLine.Id);
        purOrderLineIdpurOrderIdMap.put(purchaseOrderLine.Id,purchaseOrder.Id);
        }
    }
    
    list<AcctSeedERP__Sales_Order_Line__c> salesOrderLineList = [Select id, AcctSeedERP__Purchase_Order_Line__c,AcctSeedERP__Sales_Order__c From AcctSeedERP__Sales_Order_Line__c Where AcctSeedERP__Purchase_Order_Line__c In: pOrderLineId LIMIT 1];
    map<id, id> salesOrderLinePurOrderLineMap = new map<id, id>();
    map<id, list<AcctSeedERP__Sales_Order_Line__c>> salesOrderSalesOrderLineMap = new map<id, list<AcctSeedERP__Sales_Order_Line__c>>();
    
    for(AcctSeedERP__Sales_Order_Line__c salesOrderLine : salesOrderLineList){
     list<AcctSeedERP__Sales_Order_Line__c> tempList = salesOrderSalesOrderLineMap.get(salesOrderLine.AcctSeedERP__Sales_Order__c);
        sOrderId.add(salesOrderLine.AcctSeedERP__Sales_Order__c);
        salesOrderLinePurOrderLineMap.put(salesOrderLine.Id, salesOrderLine.AcctSeedERP__Purchase_Order_Line__c);
        salesOrderSalesOrderLineMap.put(salesOrderLine.AcctSeedERP__Sales_Order__c,tempList);
    }
    
    list<AcctSeedERP__Sales_Order__c> salesOrderList = [Select id,Customer_PO__c,(SELECT Id,Name,AcctSeedERP__Sales_Order__c FROM AcctSeedERP__Sales_Order_Line__r)  From AcctSeedERP__Sales_Order__c Where Id In: sOrderId LIMIT 1];
    
    for(AcctSeedERP__Sales_Order__c salesOrder : salesOrderList){
    
        List<AcctSeedERP__Sales_Order_Line__c> SalesOrderLineId = salesOrderSalesOrderLineMap.get(salesOrder.Id);
        
        for(AcctSeedERP__Sales_Order_Line__c salesOrderLine : SalesOrderLineId){
        
            AcctSeedERP__Purchase_Order_Line__c purOrderLineId = salesOrderLinePurOrderLineMap.get(salesOrderLine.Id);
            
            for(AcctSeedERP__Purchase_Order_Line__c purOrderLine : purOrderLineId){
            AcctSeedERP__Purchase_Order__c purOrder = purOrderLineIdpurOrderIdMap.get(purOrderLine.Id);
            purOrder.Customer_PO__c = salesOrder.Customer_PO__c;
            salesOrderFieldToInsert.add(purOrder);
            }
        }
    }
    
    if(salesOrderFieldToInsert.size()>0){
            insert salesOrderFieldToInsert;
            }
}
i have phurchase order on that we have field Customer_PO, purchase order is related to purchase order line(Master detail relationship) where purchase order is parent and purchase order line is detail
now purchase order line is a lookup relationship to 'sales order line' which is child of 'sales order'
whenever user add  Customer_PO on purchase order it also add field of sales order.

i write something like this can anyone check and update it..

trigger UpdateCustomerPOField on AcctSeedERP__Purchase_Order__c (after insert) {

    list<id> pOrderLineId = new list<id>();
    list<id> sOrderLineId = new list<id>();
    list<id> sOrderId = new list<id>();
    
    List<AcctSeedERP__Purchase_Order__c> purchase = [SELECT Id,Customer_PO__c,(SELECT Id,Name FROM AcctSeedERP__Purchase_Order_Lines__r ) FROM AcctSeedERP__Purchase_Order__c LIMIT 1];

    for(AcctSeedERP__Purchase_Order__c  purchaseOrder : purchase){
        for(AcctSeedERP__Purchase_Order_Line__c purchaseOrderLine : purchaseOrder.AcctSeedERP__Purchase_Order_Lines__r ) {
        pOrderLineId.add(purchaseOrderLine.Id);
        }
    }

    List<AcctSeedERP__Purchase_Order_Line__c> pOrderLineList = [Select Id  FROM AcctSeedERP__Purchase_Order_Line__c Where Id IN: pOrderLineId LIMIT 1];
    map<id, AcctSeedERP__Purchase_Order_Line__c> purIdpurObjectMap = new map<id, AcctSeedERP__Purchase_Order_Line__c>();
            
    for(AcctSeedERP__Purchase_Order_Line__c purOrder : pOrderLineList){        
                purIdpurObjectMap.put(purOrder.Id, purOrder);
    }
            
    list<AcctSeedERP__Sales_Order_Line__c> salesOrderLineList = [Select id, AcctSeedERP__Purchase_Order_Line__c From AcctSeedERP__Sales_Order_Line__c Where AcctSeedERP__Purchase_Order_Line__c In: pOrderLineId LIMIT 1];
    map<id, list<AcctSeedERP__Sales_Order_Line__c>> purOrderLineSalesOrderLineMap = new map<id, list<AcctSeedERP__Sales_Order_Line__c>>();

    for(AcctSeedERP__Sales_Order_Line__c salesOrderLine : salesOrderLineList){
    list<AcctSeedERP__Sales_Order_Line__c> tempList = purOrderLineSalesOrderLineMap.get(salesOrderLine.AcctSeedERP__Purchase_Order_Line__c);
        if(templist!= null && templist.Size()>0){
                    tempList.add(salesOrderLine);
        }else{
                    tempList = new list<AcctSeedERP__Sales_Order_Line__c>();
                    tempList.add(salesOrderLine);
            }
                    purOrderLineSalesOrderLineMap.put(salesOrderLine.AcctSeedERP__Purchase_Order_Line__c, tempList);
                    sOrderLineId.add(salesOrderLine.AcctSeedERP__Sales_Order__c);
    }
    
    list<AcctSeedERP__Sales_Order__c> salesOrderList = [Select id,Customer_PO__c,(SELECT Id,Name FROM AcctSeedERP__Sales_Order_Line__r)  From AcctSeedERP__Sales_Order__c Where Id In: sOrderLineId];
    map<id, AcctSeedERP__Sales_Order__c> salIdsalObjectMap = new map<id, AcctSeedERP__Sales_Order__c>();
    
    for(AcctSeedERP__Sales_Order__c salesOrder : salesOrderList){
                    salIdsalObjectMap.put(salesOrder.Id, salesOrder);
                    for(AcctSeedERP__Sales_Order_Line__c salesLine : salesOrder.AcctSeedERP__Sales_Order_Line__r) {
        sOrderId.add(salesLine.Id);
        }
    }

    for(AcctSeedERP__Purchase_Order__c pur : trigger.new){
    List<AcctSeedERP__Sales_Order_Line__c> listOfSalesOrder = purOrderLineSalesOrderLineMap.get(pur.AcctSeedERP__Purchase_Order_Line__c);
    
        for(AcctSeedERP__Sales_Order__c sales : listOfSalesOrder){            
                    AcctSeedERP__Sales_Order__c salesObject  = salIdsalObjectMap.get(sales.id);
                    salesObject.Customer_PO__c = pur.Customer_PO__c;
        }
    }
}
i have purchace order as master and purchase order line as child and for purchase order line is lookup to sales order line which is child of sales order i want a field value(Customer PO#) on purchase order to display on sales order..i want to write a trigger on purchase order (after update) and update the field of sales order...how its done..can u help me..
How to add update event on this code and how i write test class for this, i am new can any one help me..
trigger UpdateCustomerPO on AcctSeedERP__Sales_Order_Line__c (after insert,after update) {

Map<ID, AcctSeedERP__Sales_Order__c> parentSalesOrder = new Map<ID, AcctSeedERP__Sales_Order__c>(); 
  
  List<Id> listIds = new List<Id>();

  for (AcctSeedERP__Sales_Order_Line__c childObj : Trigger.new) {
    listIds.add(childObj.AcctSeedERP__Sales_Order__c);
  }


  parentSalesOrder = new Map<Id, AcctSeedERP__Sales_Order__c>([SELECT id,(SELECT ID, Customer_PO__c FROM AcctSeedERP__Sales_Order_Line__r) FROM AcctSeedERP__Sales_Order__c WHERE ID IN :listIds]);

  for (AcctSeedERP__Sales_Order_Line__c sales: Trigger.new){
     AcctSeedERP__Sales_Order__c myParentOpp = parentSalesOrder.get(sales.AcctSeedERP__Sales_Order__c);
     myParentOpp.Customer_PO__c = sales.Customer_PO__c;
  }

  update parentSalesOrder.values();
}
Thank You
  <apex:pageblock >
            <apex:pageblockTable value="{!busterSetting}" var="c">
                <apex:column value="{!c.Name}"/>
                <apex:column value="{!c.Object_Name__c}"/>
                <apex:column value="{!c.Field_List__c}"/>       
                <apex:column value="{!c.Layout_Name__c}"/>
            </apex:pageblockTable>

This is my vf shows hear when i open this page its call the custom settings and set all fields but i want to show records which have only particular Layout_Name__c like(which records have Layout_Name__c = search) only show other can not show on my page..
Thanx
Lets start from the first step i create an visualforce tab on this tab i add one vf page which have three inner tab(using TabPanel), on click on each tab their is a new button when we click on that a new vf page(on which we add something and we also have save & cancel button) will be open but my problem is that on this page my tabs are not shown and on cancel it come to first page their also tab panel are not shown.

Tab Panel:-
<apex:page standardController="BusterSetting__c" showHeader="true" sidebar="true">
    <!-- Define Tab panel .css styles -->
    <style>
    .activeTab {background-color: #236FBD; color:white; background-image:none}
    .inactiveTab { background-color: lightgrey; color:black; background-image:none}
    </style>
            
    <!-- Create Tab panel -->
    <apex:tabPanel switchType="client" selectedTab="name1" id="BusterSettingsTabPanel"
        tabClass="activeTab" inactiveTabClass="inactiveTab">
        <apex:tab label="Find Duplicate Layout" name="name1" id="tabOne">
        <apex:include pageName="FindDuplicatePageLayout"/>
        </apex:tab>
        <apex:tab label="Result Page Layout" name="name2" id="tabTwo">
         <apex:include pageName="ResultPageLayout"/>
        </apex:tab>
        <apex:tab label="Type Ahead" name="name3" id="tabThree">
        content for tab Three
        </apex:tab>
    </apex:tabPanel>
</apex:page>

Hear is a new Button:-
<apex:page controller="FindDuplicateFieldSetController">
    <apex:form >
        <apex:pageblock id="pb">
            <apex:pageblockButtons location="top">
                <apex:commandButton value="New" action="{!clickOnNew}"/>
            </apex:pageblockButtons>
        </apex:pageblock>
        <apex:pageblock >
            <apex:pageblockTable value="{!busterSetting}" var="c">
                <apex:column value="{!c.Name}"/>
                <apex:column value="{!c.Object_Name__c}"/>
                <apex:column value="{!c.Field_List__c}"/>       
                <apex:column value="{!c.Layout_Name__c}"/>
            </apex:pageblockTable>
            <apex:panelGrid columns="7">
                <apex:commandButton status="fetchStatus" reRender="pb" value="|<" action="{!first}" disabled="{!!hasPrevious}" title="First Page"/>
                <apex:commandButton status="fetchStatus" reRender="pb" value="<" action="{!previous}" disabled="{!!hasPrevious}" title="Previous Page"/>
                <apex:commandButton status="fetchStatus" reRender="pb" value=">" action="{!next}" disabled="{!!hasNext}" title="Next Page"/>
                <apex:commandButton status="fetchStatus" reRender="pb" value=">|" action="{!last}" disabled="{!!hasNext}" title="Last Page"/>
                <apex:outputText >{!(pageNumber * size)+1-size}-{!IF((pageNumber * size)>noOfRecords, noOfRecords,(pageNumber * size))} of {!noOfRecords}</apex:outputText>
                <apex:commandButton status="fetchStatus" reRender="pb" value="Refresh" action="{!refresh}" title="Refresh Page"/>
                <apex:outputPanel style="color:#4AA02C;font-weight:bold">
                    <apex:actionStatus id="fetchStatus" startText="Fetching..." stopText=""/>
                </apex:outputPanel>
            </apex:panelGrid>
        </apex:pageblock>
    </apex:form>
</apex:page>

Click on New this vf will be shown:-
<apex:page controller="FindDuplicateFieldSetController">
    <apex:form > 
        <apex:pageMessages ></apex:pageMessages>
            <apex:pageBlock title="Duplicate Filter Edit">
            
                <apex:pageBlockSection title="Filter Name" collapsible="false" columns="2">
                    <apex:pageBlockSectionItem >
                        <apex:outputLabel value="Buster Job Name:"></apex:outputLabel>
                            <apex:inputText title="Buster Job Name" value="{!saveJobName}" required="true"/>
                        </apex:pageBlockSectionItem>
                     </apex:pageBlockSection> 
                   
                <apex:pageBlockSection title="Select Standard or Custom Object" columns="2" collapsible="false">
                    <apex:pageBlockSectionItem >
                        <apex:outputlabel value="Object:"/> 
                            <apex:actionRegion >      
                                <apex:selectList value="{!selectedObject}" size="1">
                                    <apex:selectOptions value="{!objNames}"/>
                                        <apex:actionSupport event="onchange" action="{!getObjectFields}" rerender="myFields"/>
                                </apex:selectList>
                            </apex:actionRegion>                         
                    </apex:pageBlockSectionItem>
                </apex:pageBlockSection>
                
                    <apex:outputPanel id="myFields"> 
                <apex:pageBlockSection title="Select Fields" collapsible="false">
                    <apex:pageblocksectionitem > 
                            <c:MultiselectPicklist leftLabel="Available Fields"
                            leftOption="{!allFields}" 
                            rightLabel="Selected Fields"
                            rightOption="{!selectedFields}"
                            size="14" width="150px" />  
                        </apex:pageblocksectionItem>       
                </apex:pageblocksection>
                    </apex:outputpanel>
                    
                <apex:pageblockButtons location="top">
                        <apex:commandButton value="Save" action="{!save}" />
                        <apex:commandButton value="Save & New" action="{!saveAndNew}" />
                        <apex:commandButton value="Cancel" action="{!cancel}" immediate="true"/>
                </apex:pageblockButtons> 
            </apex:pageBlock>
    </apex:form>
</apex:page>
public class NewDulplicateBusterJobController{

    private String BusterJobName;
    
    public String getBusterJobName() {
        return this.BusterJobName;
    }
    public void setBusterJobName(String BusterJobName) {
        this.BusterJobName = BusterJobName;
    }

    public NewDulplicateBusterJobController(ApexPages.StandardController controller) {
            selectedObject = 'account';
            getObjectFields();
    }

    public Map <String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
    public String selectedObject {get; set;}
    public SelectOption[] selectedFields { get; set; }
    public SelectOption[] allFields { get; set; }
    public String message { get; set; }

    Public NewDulplicateBusterJobController(){
            
           
    }

    public List<SelectOption> getObjectNames(){
        List<SelectOption> objNames = new List<SelectOption>();
            for (Schema.SObjectType obj : schemaMap.values()){
                    Schema.DescribeSObjectResult describeSobject = obj.getDescribe();
                    String Name = describeSobject.getName();
                    String Label = describeSobject.getLabel();
                    if(Name == 'Account' || Name == 'Contact' || Name == 'Lead' || Name == 'Opportunity' || Name == 'Case' || Name == 'KnowledgeArticle' || describeSobject.isCustom()==true){
                        SelectOption so = new SelectOption( Name , Label );
                        objNames.add(so);
                        objNames.sort();
                        system.debug('--objNames--' +objNames);
                        List<SelectOption> allFields = getObjectFields();
                    }
            }
            return objNames;
    }
    
    public List<SelectOption> getObjectFields(){
            selectedFields = new List<SelectOption>();
            Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
            Schema.SObjectType ObjectSchema = schemaMap.get(selectedObject);
            Map<String, Schema.SObjectField> fieldMap = ObjectSchema.getDescribe().fields.getMap();
           
            allFields = new List<SelectOption>();
            for (String fieldName: fieldMap.keySet()) {  
                    allFields.add(new SelectOption(fieldMap.get(fieldName).getDescribe().getName(),fieldMap.get(fieldName).getDescribe().getName()));
                    allFields.sort();
            }
            
            return allFields;
    }

}


<apex:page standardController="Buster_Job__c" extensions="NewDulplicateBusterJobController" > <apex:form > <apex:pageBlock title="Duplicate Filter Edit"> <apex:pageblockButtons location="top"> <apex:commandButton value="Save" /> <apex:commandButton value="Save & Start" /> <apex:commandButton value="Cancel"/> </apex:pageblockButtons> <apex:pageBlockSection title="Filter Name" collapsible="false" columns="2"> <apex:pageBlockSectionItem > <apex:outputLabel value="Buster Job Name:"></apex:outputLabel> <apex:inputText title="Buster Job Name" value="{!BusterJobName}" required="true"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockSection title="Select Standard or Custom Object" columns="2"> <apex:pageBlockSectionItem > <apex:outputlabel value="Object:"/> <apex:actionRegion > <apex:selectList value="{!selectedObject}" size="1"> <apex:selectOptions value="{!ObjectNames}"/> <apex:actionSupport event="onchange" rerender="myFields"/> </apex:selectList> </apex:actionRegion> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockSection title="Select a Field and Its Rule"> <apex:pageblocksectionitem > <apex:outputPanel id="myFields"> <c:MultiselectPicklist leftLabel="Available Fields" leftOption="{!allFields}" rightLabel="Selected Fields" rightOption="{!selectedFields}" size="14" width="150px"/> </apex:outputpanel> </apex:pageblocksectionItem> </apex:pageblocksection> </apex:pageBlock> </apex:form> </apex:page>
trigger updateProjectTeammember on opportunityTeamMember(after insert, after update, after delete){
        if(trigger.isInsert || trigger.isUpdate){
        
        Map<String,String> OppOtmfieldMap=new Map<String,String>();
               OppOtmfieldMap.put('Sr. Client Insights Manager','CEM_Assigned__c');
               OppOtmfieldMap.put('Client Insights Manager','CEM_2nd__c');
               OppOtmfieldMap.put('Data Manager','Ops_Owner__c');
               OppOtmfieldMap.put('Lead Consultant','Consultant_assigned__c');
               OppOtmfieldMap.put('Support Consultant','Consultant_2nd__c');
               OppOtmfieldMap.put('Analysis Support','Analysis_Support__c');
               OppOtmfieldMap.put('BD/Development Partner','BD_Development_Partner__c');
        
        Map<String,String> projOtmfieldMap=new Map<String,String>();
               projOtmfieldMap.put('Sr. Client Insights Manager','Sr_Client_Insights_Manager__c');
               projOtmfieldMap.put('Client Insights Manager','Client_Insights_Manager__c');
               projOtmfieldMap.put('Data Manager','Ops_Manager__c');
               projOtmfieldMap.put('Lead Consultant','Lead_Consultant__c');
               projOtmfieldMap.put('Support Consultant','Support_Consultant__c');
               projOtmfieldMap.put('Analysis Support','Analysis_Support__c');
               projOtmfieldMap.put('BD/Development Partner','BD_Development_Partner__c');
        
            list<id> oppoIdList = new list<id>();
            map<id, id> oppoOtmMap = new map<id, id>();
            list<id> proMemList = new list<id>();
            map<id, id> oppIdProIdMap = new map<id, id>();
            list<id> proId = new list<id>();
            Map<Id,Opportunity> oppIdMap = new Map<Id,Opportunity>();
            Map<id, id> oppIdAccIdMap = new Map<id, id> ();
            Set<id> accId=new Set<Id>();
            
        for(OpportunityTeamMember otm : trigger.new){
                        OppoIdList.add(otm.OpportunityId);
                        oppoOtmMap.put(otm.Id, otm.OpportunityId);
            }
        
        map<id, list<Project__c>> oppIdProjectListMap = new map<id, list<Project__c>>();
        list<Opportunity> oppoList = [select Id, accountId, Project__c, (Select Id, Name from Project__r) From opportunity Where Id In: oppoIdList];
        system.debug('--oppoIdList--' +oppoIdList);
        for(Opportunity op : oppoList){
            proId.add(op.id);
            oppIdMap.put(op.id,op);
            accId.add(op.accountId);
            oppIdAccIdMap.put(op.id, op.accountId);
            oppIdProIdMap.put(op.id, op.Project__c);
            oppIdProjectListMap.put(op.id, op.Project__r);
            }
                
        list<Project_Team__c> ptmListForInsert = new list<Project_Team__c>();
        system.debug('--proId--' +proId);
        system.debug('--accId--' +accId);
        system.debug('--oppIdProIdMap--' +oppIdProIdMap);
        system.debug('--oppIdAccIdMap--' +oppIdAccIdMap); 
        
        list<Project_Team__c> ptmList = [Select id, Account__c, Project__c, Member_Role__c, Team_Member__c From Project_Team__c Where Id In: proId];
        map<id, list<Project_Team__c>> proPtmMap = new map<id, list<Project_Team__c>>();
        system.debug('--ptmList--' +ptmList);
        for(project_Team__c ptm : ptmList){
        
            list<project_Team__c> tempList = proPtmMap.get(ptm.Project__c);
            
            if(templist!= null && templist.Size()>0){
                tempList.add(ptm);
                }else{
                        tempList = new list<project_Team__c>();
                        tempList.add(ptm);
                }
                proPtmMap.put(ptm.Project__c, tempList);
            }
            
        List<project_team__c> projList = new List<project_team__c>();
        for(OpportunityTeamMember otm : trigger.new){
        
            Boolean flag = false;
           
            List<project__c> listOfProj = oppIdProjectListMap.get(otm.OpportunityId);
            
            for(Project__c pro : listOfProj){
                    
            List<project_team__c> listOfPrjTm = proPtmMap.get(pro.id);
            
            if(listOfPrjTm!= null && listOfPrjTm.size()>0){
                for(Project_Team__c ptm : listOfPrjTm){
                    if(otm.userId == ptm.Team_Member__c){
                        flag =true;
                        }
                    }
                }
                if(flag ==true){
                }else{
                    Project_Team__c ptm1 = new Project_Team__c();
                    ptm1.Team_Member__c= otm.userId;
                    ptm1.Member_Role__c = otm.TeamMemberRole;
                    ptm1.Account__c = oppIdAccIdMap.get(otm.OpportunityId);
                    ptm1.Project__c = pro.id;
                    ptmListForInsert.add(ptm1);
                    system.debug('--ptm1--' +ptm1);
                    }
                }
            }
        if(ptmListForInsert.size()>0){

        insert ptmListForInsert;
            }
            
  }
}

i create OppOtmfieldMap want to map this field like whenever Sr. Client Insights Manager add to OTM it save to CEM_Assigned__c which is field of Opportunity how i done next..
Thanx
trigger updateProjectTeammember on opportunityTeamMember(after insert, after update, after delete){
        if(trigger.isInsert || trigger.isUpdate){
        
        Map<String,String> OppOtmfieldMap=new Map<String,String>();
               OppOtmfieldMap.put('Sr. Client Insights Manager','CEM_Assigned__c');
               OppOtmfieldMap.put('Client Insights Manager','CEM_2nd__c');
               OppOtmfieldMap.put('Data Manager','Ops_Owner__c');
               OppOtmfieldMap.put('Lead Consultant','Consultant_assigned__c');
               OppOtmfieldMap.put('Support Consultant','Consultant_2nd__c');
               OppOtmfieldMap.put('Analysis Support','Analysis_Support__c');
               OppOtmfieldMap.put('BD/Development Partner','BD_Development_Partner__c');
        
        Map<String,String> projOtmfieldMap=new Map<String,String>();
               projOtmfieldMap.put('Sr. Client Insights Manager','Sr_Client_Insights_Manager__c');
               projOtmfieldMap.put('Client Insights Manager','Client_Insights_Manager__c');
               projOtmfieldMap.put('Data Manager','Ops_Manager__c');
               projOtmfieldMap.put('Lead Consultant','Lead_Consultant__c');
               projOtmfieldMap.put('Support Consultant','Support_Consultant__c');
               projOtmfieldMap.put('Analysis Support','Analysis_Support__c');
               projOtmfieldMap.put('BD/Development Partner','BD_Development_Partner__c');
        
            list<id> oppoIdList = new list<id>();
            map<id, id> oppoOtmMap = new map<id, id>();
            list<id> proMemList = new list<id>();
            map<id, id> oppIdProIdMap = new map<id, id>();
            list<id> proId = new list<id>();
            Map<Id,Opportunity> oppIdMap = new Map<Id,Opportunity>();
            Map<id, id> oppIdAccIdMap = new Map<id, id> ();
            Set<id> accId=new Set<Id>();
            
        for(OpportunityTeamMember otm : trigger.new){
                        OppoIdList.add(otm.OpportunityId);
                        oppoOtmMap.put(otm.Id, otm.OpportunityId);
            }
        
        map<id, list<Project__c>> oppIdProjectListMap = new map<id, list<Project__c>>();
        list<Opportunity> oppoList = [select Id, accountId, Project__c, (Select Id, Name from Project__r) From opportunity Where Id In: oppoIdList];
        system.debug('--oppoIdList--' +oppoIdList);
        for(Opportunity op : oppoList){
            proId.add(op.id);
            oppIdMap.put(op.id,op);
            accId.add(op.accountId);
            oppIdAccIdMap.put(op.id, op.accountId);
           // oppIdProIdMap.put(op.id, op.Project__c);
            oppIdProjectListMap.put(op.id, op.Project__r);
            }
                
        list<Project_Team__c> ptmListForInsert = new list<Project_Team__c>();
        system.debug('--proId--' +proId);
        system.debug('--accId--' +accId);
        system.debug('--oppIdProIdMap--' +oppIdProIdMap);
        system.debug('--oppIdAccIdMap--' +oppIdAccIdMap); 
        
        list<Project_Team__c> ptmList = [Select id, Account__c, Project__c, Member_Role__c, Team_Member__c From Project_Team__c Where Id In: proId];
        map<id, list<Project_Team__c>> proPtmMap = new map<id, list<Project_Team__c>>();
        
        for(project_Team__c ptm : ptmList){
        
            list<project_Team__c> tempList = proPtmMap.get(ptm.Project__c);
            
            if(templist!= null && templist.Size()>0){
                tempList.add(ptm);
                }else{
                        tempList = new list<project_Team__c>();
                        tempList.add(ptm);
                }
                proPtmMap.put(ptm.Project__c, tempList);
            }
        
        for(OpportunityTeamMember otm : trigger.new){
        
            Boolean flag = false;
           
            List<project__c> listOfProj = oppIdProjectListMap.get(otm.OpportunityId);
            
            for(Project__c pro : listOfProj){
            List<project_team__c> listOfPrjTm = proPtmMap.get(pro.id);
            
            
            if(listOfPrjTm!= null){
                for(Project_Team__c ptm : listOfPrjTm){
                    if(otm.userId == ptm.Team_Member__c){
                        flag =true;
                        }
                    }
                }
                if(flag ==true){
                }else{
                    Project_Team__c ptm1 = new Project_Team__c();
                    ptm1.Team_Member__c= otm.userId;
                    ptm1.Member_Role__c = otm.TeamMemberRole;
                    ptm1.Account__c = oppIdAccIdMap.get(otm.OpportunityId);
                    ptm1.Project__c = proPtmMap.get(otm.OpportunityId);
                    ptmListForInsert.add(ptm1);
                    system.debug('--ptm1--' +ptm1);
                    }
            }}
        if(ptmListForInsert.size()>0){

        insert ptmListForInsert;
            }
            
  }
}
trigger updateProjectTeammember on opportunityTeamMember(after insert, after update, after delete){
        if(trigger.isInsert || trigger.isUpdate){
        
        Map<String,String> OppOtmfieldMap=new Map<String,String>();
               OppOtmfieldMap.put('Sr. Client Insights Manager','CEM_Assigned__c');
               OppOtmfieldMap.put('Client Insights Manager','CEM_2nd__c');
               OppOtmfieldMap.put('Data Manager','Ops_Owner__c');
               OppOtmfieldMap.put('Lead Consultant','Consultant_assigned__c');
               OppOtmfieldMap.put('Support Consultant','Consultant_2nd__c');
               OppOtmfieldMap.put('Analysis Support','Analysis_Support__c');
               OppOtmfieldMap.put('BD/Development Partner','BD_Development_Partner__c');
        
        Map<String,String> projOtmfieldMap=new Map<String,String>();
               projOtmfieldMap.put('Sr. Client Insights Manager','Sr_Client_Insights_Manager__c');
               projOtmfieldMap.put('Client Insights Manager','Client_Insights_Manager__c');
               projOtmfieldMap.put('Data Manager','Ops_Manager__c');
               projOtmfieldMap.put('Lead Consultant','Lead_Consultant__c');
               projOtmfieldMap.put('Support Consultant','Support_Consultant__c');
               projOtmfieldMap.put('Analysis Support','Analysis_Support__c');
               projOtmfieldMap.put('BD/Development Partner','BD_Development_Partner__c');
        
            list<id> oppoIdList = new list<id>();
            map<id, id> oppoOtmMap = new map<id, id>();
            list<id> proMemList = new list<id>();
            map<id, id> oppIdProIdMap = new map<id, id>();
            list<id> proId = new list<id>();
            Map<Id,Opportunity> oppIdMap = new Map<Id,Opportunity>();
            Map<id, id> oppIdAccIdMap = new Map<id, id> ();
            Set<id> accId=new Set<Id>();
            
        for(OpportunityTeamMember otm : trigger.new){
                        OppoIdList.add(otm.OpportunityId);
                        oppoOtmMap.put(otm.Id, otm.OpportunityId);
            }
        
        map<id, list<Project__c>> oppIdProjectListMap = new map<id, list<Project__c>>();
        list<Opportunity> oppoList = [select Id, accountId, Project__c, (Select Id, Name from Project__r) From opportunity Where Id In: oppoIdList];
        system.debug('--oppoIdList--' +oppoIdList);
        for(Opportunity op : oppoList){
            proId.add(op.id);
            oppIdMap.put(op.id,op);
            accId.add(op.accountId);
            oppIdAccIdMap.put(op.id, op.accountId);
           // oppIdProIdMap.put(op.id, op.Project__c);
            oppIdProjectListMap.put(op.id, op.Project__r);
            }
                
        list<Project_Team__c> ptmListForInsert = new list<Project_Team__c>();
        system.debug('--proId--' +proId);
        system.debug('--accId--' +accId);
        system.debug('--oppIdProIdMap--' +oppIdProIdMap);
        system.debug('--oppIdAccIdMap--' +oppIdAccIdMap); 
        
        list<Project_Team__c> ptmList = [Select id, Account__c, Project__c, Member_Role__c, Team_Member__c From Project_Team__c Where Id In: proId];
        map<id, list<Project_Team__c>> proPtmMap = new map<id, list<Project_Team__c>>();
        
        for(project_Team__c ptm : ptmList){
        
            list<project_Team__c> tempList = proPtmMap.get(ptm.Project__c);
            
            if(templist!= null && templist.Size()>0){
                tempList.add(ptm);
                }else{
                        tempList = new list<project_Team__c>();
                        tempList.add(ptm);
                }
                proPtmMap.put(ptm.Project__c, tempList);
            }
        
        for(OpportunityTeamMember otm : trigger.new){
        
            Boolean flag = false;
           
            List<project__c> listOfProj = oppIdProjectListMap.get(otm.OpportunityId);
            
            for(Project__c pro : listOfProj){
            List<project_team__c> listOfPrjTm = proPtmMap.get(pro.id);
            
            
            if(listOfPrjTm!= null){
                for(Project_Team__c ptm : listOfPrjTm){
                    if(otm.userId == ptm.Team_Member__c){
                        flag =true;
                        }
                    }
                }
                if(flag ==true){
                }else{
                    Project_Team__c ptm1 = new Project_Team__c();
                    ptm1.Team_Member__c= otm.userId;
                    ptm1.Member_Role__c = otm.TeamMemberRole;
                    ptm1.Account__c = oppIdAccIdMap.get(otm.OpportunityId);
                    ptm1.Project__c = proPtmMap.get(otm.OpportunityId);
                    ptmListForInsert.add(ptm1);
                    system.debug('--ptm1--' +ptm1);
                    }
            }}
        if(ptmListForInsert.size()>0){

        insert ptmListForInsert;
            }
            
  }
}
i want to create two picklist on one is project and another is projectTeamMember, When i select from first picklist project on second picklist we get its related projectteammember..Just like if we selecte Account on first picklist second picklist show its related contacts.
Something Like this Or not:-
public List<SelectOption> getObjectProject
             
            List<SelectOption> projectList = new List<SelectOption>();
             
            for(Project__c po : [Select Name from Project__c])
            {
                projectList.add(new SelectOption(po.Name, po.Name));
            }
            return projectList;
    }
Thank You
public static map<String, String> contactsave(String lstRecordId){
        system.debug('contactid'+lstRecordId);
        String data =  lstRecordId.substring(1, lstRecordId.length()-1);
        String data1 = '{'+data+'}';
        system.debug('contactid'+data1);
        ContactObject.Contact contacts = (ContactObject.Contact)JSON.deserialize(data, ContactObject.Contact.class); 
        system.debug('contactid'+data);
        system.debug('contacts=='+contacts);
        list<ContactObject.CustomerAccount> custacc = contacts.customerAccounts; 
        system.debug('contacts=='+custacc);
        system.debug('contacts=='+contacts.customerAccounts);
        system.debug('id'+contacts.birthDate);
        //return 'hii';
        //List < String > oErrorMsg = new List < String > ();
        map < String, String > oErrorMsg = new map <String , String> ();
        
        list<Contact> conlist = [SELECT UUID__c From Contact WHERE UUID__c =: contacts.id];
        system.debug('conlist'+conlist);
        
        if(conlist.size() > 0){
           oErrorMsg.put(Label.CONTACT_SEARCH_ERROR_ALREADY_EXISTS, '');
        }
        else{

            Contact c = new Contact();
            //c.AccountId = contacts.Id;
            c.Salutation = contacts.title;
            c.FirstName = contacts.firstName;
            c.LastName = contacts.LastName;
            c.MiddleName = contacts.middleName;
            c.UUID__c = contacts.id;
            if(contacts.birthDate != null && contacts.birthDate != ''){
                c.Birthdate = Date.valueOf(contacts.birthDate);    
            }
            c.Contact_Status__c = contacts.status;
            
               c.Contact_Type__c = custacc[0].ContactRelationship.contactType;
               c.Contact_Usage__c = custacc[0].ContactRelationship.contactUsage;
            c.Imported__c = true;
            c.Home_Email__c = contacts.homeContact.emailAddress;
            c.Home_Fax__c = contacts.homeContact.faxNumber;
            c.HomePhone__c = contacts.homeContact.phoneNumber;
            c.Mobile_Phone_Number__c = contacts.homeContact.mobileNumber;
            c.HomePhone__c = contacts.homeContact.phoneNumber;
            c.HomePhone__c = contacts.homeContact.phoneNumber;
            try {
                insert c; 
                 
                  oErrorMsg.put(Label.CUSTOMER_SEARCH_INFO_CONTACTS_IMPORT_SUCCESSFUL, String.valueOf(c.id+contacts.id));
            } 
            catch(Exception e) {
                
                oErrorMsg.put(Label.CONTACT_SEARCH_ERROR_IMPORT, ''    );
                return oErrorMsg;
            }
           
        }
        
        return oErrorMsg;
    }
trigger UpdateCustomerPOField on AcctSeedERP__Purchase_Order__c (after insert) {

    list<id> pOrderLineId = new list<id>();
    list<id> sOrderId = new list<id>();
    List<AcctSeedERP__Sales_Order__c> salesOrderFieldToInsert = new List<AcctSeedERP__Sales_Order__c>();
    
    List<AcctSeedERP__Purchase_Order__c> purchase = [SELECT Id,Customer_PO__c,(SELECT Id,Name FROM AcctSeedERP__Purchase_Order_Lines__r ) FROM AcctSeedERP__Purchase_Order__c LIMIT 1];
    
    map<id, AcctSeedERP__Purchase_Order__c> purOrderLineIdpurOrderIdMap = new map<id, AcctSeedERP__Purchase_Order__c>();
    
    for(AcctSeedERP__Purchase_Order__c  purchaseOrder : purchase){
        for(AcctSeedERP__Purchase_Order_Line__c purchaseOrderLine : purchaseOrder.AcctSeedERP__Purchase_Order_Lines__r ) {
        pOrderLineId.add(purchaseOrderLine.Id);
        purOrderLineIdpurOrderIdMap.put(purchaseOrderLine.Id,purchaseOrder);
        }
    }
    
    list<AcctSeedERP__Sales_Order_Line__c> salesOrderLineList = [Select id, AcctSeedERP__Purchase_Order_Line__c,AcctSeedERP__Sales_Order__c From AcctSeedERP__Sales_Order_Line__c Where AcctSeedERP__Purchase_Order_Line__c In: pOrderLineId LIMIT 1];
    map<id, id> salesOrderLinePurOrderLineMap = new map<id, id>();
    map<id, list<AcctSeedERP__Sales_Order_Line__c>> salesOrderSalesOrderLineMap = new map<id, list<AcctSeedERP__Sales_Order_Line__c>>();
    
    for(AcctSeedERP__Sales_Order_Line__c salesOrderLine : salesOrderLineList){
     list<AcctSeedERP__Sales_Order_Line__c> tempList = salesOrderSalesOrderLineMap.get(salesOrderLine.AcctSeedERP__Sales_Order__c);
        sOrderId.add(salesOrderLine.AcctSeedERP__Sales_Order__c);
        salesOrderLinePurOrderLineMap.put(salesOrderLine.Id, salesOrderLine.AcctSeedERP__Purchase_Order_Line__c);
        salesOrderSalesOrderLineMap.put(salesOrderLine.AcctSeedERP__Sales_Order__c,tempList);
    }
    
    list<AcctSeedERP__Sales_Order__c> salesOrderList = [Select id,Customer_PO__c,(SELECT Id,Name,AcctSeedERP__Sales_Order__c FROM AcctSeedERP__Sales_Order_Line__r)  From AcctSeedERP__Sales_Order__c Where Id In: sOrderId LIMIT 1];
    
    for(AcctSeedERP__Sales_Order__c salesOrder : salesOrderList){
    
        List<AcctSeedERP__Sales_Order_Line__c> SalesOrderLineId = salesOrderSalesOrderLineMap.get(salesOrder.Id);
        
        for(AcctSeedERP__Sales_Order_Line__c salesOrderLine : SalesOrderLineId){
        
            
            Id purOrderLineId = salesOrderLinePurOrderLineMap.get(salesOrderLine.Id);
            
            for(AcctSeedERP__Purchase_Order_Line__c purOrderLine : purOrderLineId){
            
            AcctSeedERP__Purchase_Order__c purOrder = purOrderLineIdpurOrderIdMap.get(purOrderLine.Id);
            purOrder.Customer_PO__c = salesOrder.Customer_PO__c;
            salesOrderFieldToInsert.add(purOrder);
            }
        }
    }
    
    if(salesOrderFieldToInsert.size()>0){
            insert salesOrderFieldToInsert;
            }
}

How i update the value of purchase order to sales order can anyone help me..
Thanx
trigger UpdateCustomerPOField on AcctSeedERP__Purchase_Order__c (after insert) {

    list<id> pOrderLineId = new list<id>();
    list<id> sOrderId = new list<id>();
    List<AcctSeedERP__Sales_Order__c> salesOrderFieldToInsert = new List<AcctSeedERP__Sales_Order__c>();
    
    List<AcctSeedERP__Purchase_Order__c> purchase = [SELECT Id,Customer_PO__c,(SELECT Id,Name FROM AcctSeedERP__Purchase_Order_Lines__r ) FROM AcctSeedERP__Purchase_Order__c LIMIT 1];
    
    map<id, id> purOrderLineIdpurOrderIdMap = new map<id, id>();
    
    for(AcctSeedERP__Purchase_Order__c  purchaseOrder : purchase){
        for(AcctSeedERP__Purchase_Order_Line__c purchaseOrderLine : purchaseOrder.AcctSeedERP__Purchase_Order_Lines__r ) {
        pOrderLineId.add(purchaseOrderLine.Id);
        purOrderLineIdpurOrderIdMap.put(purchaseOrderLine.Id,purchaseOrder.Id);
        }
    }
    
    list<AcctSeedERP__Sales_Order_Line__c> salesOrderLineList = [Select id, AcctSeedERP__Purchase_Order_Line__c,AcctSeedERP__Sales_Order__c From AcctSeedERP__Sales_Order_Line__c Where AcctSeedERP__Purchase_Order_Line__c In: pOrderLineId LIMIT 1];
    map<id, id> salesOrderLinePurOrderLineMap = new map<id, id>();
    map<id, list<AcctSeedERP__Sales_Order_Line__c>> salesOrderSalesOrderLineMap = new map<id, list<AcctSeedERP__Sales_Order_Line__c>>();
    
    for(AcctSeedERP__Sales_Order_Line__c salesOrderLine : salesOrderLineList){
     list<AcctSeedERP__Sales_Order_Line__c> tempList = salesOrderSalesOrderLineMap.get(salesOrderLine.AcctSeedERP__Sales_Order__c);
        sOrderId.add(salesOrderLine.AcctSeedERP__Sales_Order__c);
        salesOrderLinePurOrderLineMap.put(salesOrderLine.Id, salesOrderLine.AcctSeedERP__Purchase_Order_Line__c);
        salesOrderSalesOrderLineMap.put(salesOrderLine.AcctSeedERP__Sales_Order__c,tempList);
    }
    
    list<AcctSeedERP__Sales_Order__c> salesOrderList = [Select id,Customer_PO__c,(SELECT Id,Name,AcctSeedERP__Sales_Order__c FROM AcctSeedERP__Sales_Order_Line__r)  From AcctSeedERP__Sales_Order__c Where Id In: sOrderId LIMIT 1];
    
    for(AcctSeedERP__Sales_Order__c salesOrder : salesOrderList){
    
        List<AcctSeedERP__Sales_Order_Line__c> SalesOrderLineId = salesOrderSalesOrderLineMap.get(salesOrder.Id);
        
        for(AcctSeedERP__Sales_Order_Line__c salesOrderLine : SalesOrderLineId){
        
            AcctSeedERP__Purchase_Order_Line__c purOrderLineId = salesOrderLinePurOrderLineMap.get(salesOrderLine.Id);
            
            for(AcctSeedERP__Purchase_Order_Line__c purOrderLine : purOrderLineId){
            AcctSeedERP__Purchase_Order__c purOrder = purOrderLineIdpurOrderIdMap.get(purOrderLine.Id);
            purOrder.Customer_PO__c = salesOrder.Customer_PO__c;
            salesOrderFieldToInsert.add(purOrder);
            }
        }
    }
    
    if(salesOrderFieldToInsert.size()>0){
            insert salesOrderFieldToInsert;
            }
}
i have purchace order as master and purchase order line as child and for purchase order line is lookup to sales order line which is child of sales order i want a field value(Customer PO#) on purchase order to display on sales order..i want to write a trigger on purchase order (after update) and update the field of sales order...how its done..can u help me..
How to add update event on this code and how i write test class for this, i am new can any one help me..
trigger UpdateCustomerPO on AcctSeedERP__Sales_Order_Line__c (after insert,after update) {

Map<ID, AcctSeedERP__Sales_Order__c> parentSalesOrder = new Map<ID, AcctSeedERP__Sales_Order__c>(); 
  
  List<Id> listIds = new List<Id>();

  for (AcctSeedERP__Sales_Order_Line__c childObj : Trigger.new) {
    listIds.add(childObj.AcctSeedERP__Sales_Order__c);
  }


  parentSalesOrder = new Map<Id, AcctSeedERP__Sales_Order__c>([SELECT id,(SELECT ID, Customer_PO__c FROM AcctSeedERP__Sales_Order_Line__r) FROM AcctSeedERP__Sales_Order__c WHERE ID IN :listIds]);

  for (AcctSeedERP__Sales_Order_Line__c sales: Trigger.new){
     AcctSeedERP__Sales_Order__c myParentOpp = parentSalesOrder.get(sales.AcctSeedERP__Sales_Order__c);
     myParentOpp.Customer_PO__c = sales.Customer_PO__c;
  }

  update parentSalesOrder.values();
}
Thank You
  <apex:pageblock >
            <apex:pageblockTable value="{!busterSetting}" var="c">
                <apex:column value="{!c.Name}"/>
                <apex:column value="{!c.Object_Name__c}"/>
                <apex:column value="{!c.Field_List__c}"/>       
                <apex:column value="{!c.Layout_Name__c}"/>
            </apex:pageblockTable>

This is my vf shows hear when i open this page its call the custom settings and set all fields but i want to show records which have only particular Layout_Name__c like(which records have Layout_Name__c = search) only show other can not show on my page..
Thanx
public class NewDulplicateBusterJobController{

    private String BusterJobName;
    
    public String getBusterJobName() {
        return this.BusterJobName;
    }
    public void setBusterJobName(String BusterJobName) {
        this.BusterJobName = BusterJobName;
    }

    public NewDulplicateBusterJobController(ApexPages.StandardController controller) {
            selectedObject = 'account';
            getObjectFields();
    }

    public Map <String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
    public String selectedObject {get; set;}
    public SelectOption[] selectedFields { get; set; }
    public SelectOption[] allFields { get; set; }
    public String message { get; set; }

    Public NewDulplicateBusterJobController(){
            
           
    }

    public List<SelectOption> getObjectNames(){
        List<SelectOption> objNames = new List<SelectOption>();
            for (Schema.SObjectType obj : schemaMap.values()){
                    Schema.DescribeSObjectResult describeSobject = obj.getDescribe();
                    String Name = describeSobject.getName();
                    String Label = describeSobject.getLabel();
                    if(Name == 'Account' || Name == 'Contact' || Name == 'Lead' || Name == 'Opportunity' || Name == 'Case' || Name == 'KnowledgeArticle' || describeSobject.isCustom()==true){
                        SelectOption so = new SelectOption( Name , Label );
                        objNames.add(so);
                        objNames.sort();
                        system.debug('--objNames--' +objNames);
                        List<SelectOption> allFields = getObjectFields();
                    }
            }
            return objNames;
    }
    
    public List<SelectOption> getObjectFields(){
            selectedFields = new List<SelectOption>();
            Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
            Schema.SObjectType ObjectSchema = schemaMap.get(selectedObject);
            Map<String, Schema.SObjectField> fieldMap = ObjectSchema.getDescribe().fields.getMap();
           
            allFields = new List<SelectOption>();
            for (String fieldName: fieldMap.keySet()) {  
                    allFields.add(new SelectOption(fieldMap.get(fieldName).getDescribe().getName(),fieldMap.get(fieldName).getDescribe().getName()));
                    allFields.sort();
            }
            
            return allFields;
    }

}


<apex:page standardController="Buster_Job__c" extensions="NewDulplicateBusterJobController" > <apex:form > <apex:pageBlock title="Duplicate Filter Edit"> <apex:pageblockButtons location="top"> <apex:commandButton value="Save" /> <apex:commandButton value="Save & Start" /> <apex:commandButton value="Cancel"/> </apex:pageblockButtons> <apex:pageBlockSection title="Filter Name" collapsible="false" columns="2"> <apex:pageBlockSectionItem > <apex:outputLabel value="Buster Job Name:"></apex:outputLabel> <apex:inputText title="Buster Job Name" value="{!BusterJobName}" required="true"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockSection title="Select Standard or Custom Object" columns="2"> <apex:pageBlockSectionItem > <apex:outputlabel value="Object:"/> <apex:actionRegion > <apex:selectList value="{!selectedObject}" size="1"> <apex:selectOptions value="{!ObjectNames}"/> <apex:actionSupport event="onchange" rerender="myFields"/> </apex:selectList> </apex:actionRegion> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockSection title="Select a Field and Its Rule"> <apex:pageblocksectionitem > <apex:outputPanel id="myFields"> <c:MultiselectPicklist leftLabel="Available Fields" leftOption="{!allFields}" rightLabel="Selected Fields" rightOption="{!selectedFields}" size="14" width="150px"/> </apex:outputpanel> </apex:pageblocksectionItem> </apex:pageblocksection> </apex:pageBlock> </apex:form> </apex:page>
trigger updateProjectTeammember on opportunityTeamMember(after insert, after update, after delete){
        if(trigger.isInsert || trigger.isUpdate){
        
        Map<String,String> OppOtmfieldMap=new Map<String,String>();
               OppOtmfieldMap.put('Sr. Client Insights Manager','CEM_Assigned__c');
               OppOtmfieldMap.put('Client Insights Manager','CEM_2nd__c');
               OppOtmfieldMap.put('Data Manager','Ops_Owner__c');
               OppOtmfieldMap.put('Lead Consultant','Consultant_assigned__c');
               OppOtmfieldMap.put('Support Consultant','Consultant_2nd__c');
               OppOtmfieldMap.put('Analysis Support','Analysis_Support__c');
               OppOtmfieldMap.put('BD/Development Partner','BD_Development_Partner__c');
        
        Map<String,String> projOtmfieldMap=new Map<String,String>();
               projOtmfieldMap.put('Sr. Client Insights Manager','Sr_Client_Insights_Manager__c');
               projOtmfieldMap.put('Client Insights Manager','Client_Insights_Manager__c');
               projOtmfieldMap.put('Data Manager','Ops_Manager__c');
               projOtmfieldMap.put('Lead Consultant','Lead_Consultant__c');
               projOtmfieldMap.put('Support Consultant','Support_Consultant__c');
               projOtmfieldMap.put('Analysis Support','Analysis_Support__c');
               projOtmfieldMap.put('BD/Development Partner','BD_Development_Partner__c');
        
            list<id> oppoIdList = new list<id>();
            map<id, id> oppoOtmMap = new map<id, id>();
            list<id> proMemList = new list<id>();
            map<id, id> oppIdProIdMap = new map<id, id>();
            list<id> proId = new list<id>();
            Map<Id,Opportunity> oppIdMap = new Map<Id,Opportunity>();
            Map<id, id> oppIdAccIdMap = new Map<id, id> ();
            Set<id> accId=new Set<Id>();
            
        for(OpportunityTeamMember otm : trigger.new){
                        OppoIdList.add(otm.OpportunityId);
                        oppoOtmMap.put(otm.Id, otm.OpportunityId);
            }
        
        map<id, list<Project__c>> oppIdProjectListMap = new map<id, list<Project__c>>();
        list<Opportunity> oppoList = [select Id, accountId, Project__c, (Select Id, Name from Project__r) From opportunity Where Id In: oppoIdList];
        system.debug('--oppoIdList--' +oppoIdList);
        for(Opportunity op : oppoList){
            proId.add(op.id);
            oppIdMap.put(op.id,op);
            accId.add(op.accountId);
            oppIdAccIdMap.put(op.id, op.accountId);
           // oppIdProIdMap.put(op.id, op.Project__c);
            oppIdProjectListMap.put(op.id, op.Project__r);
            }
                
        list<Project_Team__c> ptmListForInsert = new list<Project_Team__c>();
        system.debug('--proId--' +proId);
        system.debug('--accId--' +accId);
        system.debug('--oppIdProIdMap--' +oppIdProIdMap);
        system.debug('--oppIdAccIdMap--' +oppIdAccIdMap); 
        
        list<Project_Team__c> ptmList = [Select id, Account__c, Project__c, Member_Role__c, Team_Member__c From Project_Team__c Where Id In: proId];
        map<id, list<Project_Team__c>> proPtmMap = new map<id, list<Project_Team__c>>();
        
        for(project_Team__c ptm : ptmList){
        
            list<project_Team__c> tempList = proPtmMap.get(ptm.Project__c);
            
            if(templist!= null && templist.Size()>0){
                tempList.add(ptm);
                }else{
                        tempList = new list<project_Team__c>();
                        tempList.add(ptm);
                }
                proPtmMap.put(ptm.Project__c, tempList);
            }
        
        for(OpportunityTeamMember otm : trigger.new){
        
            Boolean flag = false;
           
            List<project__c> listOfProj = oppIdProjectListMap.get(otm.OpportunityId);
            
            for(Project__c pro : listOfProj){
            List<project_team__c> listOfPrjTm = proPtmMap.get(pro.id);
            
            
            if(listOfPrjTm!= null){
                for(Project_Team__c ptm : listOfPrjTm){
                    if(otm.userId == ptm.Team_Member__c){
                        flag =true;
                        }
                    }
                }
                if(flag ==true){
                }else{
                    Project_Team__c ptm1 = new Project_Team__c();
                    ptm1.Team_Member__c= otm.userId;
                    ptm1.Member_Role__c = otm.TeamMemberRole;
                    ptm1.Account__c = oppIdAccIdMap.get(otm.OpportunityId);
                    ptm1.Project__c = proPtmMap.get(otm.OpportunityId);
                    ptmListForInsert.add(ptm1);
                    system.debug('--ptm1--' +ptm1);
                    }
            }}
        if(ptmListForInsert.size()>0){

        insert ptmListForInsert;
            }
            
  }
}