Reference rows in a table that is no longer in context

  • 1
  • Question
  • Updated 3 years ago
I need to reference selected rows in a table that is no longer in context. I can get it to work with all returned records, but not with specific rows. My table is name UpdateForm1. I'm trying to set the Id from each row as the WhatId in the snippet below:

var params =arguments[0];
var $ = skuid.$;
var models =;
// Define "What" model (Record Ids from this model will be used as the WhatId)
var updateForm = models.VendorChecklist;
// Define the task model where new row will be created
var newActivity = models.NewActivity;
// Define the task model used to create the temporary Task (End user sets field values from this model)
var taskModel = models.TaskHistory;
//Define the task record Fields that will be used on the new task records
var thisActivityAssignedTo = taskModel.getFirstRow().OwnerId;
var thisActivitySubject = taskModel.getFirstRow().Subject;
var thisActivityWho = taskModel.getFirstRow().WhoId;
var thisActivityIntCat = taskModel.getFirstRow().Interaction_Category__c;
var thisActivityIntSub = taskModel.getFirstRow().Interaction_Subject__c;
var thisActivityDate = taskModel.getFirstRow().ActivityDate;
var thisActivityComments = taskModel.getFirstRow().Description;
// Loop through each record to create a new task record in the NewActivity model
var currentId = this.Id;
var newrow = newActivity.createRow({
additionalConditions: [
{ field: 'OwnerId', value: thisActivityAssignedTo, operator: '=' },
{ field: 'Subject', value: thisActivitySubject, operator: '=' },
{ field: 'WhoId', value: thisActivityWho, operator: '=' },
{ field: 'WhatId', value: currentId, operator: '=' },
{ field: 'Interaction_Category__c', value: thisActivityIntCat, operator: '=' },
{ field: 'Interaction_Subject__c__c', value: thisActivityIntSub, operator: '=' },
{ field: 'ActivityDate', value: thisActivityDate, operator: '=' },
{ field: 'Description', value: thisActivityComments, operator: '=' },
{ field: 'Status', value: 'Completed', operator: '=' }
Photo of Brayden Smith

Brayden Smith

  • 1,220 Points 1k badge 2x thumb

Posted 3 years ago

  • 1

Be the first to post a reply!