0

Im trying to get only the updated record from my current list.. Im using apex pageblocktable to show the current list, which is the contact field is empty (those data`s are from API response).. and users will insert the contact value from visualforce page..

enter image description here

When the users press the "Create Data" button.. the class will insert the updated list to custom object called Purecloud_Missing_Call_Log_Check__c..

How do I get the updated specific record from the list?

for(string records: listFinalRecord)
                    {
                        List<string> recordFinal = records.split(';');

                        Purecloud_Missing_Call_Log_Check__c missingCall = new Purecloud_Missing_Call_Log_Check__c ();
                        missingCall.conversation_Id__c = recordFinal[0]; //Conversation ID
                        missingCall.Participant_Id__c = recordFinal[1]; //Participant ID
                        missingCall.Agent_Name__c = recordFinal[2]; //Agent Name or Purpose (Customer)
                        missingCall.Entity__c = recordFinal[3]; //Entity
                        missingCall.Phone_Number__c = recordFinal[4]; //Phone Number

                        for (Task tsk : allCurrentTask){
                            if (recordFinal[0] == tsk.CallObject && recordFinal[1] == tsk.Purecloud_Participant_Id__c){
                                missingCall.Check__c = True;
                                break;
                            }
                            else {
                                missingCall.Check__c = False;
                            }
                        }

                        taskList.add(missingCall);
                    } 
                    //insert taskList;

This is the VF table :

<apex:pageBlockSection title="Call Log List">
        <apex:pageBlockTable id="idpbt" var="var" value="{!tasklist}" style="overflow:auto;width:1000px;" border="1">
            <apex:column headerValue="Call ID" value="{!var.Conversation_ID__c}"></apex:column>
            <apex:column headerValue="Participant ID" value="{!var.Participant_ID__c}"></apex:column>
            <apex:column headerValue="Phone Number" value="{!var.Phone_Number__c}"></apex:column>
            <apex:column headerValue="Contact" >
                <apex:inputField Id="Contact" value="{!var.Contact__c}" rendered="{!IF((var.Check__c == True),False,True)}"/>
            </apex:column>
            <apex:column headerValue="User / Agent" value="{!var.Agent_Name__c}"></apex:column>
            <apex:column headerValue="Entity" value="{!var.Entity__c}"></apex:column>
            <apex:column headerValue="Check">
                <apex:inputCheckbox disabled="true" id="checkbox" value="{!var.Check__c}"/>
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlockSection>
0

You can create a set and add all records from tasklist at the initial stage, while saving you can check if set contains the object. Set's contains method return true it means record is not changed. If it returns false it means some field(s) on record is/are changed. You can collect all records which returns false.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.