Ok, admittedly this one probably wouldn’t be used much but I actually have a specific need for this currently and the solution I’ve come up with just doesn’t scream “obvious to the untrained eye.”
Would be great to be able to define a condition on a model that evaluates a dynamic value against something other than a field value.
Here’s my current use case:
I have a page that has 3 models. On clone, I only want to clone Model #1 & Model #2. This works perfectly by setting those models to ‘yes, if clone parameter is specified in URL’. However, for Model #3, not only do I not want it cloned but I don’t want it populated at all. My page handles New & Existing records so even if I set Model #3 to clone = ‘no’, the model contains the records of the id in the url parameter.
Ask:
Add the ability to specify a condition where the “left side” of the operation can be something other than a model field (e.g. Param value). If this existed, I set Model #3 to “clone=no” and include a condition where “Clone in URL parameter is blank”. This would give me a cloned #1 & #2 and an empty #3.
Current Workaround
Define a condition on Model #3 evaluating against "Id’ field using the URL Parameter “clone” and deactivating condition if parameter doesn’t exist. When “clone” is in URL, this will result in the where clause evaluating "Id = ‘clone’) which will return no results and an empty model.
Thanks!
Came across another use case for this…
We have models that have multiple record types. When building a tab page, we only want to display certain objects based on a set of criteria. Users have access to all the objects so the built in security of SFDC won’t filter out records based on authorization.
To accomplish the goal, we have a condition on the model (e.g. RecordType = TypeXXX). However, this requires one of two things:
1) Programatically modifying the condition and requerying model on page load
2) Having multiple pages, one for each set of evaluation criteria
If a model condition could be created that allowed the left side to be things like field in another model, url parameter, userinfo, etc. this would allow us to have a single page to serve all purposes and avoid having to write code to accomplish
A very basic example would be Model Conditions that look something like:
1: RecordType = Type1
2: RecordType = Type2
3: FieldInAnotherModel = true
Then the Grouping Logic would be:
1 OR (2 AND 3)
Another approach would be to allow the Grouping Logic to contain the necessary merge syntax. This likely would be more a more technically invasive change but would be pretty cool. For example:
1 OR (2 and $Model.CriteriaModel.data.0.IsAllowed__c = true)
In short, what I’d like the end result to be is something along the lines of the following
SELECT Name
FROM Model
WHERE
(
(RecordType = Type1)
OR
(
(RecordType = Type2)
AND
(true = true) // the left side is the value from OtherModel.Field__c
)
)
Thanks!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.