You need to sign in to do that
Don't have an account?
yogendra Aragula 8
After changing the pick list value ( A to B ) and clicking on update button the changes are not updating to the corresponding record Immediately.
After changing the pick list value ( A to B ) and clicking on update button the changes are not updating to the corresponding record Immediately. When i am again changing the pick list second time ( C to E ) the previous value is getting updated in the record (Ex: B ). Not sure what is wrong it the code. I know i am missing so thing in my update method..
Page :
Page :
<apex:page standardController="Client_Visit_Report__c" extensions="MatrixPageContoller" sidebar="true" showHeader="false"> <apex:sectionHeader title="Matrix of TP Attende" subtitle="Matrix Of Relationship"/> <style type="text/css"> .tpName{ font-weight: bolder; font-family: monospace; font-size: large; color : Blue; Backgroud:color : Green; } </style> <apex:form > <apex:pageMessages escape="false"/> <apex:pageBlock > <apex:pageBlockSection columns="1" title="Detailed Infromation" collapsible="false"> <apex:variable var="i" value="{!0}"/> <apex:repeat value="{!tpCliMap}" var="key" id="display" > <apex:variable var="i" value="{!i+1}"/> <apex:outputText value="TP Attendee {!i} ({!key})" styleClass="tpName"/> <apex:outputPanel id="YourPanel"> <apex:pageBlockTable value="{!tpCliMap[key]}" var="a" columns="5" title="Client Details" id="display"> <apex:column value="{!a.Client__c}" headerValue="Client Name" style="width:30%" id="tabledetail"/> <apex:column headerValue="Relationship Type" > <apex:inputField value="{!a.Relationship_Type__c}"> </apex:inputField> </apex:column> <apex:column headerValue="Relationship Grade" > <apex:inputField value="{!a.Relationship_Grade__c}"> </apex:inputField> </apex:column> <apex:column headerValue="Action" style="width:5%"> <apex:commandButton value="UPDATE" action="{!updateClientRelShip}" reRender="YourPanel"> <apex:param assignTo="{!relShipId}" value="{!a.Id}" name="Yogi"/> <apex:param assignTo="{!relShipType}" value="{!a.Relationship_Type__c}" name="Type"/> <apex:param assignTo="{!relShipGrade}" value="{!a.Relationship_Grade__c}" name="Grade"/> </apex:commandButton> </apex:column> <apex:column value="{!a.Previous_Grade__c}" headerValue="Previous Grade" style="width:40%"/> <apex:column value="{!a.Relationship_Grade_2__c}" headerValue="Current Grade" style="width:40%"/> <apex:column headerValue="Grade Status" value="{!a.Grade_Index__c}" style="width:5%"> </apex:column> </apex:pageBlockTable> </apex:outputPanel> </apex:repeat> </apex:pageBlockSection> </apex:pageBlock> </apex:form> <apex:tabPanel > <apex:tab label="Client Attendees" name="Client Attendees" > <apex:relatedList subject="{!Client_Visit_Report__c}" list="Client_Attendees__r"/> </apex:tab> </apex:tabPanel> </apex:page>
public with sharing class MatrixPageContoller { public String currentRecordId {get;set;} public List<Client_Visit_Report__c> cvrLst; public List<Id> tpLst; public List<Id> clientLst; public List<Id> ClientRelation; public List<Client_Relationships__c> cliRel; public Map<string, List<Client_Relationships__c>> tpCliMap{get;set;} public Client_Relationships__c crel{get;set;} public string selectedvalue1{get;set;} public string selectedvalue2{get;set;} public list<Contact> ConList {get;set;} public id relShipId {get; set { relShipId = value; } } public string relShipType{get; set { relShipType= value; } } public string relShipGrade{get; set { relShipGrade= value; } } public String newGrade{get; set { newGrade = value; } } //System.debug('============Id=============>>'+relShipId); // System.debug('=============Type============>>'+relShipType); //System.debug('=============Grade============>>'+relShipGrade); public MatrixPageContoller(ApexPages.StandardController controller) { relShipId = ApexPages.CurrentPage().getparameters().get('Yogi'); relShipType = ApexPages.CurrentPage().getparameters().get('Type'); relShipGrade = ApexPages.CurrentPage().getparameters().get('Grade'); //this.myLead = (Client_Relationships__c)controller.getrecord(); //selectedvalue2 = '(A) I can pick the phone up to this contact right now and discuss a contentious issue'; currentRecordId = ApexPages.CurrentPage().getparameters().get('id'); system.debug('PSM1 '+ currentRecordId); cvrLst = new List<Client_Visit_Report__c>([Select id,(Select Id, TP_Personnel__c From TP_Attendee__r), (Select Id, Contact_Name__c From Client_Attendees__r) From Client_Visit_Report__c where id =: currentRecordId]); system.debug('PSM2 '+ cvrLst); tpLst = new List<Id>(); clientLst = new List<Id>(); crel = new Client_Relationships__c(); for(Client_Visit_Report__c cv: cvrLst){ for(TP_Attendees__c tp: cv.TP_Attendee__r){ tpLst.add(tp.TP_Personnel__c); } for(Client_Attendee__c ca: cv.Client_Attendees__r){ clientLst.add(ca.Contact_Name__c); } } system.debug('PSM3 '+ clientLst.size()+ clientLst); system.debug('PSM4 '+ tpLst.size()+ tpLst); cliRel = new List<Client_Relationships__c>([select id,Grade_Index__c, TP_Employee__r.Name, Client__c, Relationship_Grade__c,Relationship_Grade_2__c,Previous_Grade__c, Relationship_Type__c from Client_Relationships__c where Client__c in:clientLst and TP_Employee__c in: tpLst]); system.debug('PSM5 '+ cliRel.size()); tpCliMap = new Map<string, List<Client_Relationships__c>>(); for(Client_Relationships__c cr: cliRel){ If(!tpCliMap.containsKey(cr.TP_Employee__r.Name)){ system.debug('Inside for if '+ cr); tpCliMap.put(cr.TP_Employee__r.Name, New List<Client_Relationships__c>()); } system.debug('Inside for else '+ cr); tpCliMap.get(cr.TP_Employee__r.Name).add(cr); } system.debug('tpCliMap '+ tpCliMap.values()); } public void updateClientRelShip() { relShipId = ApexPages.CurrentPage().getparameters().get('Yogi'); relShipType = ApexPages.CurrentPage().getparameters().get('Type'); relShipGrade = ApexPages.CurrentPage().getparameters().get('Grade'); System.debug('============Id=============>>'+relShipId); System.debug('=============Type============>>'+relShipType ); System.debug('=============Grade============>>'+relShipGrade ); Client_Relationships__c clientRelationShip = new Client_Relationships__c (id = relShipId, Relationship_Type__c = relShipType ,Relationship_Grade__c = relShipGrade ); Id myId = clientRelationShip.id; system.assertEquals(Schema.Client_Relationships__c.SObjectType, myId.getSobjectType()); update clientRelationShip; } }