Reputation: 899
I have added a new filed called WebAddress_Ext in Contact.etx file. After this I have validated the changes and restarted the server.
Now in ContactNameInputSet.company.pcf file I have added new InputText field and for value filed I've given the newly added WebAddress_Ext filed.
id = webAddress
label = "Web Address"
value = (contact as Company).WebAddress_Ext
Now I tried reloaded the page, then I'm getting the ClassCastException.
ClassCastException:entity.Person cannot be cast to entity.Company
I have checked that for the fields Primary Email and Secondary Email of Contact.eti they are using the below code to display the value.
id = PrimaryEmail
label = "Primary Email"
value = (contact as Company).EmailAddress1
We are not getting any error for PrimaryEmail, but why I'm getting ClassCastException error for new filed called WebAddress_Ext.
Upvotes: 0
Views: 365
Reputation: 41
While reloading the page in UI, the contact maybe typeof Person. So the contact can not be casted to company if its type is "Company".
Upvotes: 3