0

Whenever i click on lookup first time i am getting the contact id, But when i click on the same lookup and select any other contact then its throwing error. Please need some help

    <apex:pageblocktable value="{!lstWrapContactRoles}" var="cr" id="pbt" >
<apex:column headerValue="Contact">
<apex:inputfield value="{!cr.objConRole.Contact__c}" onchange="if(this.value){addfunc();}" id="conId"/> <!-- US 410 -->
</apex:column>
</apex:pageblocktable>

<apex:actionfunction name="addfunc" action="{!addNew}" reRender="pbt" oncomplete="codeAddress();checkboxuse();"/>

Class.

 public void addNew() {
    contact objcontact = new contact();
    system.debug('==--'+lstWrapContactRoles);
    system.debug('lstWrapContactRoles[lstWrapContactRoles.size()-1].objConRole.Contact__c==='+lstWrapContactRoles[lstWrapContactRoles.size()-1].objConRole.Contact__c);
    }

1st debug gives the list of wrapper 2nd gives me the contact id.

  • I would suggest for consistent behaviour, send parameters from Actionfunction to Apex class using Apex:Param tag. – salesforcewithfunforce Feb 2 at 18:17

Your Answer

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

Browse other questions tagged or ask your own question.