You need to sign in to do that
Don't have an account?
sessu
Visual force page error
Hi I trying to insert values in two standard objects fields through page I have created a look up relation for contact from product, an error is displaying and i am not able to understand where i have done mistake. please help me.... ERROR: Error: Could not resolve the entity from value binding '{!product2.Contacts__r.Cloth__c}'. inputField can only be used with SObject fields.
Letter of Request for Purchase |
Dear Mr.{!Product2.Product_Person__c}! |
I request to purchase Materials used in Garments, from the{!product2.name}The intent to purchase this Material would be approved/accepted by our Organization after getting the Quotation. | |
* Cloth Required | |
* Thread Required | |
* Buttons | |
Yours Sincerely... | {!product2.Contacts__r.name} |
When you use an InputField you cannot bind it to formula fields. You need to create an instance of the Cloth__c, have it accessable as a public attribute, then bind it to the inputField on your VF Page.
When you do a field like Product2.Contacts__r.Cloth__c, Apex / SOQL is treating this as a Forumla Field becuase its calculating that value at runtime from the parent record fields. You cannot update Formula Fields, so a inputField will not bind to that value.
Its simple enough to resolve as I said. When you query for the Product2 table, also Query for the Contact records based on Contact__c filed on the Product. Store those Contacts in your controller, and bind your inputFields to those Contact records.