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

  • 1
  • Problem
  • Updated 3 years ago
  • Solved

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.





Photo of Jaime

Jaime

  • 1,220 Points 1k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Does your account have permission to see the BillingPostalCode field?
Photo of Jaime

Jaime

  • 1,220 Points 1k badge 2x thumb

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.


Photo of Jaime

Jaime

  • 1,220 Points 1k badge 2x thumb

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

Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
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?
Photo of Jaime

Jaime

  • 1,220 Points 1k badge 2x thumb

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

Photo of Ben Hubbard

Ben Hubbard, Employee

  • 12,490 Points 10k badge 2x thumb
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.