I have a model called KeyIndicators with a bunch of UI-only fields that reference other models. The other models in this case are created dynamically, there could be between 0 and 38 of these other models based on the user’s choice (M0-M24 and Q0-Q12). The UI-only fields were using MODEL_LOOKUP formulas to get the values of these other models, and there was no error when that model didn’t exist, for example if there was not a model called M12, the formula MODEL_LOOKUP(“M12”,“avgValuec”, “Indicator__c”, {{Id}}) didn’t break the page, that field was just blank.
However, I’m switching these dynamic models from aggregate to non-aggregate, so I can get at a median value if needed. So now I’m using the custom formulas posted to github, such as
AGG__MEDIF(“M12”,“Value__c”,“Indicator__c”, {{Id}}, false)
This works great unless there is not a model called M12, then I get an error, invalid model in function.
Ok so fine, I’ll create my base model KeyIndicators dynamically as well, and only create those UI-only fields that I need based on knowing which models exist. Probably better anyway because it’s likely to load faster (there are 8 ui-only fields for each model).
However, for other reasons it’s really nice to have a non-dynamically created model because there’s a lot of functionality on the page tied to KeyIndicators, including a table and filters and such.
So my question is, is there a way to insert fields into the xml of a model that already exists using a javascript snippet?
What I may do is dynamically create a new model, KeyIndicatorFields, and then continue using MODEL_LOOKUP on the main KeyIndicators model…
Page 1 / 1
As a side note - has anyone else noticed that when you dynamically create models you cannot reference page parameters?
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.