How do I populate a model with records excluding those already present in another model?

I am adding Opportunities to a model within my page. As I go to look for more Opportunities to load, I want to exclude showing those already in my model so they cannot be added twice. To do something similar for other pages I have had to create an object in Salesforce to store this temporary information. As I only want to load the primary object after all Opportunities have been selected. Is there a way to do this completely within the skuid page without a temp object in Salesforce?

Michael - definitely no need to have a temp SF object for this. I do this all the time in Skuid.

Your second model should have a condition that uses the value content of “Field from another Model”. Source model will be your first model, and source field can just be Id if both models are built on the same object. Also make sure the Id field is included in both models. Then set the operator to ‘not in’.

This will cause your second model to query any opportunities where the Id is not found in any of the rows within the first model.

Hi Conlan, than you for your reply! I thought “Field from another Model” would only query the first row of the other model. I will have a list of records, not just one record in the second model.

That also then requires that I can remove a row from the other model dynamically should a record be removed from a related model associated to that Opportunity.

After you choose “field from another model”, you have to change equals to “is in”. This should match the rows against all the rows of the target model not just the first one.

You may be able to accomplish the remove of a row from a model using a model action.