How can I pass the selected records in a table to another model to query other information

  • 1
  • Question
  • Updated 3 years ago
I am trying to apply the user selection in one table and then via a snippet on a mass update action, set the condition on a different model and then load/query that model.  So the result of the snippet combines the ID into one variable like : 'a05A000000Eibd5IAB','a05A000000EibFGIAB','a05A000000EibdPOAB'

I then set a condition on this other model to this variable (also this condition is related to a reference field that is looking for "in").  This has not worked because the way tha I am creaating and passing this variable results in skuid seeing this as text versus references.  i am not sure it it is parsing this as three ID versus one long text.

Below is my snippet showing capturing these ID, setting the variable and setting the condition.  Is there a way to successfully pass these as multiple ID to the condition or is there a better way to acheive quering this model with the right input of the selected ID?

Overall Snippet "Status":
Cycle Through table and get ID for rows that user has selected - This works
Passing these IDs to a condition (type = reference, in) - This does not work

var params = arguments[0],    $ = skuid.$;
var NoteUpdateModel = skuid.model.getModel('EditNoteInformantion');
var ReleaseDetailModel = skuid.model.getModel('OrderReleaseDetails');
var ReleaseDetailRow = ReleaseDetailModel.getRows();

var NewNote = "notes";

var NoteCondition = NoteUpdateModel.getConditionByName('Id');

NoteId = "";
AddComma = "";
n = arguments[0].rows.length;

thisRow = ReleaseDetailModel.getRowById(arguments[0].rows[i-1].Id);
NoteId = NoteId + AddComma + "'" + ReleaseDetailModel.getFieldValue(thisRow, 'Fiber_Planner_Execution_Details__c', true) + "'"; 
alert("id  =  "  +NoteId);
AddComma = ",";
NoteUpdateModel.setCondition(NoteCondition, NoteId, false);
Photo of Eric Tuggle

Eric Tuggle

  • 342 Points 250 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Mordechai


  • 988 Points 500 badge 2x thumb
  1. you're not limiting to selected items. based on your description that's what you were looking for. can you confirm?
  2. you need to build an array of id's
    so something like this
    var noteIds = [];
Photo of Eric Tuggle

Eric Tuggle

  • 342 Points 250 badge 2x thumb
Thanks.  This got me over the hump.  I've added the ID to an array rather then concatenating in a var that is text.  Then I was able to pass "noteIds" to a condition and query my model without errors.

var SelectedModel = skuid.model.getModel('test');NoteCondition = SelectedModel.getConditionByName('SelectId');
SelectedModel.setCondition(NoteCondition, noteIds, false);