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
scoopscoop 

Account layout vs. required fields

Hi,

I have a query that I'm running against several different instances that includes some SFDC required fields like rating and sic code.  Even though these are required fields in SFDC if they are not in the account layout, the query seems to fail.  Is the account layout what determines if I can query against account fields?

Is there a way to have a field that does not show up to users but I can use to drive logic for my app? (If it is in some other obscure layout visible only to the sys admin would the query work then?)

Thanks,

Greg

DarlaDarla

I'm working on the same app and have some additional information...

The error described only happens with some accounts.  When I login to one account, the API_Partner_Server_URL from the web integration link is https://na1-api.salesforce.com/services/Soap/u/2.5, and the error does not happen.  I removed the "rating" field from the account page layout and can still query against it fine.

When I login with a different account, the server URL is https://ssl.salesforce.com/services/Soap/u/2.5, and the problem occurs.  If I remove the "rating" field and run a query that includes the rating, I get this error:

(soapenv:Fault)
  (faultcode)soapenv:Server(/faultcode)
  (faultstring)INVALID_FIELD: Bad field name 'rating' in select list of query call
  (/faultstring)
  (detail)
 (sf:fault xmlns:sf="urn:fault.partner.soap.sforce.com" xsi:type="sf:InvalidFieldFault")
   (sf:exceptionCode)INVALID_FIELD(/sf:exceptionCode)
   (sf:exceptionMessage)Bad field name 'rating' in select list of query call
   (/sf:exceptionMessage)
 (/sf:fault)
  (/detail)
(/soapenv:Fault)

Here is the query message:

(SOAP-ENV:Envelope xmlns:SOAP_ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sf="urn:partner.soap.sforce.com")
  (SOAP-ENV:Header)
    (sf:SessionHeader)
      (sf:sessionId)xxx(/sf:sessionId)
      (sf:version)2.5(/sf:version)
    (/sf:SessionHeader)
    (sf:QueryOptions)
      (sf:batchSize)100(/sf:batchSize)
    (/sf:QueryOptions)
  (/SOAP-ENV:Header)
  (SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/")
    (sf:query)
      (sf:queryString)select Name, ParentId, BillingStreet, BillingCity, BillingState, BillingPostalCode, BillingCountry, Phone, Fax, Website, Sic, Industry, AnnualRevenue, NumberOfEmployees, Ownership, TickerSymbol, Description, Rating, Site, LastModifiedDate from Account where Id = '00100000001ib9M'(/sf:queryString)
    (/sf:query)
  (/SOAP-ENV:Body)
(/SOAP-ENV:Envelope)

Any help is greatly appreciated...

=> Darla

 

adamgadamg
Not sure what the issue is here, but we'll get to the bottom of it - we've tried to clarify the behavior in the new doc. Layouts should not have an effect on fields in queries - permissions, of course, should. I'd be interested to hear what your experience is with sforce 3.0..
DarlaDarla

Hello,

I finally had a chance to try this in 3.0 and the behavior is the same.  I run the query initially and I get a InvalidFieldFault complaining that "Bad field name 'sic' in select list of query call".  I add SIC to the layout, run it again, and it's fine.

The error is still only occurring with one of the accounts I have access to.  I have gotten a parter URL of both https://ssl.salesforce.com/services/Soap/u/3.0 and https://na0-api.salesforce.com/services/Soap/u/3.0, depending on whether I use the WIL or API to login.

When I use a different account, I can remove SIC from the page layout and still run queries against it just fine.  There's no error, which is how I would expect things to work.  The partner URLs I get with that account are https://na1-api.salesforce.com/services/Soap/u/3.0 or https://na1.salesforce.com/services/Soap/u/3.0.

I don't know that the partner URL is related to the problem, it's just one difference I've noticed.

Is there something else I should be checking?  How do I see the permissions for the fields?  Is there any chance that adding the field to the layout is also changing its permission?

Please let me know if there's any additional information I can include that would help.

=> Darla