0

I'm deploying all the code from a 1stGen Package to a new Scratch org, to improve our development/testing/release process.

There were a few deploy errors but I've fixed all but two types. This is one of them.

The deploy process reports:

\pages\QuickCreateWizard_Account.page                   Could not resolve the entity from <apex:inputField> value binding '{!acc.Name}'.  <apex:inputField> can only be used with SObjects, or objects that are Visualforce field component resolvable.
\pages\QuickCreateWizard_Contacts.page                  Unknown property 'String.name'                                                                                                                                                                 
\pages\QuickCreateWizard_Contract.page                  Unknown property 'String.Name'                                                                                                                                                                 
\pages\QuickCreateWizard_InspectionItems.page           Unknown property 'String.name'                                                                                                                                                                 
\pages\QuickCreateWizard_Schedule.page                  Unknown property 'String.name' 

All the pages use a StandardController and one extension class. In that class is defined: public Account acc {get;set;}

And it is this Account object that is causing the issues, when used like this:
<apex:inputField id="secFirId" styleClass="slds-input form_control" value="{!acc.name}" onchange="assignValueNull(this);" /> (for the first error)
or just
{!acc.name} for the other errors.

The pages work in our Dev Edition org - they deploy correctly and run correctly. So, there are no conflicting properties called acc and certainly not one defined as a string

The first line of the QuickCreateWizard_Account.page is
<apex:page showHeader="true" standardController="Account" extensions="QuickCreateWizardController" lightningStylesheets="true">\

Other properties and methods defined in the extension, both data types (boolean for example) or SObjects work as expected. It's just this one property that doesn't work, in the same way across several pages.

Any ideas? Thanks!

4
  • this smells of name shadowing -- do you have a class named acc by any chance? Also use edit and post the <apex:page first line
    – cropredy
    Commented May 16 at 23:32
  • @cropredy - First line added as requested. You are right I think about 'name shadowing'. But, the only place acc is defined, in the Extensions used by the page, is where it's defined as an Account. There are plenty of other Apex classes that do have lines like string acc but none are directly referenced on this page. The Extension class QuickCreateWizardController doesn't extend another class, Is there perhaps another way a property can be accessed, other than by defining it in a referenced Extension class?
    – cyberspy
    Commented May 17 at 9:58
  • Does your scratch org actually have Account as an sobject?
    – cropredy
    Commented May 17 at 16:40
  • @cropredy - yes, it does have an Account object.
    – cyberspy
    Commented May 20 at 8:05

1 Answer 1

0

I resolved the issue - I changed public Account acc in the apex extension to public Account acnt and changed it in the VF Pages too, and now these errors have gone.

It appears to be associating acc with a string object of the same name, but these pages work correctly in our Dev Ed org, and the package build/deploy process works correctly too, so why it's failing in this scratch deployment is still a bit of a mystery.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .