function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
aka_floaka_flo 

Validation Error Message

Hi -

 

I am getting the following error message on my visualforce page and not sure I understand what is wrong with my call for WhoID :  There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Contact/Lead ID: id value of incorrect type: 001C000000qyLZqIAM".

 

This is my code.  Any Thoughts?

 

<apex:page standardController="Task" sidebar="true"> 
    <style>
textarea { width:60%; }
</style>
        <apex:form > 
          <apex:pageBlock title="Task Edit" id="thePageBlock" mode="edit"> 
            <apex:pageBlockButtons > 
                    <apex:commandButton value="Save" action="{!save}"/>
                    <apex:commandButton value="Cancel" action="{!cancel}"/>                 
            </apex:pageBlockButtons> 
             <apex:actionRegion > 
                <apex:pageBlockSection title="Task Information" columns="2"> 
                         <apex:inputField value="{!Task.Ownerid}" required="true"/>
                        <apex:inputField value="{!Task.Whatid}" required="true"/>
                        <apex:inputField value="{!Task.subject}" required="true"/>
                        <apex:inputField value="{!Task.Whoid}" />
                        <apex:inputField value="{!Task.Priority}" required="true"/>
                        <apex:inputField value="{!Task.Due_Date__c}" required="true"/> 
                        <apex:inputField value="{!Task.Status}" required="true"/>                    
                  </apex:pageBlockSection>
                 <apex:pageBlockSection title="Details" columns="1"> 
                         <apex:inputField value="{!Task.Task_Plan__c}" required="true"/> 
                        <apex:inputField value="{!Task.Description}" />    
                         <apex:inputField value="{!Task.Duration_of__c}" />                       
                 </apex:pageBlockSection>
                 <apex:pageBlockSection columns="2"> 
                         <apex:inputField value="{!Task.Days_Until_Due__c}" /> 
                        <apex:inputField value="{!Task.Days_Old__c}" />    
                 </apex:pageBlockSection>
                </apex:actionRegion>
           </apex:pageBlock> 
     </apex:form> 
 </apex:page>

 


SeAlVaSeAlVa

It seems to be expecting a Contact or a Lead and you are providing an Account.

 

you might need to set it as whatID instead of whoID

aka_floaka_flo

I am confused.  Isn't the WhoID intended to provide the option to select a Contact or a Lead?  Why would it be receiving an Account ID when trying to load the page?

SeAlVaSeAlVa

do you have any trigger on tasks?

aka_floaka_flo

No.

aka_floaka_flo

I removed the line in the code for WhoId.  However, the submitt button simply refreshes the page instead of submitting.  Does anyone have any ideas on why this would be happening? 

 

I am using very similar code on a different object and it is working just fine.  Did I possibly missing something different about tasks?

aka_floaka_flo

After some additional testing, I found that the page works if you edit an existing one, but will not add a new one.

SeAlVaSeAlVa

when the page is refreshing after submit, it is because of an error.

 

Add a <apex:pageMessages /> between <apex:form> and <apex:pageBlock> and we'll see what happens .

aka_floaka_flo

It is spitting out the same message on the page even with Whoid removed.  I am not calling the WhoID and the WhatID accurately to the standard Related To and Contact lookup fields to appear on the page?

aka_floaka_flo

I am still searching for a solution on this one!  Does anyone have any insight?

 

It appears that the standardcontroller is expecting me to do something with a Contact/Lead ID -- Contact/Lead ID: id value of incorrect type: 001C000000qwTjqIAE.

 

However, when I put <apex:inputField value="{!Task.whoid}" /> to capture this ID, the page will not even compile.  Any ideas would be greatly appreciated!!