Unable to grab the value from the billingpostalcode from a related account

I have a mass action popup in a table that creates a new record. On this new record is a reference to an account(Firm__c). I need to get the account’s billingpostalcode and copy that value to a field on the new record. I’m using actions on the model but it does not pull the value for billingpostalcode. As a sanity check I used the billingstate field and that works great.

It’s like Skuid is not pulling in billingpostalcode. I do have billingpostalcode selected under the fields.

!(https://us.v-cdn.net/6032350/uploads/attachments/RackMultipart20160413-34481-1axys3z-download 1 inline.png)

Does your account have permission to see the BillingPostalCode field?

Yes it does.  I can update this field on the account page no problem.

Can you double-check field level security on that field for your profile. There are times (especially for System Administrators) when standard salesforce pages let them do things that if you checked the actual metadata info would not allow them to do.

yes field level security is set correctly(BillingAddress).

by the way…this org has person accounts enabled.

Sorry for all the dumb questions, but does the record in question actually have a value for BillingPostalCode? When Salesforce serializes sObjects, if a value is null, it leaves it out completely.

yes it does

 Id Account.Name Account.BillingPostalCode

1a0Q55000000bNR3EAM LPL Financial LLC (RIA)  10013

  1. Object
    1. Id:"1"
    2. Id15:"1"
    3. RPS_Firm__c:"0015500000CkX3hAAF"
    4. RPS_Firm__r:Object
      1. BillingCity:"New York"
      2. BillingState:"NY"
      3. BillingStreet:"123 main"
      4. Id:"0015500000CkX3hAAF"
      5. Id15:"0015500000CkX3h"
      6. Name:"LPL Financial LLC (RIA)"
      7. Parent:Object
      8. ParentId:"0015500000CkX3fAAF"
      9. RecordTypeId:"012550000008hRfAAI"
      10. Type:"RIA Firm"
      11. __templabel:"LPL Financial LLC (RIA)"
      12. attributes:Object
      13. __proto__:Object
    5. RPS_Zip_Code__c:"NY"
    6. RecordType:Object
    7. RecordTypeId:"012550000008j8QAAQ"

hey Ben…anything else you can think of to check here.  I feel like there is something up with the BillingPostalCode field.  I even tried creating a formula field for it and the value in the formula field is empty.  It’s almost like Squid doesn’t see it in the metadata.

You could try running this anonymous apex and see what the result of that debug is.

System.debug(Account.BillingPostalCode.getDescribe().isAccessible());

It should be true.

Hey Jamie,

John actually showed me the page you’re working on. It looks like you added some search fields manually via XML to the SOSL lookups on RPS_Firm__c. For BillingPostalCode to return correctly, I believe it needs to be in the list of search fields as well.

If you added this…

I believe it should work correctly. Does that make sense? We have an outstanding issue to address allowing you to add “searchfields” in the Page Composer for SOSL lookups.

I am aware of that issue which is why I added those fields in the XML.  I added the line you are showing here but it still doesn't work.


As a sanity check...

``` 35.0 APEX_CODE,DEBUG Execute Anonymous: System.debug(Account.BillingPostalCode.getDescribe().isAccessible()); 15:27:01.38 (38433641)|EXECUTION_STARTED 15:27:01.38 (38452467)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex 15:27:01.38 (40211525)|USER_DEBUG|[1]|DEBUG|true 15:27:01.38 (40273216)|CODE_UNIT_FINISHED|execute_anonymous_apex 15:27:01.38 (41279111)|EXECUTION_FINISHED ```

Here is the response from the console.  And yes...BillingPostalCode has a value.

skuid.$M('NewSalesTerritory').data[0].RPS_Firm__r.BillingState
"California"
skuid.$M('NewSalesTerritory').data[0].RPS_Firm__r.BillingPostalCode
undefined

Hi Jamie,

I looked at the XML for your page and I saw the change you made. I think you need to make that same change in one other place. Can you try adding that line of code into the other “searchfields” section and let me know how it goes?

Thank you Ben!  that was it....although I'm not sure why.

Yeah, this is a bit tricky, but I’ll try to explain.

When Skuid loads, it gets everything it needs for all of your models. This is any metadata about the objects (picklist values, display types, etc), as well as the actual records contained in the model. In the case of your NewSalesTerritory model, it starts out with no data. Once the page is loaded, Skuid does not communicate with the server again until a model requests a reload or a save.

In your case, when the popup is opened and a Firm record is searched for, Skuid makes a request to salesforce to bring back data on all of the Firms that match your search criteria. The “searchfields” configuration tells Skuid which fields to query on the Firms that you’re searching for. Once you select a Firm, Skuid automatically transfers data from the search response into your NewSalesTerritory model. If you don’t tell Skuid to search for the “BillingPostalCode” field, it will not be able to transfer it over to your NewSalesTerritory model.

Anyways, I hope that helps.