You need to sign in to do that
Don't have an account?
aka_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>
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
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?
do you have any trigger on tasks?
No.
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?
After some additional testing, I found that the page works if you edit an existing one, but will not add a new one.
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 .
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?
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!!