How can we add currencyIsoCode field to every model in a skuid page conditionally if the org is multi currency enabled?

  • 1
  • Problem
  • Updated 2 years ago
  • Solved
  • (Edited)
We have added support for multi-currency in our package which includes skuid pages too but now when we try to open those pages in an org which doesn't have multi-currency enabled, the page is throwing an error stating it couldn't find currencyIsoCode on this model object. It's happening because skuid page XML has reference to currencyIsCode which is not present in the org. 
Now one workaround we can have is creating two skuid pages for each layout, one for multi-currency enabled org and one for normal org's. But I'm sure there should be an efficient way to achieve this without page duplication.

Can we add/remove field to a model based on org multi-currency enabled condition? How can we find out from skuid that the related org is multi-currency enabled or not?
Any urgent help is highly appreciated. 
Photo of Ashish Kumar Singh

Ashish Kumar Singh

  • 300 Points 250 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 54,226 Points 50k badge 2x thumb
Official Response

First of all, in Multi-currency Orgs, Skuid automatically queries for the CurrencyIsoCode field on all Models where a Field whose Display Type is CURRENCY is included. This is done across relationship fields as well.

For example, if you were had a Model on the Opportunity object and requested the Amount field, Skuid would automatically query for the CurrencyIsoCode field because Amount, a Currency field, was requested.

The nice thing about this for your scenario is that you can rely on Skuid querying for this field, so you don't have to.

However, this does not necessarily help you if you are trying to add the CurrencyIsoCode field to the UI so that users can modify it, as Skuid does not currently pull down the field metadata for the CurrencyIsoCode field automatically. 

Here's my recommended approach:

1. Include the CurrencyIsoCode in the Model, and in any UI Components as appropriate.
2. At runtime, for users in non-multi-currency orgs, Skuid will automatically, gracefully strip out the CurrencyIsoCode field from any Models that request it, as well as from UI Components, e.g. Tables, where the field is referenced. The red error message (a "Page Problem" in Skuid terminology) that you are seeing will NOT appear for normal Users --- this message only appears to Users that have the ability to edit Skuid Pages. So as long as your customers have their Skuid Permissions correctly setup so that they do NOT have the ability to edit Skuid Pages, they will not see this error message.

On the Skuid side, we'll talk this over, but to me right now it seems like we should just hide the red error message automatically for users in non-multi-currency enabled orgs. We could be smarter about the error and say "The field being requested is CurrencyIsoCode, but this is not a Multicurrency org. Don't display the error message we usually would, just strip the field from the Model at query-time like we already do, and move on".