Duplicates within rows, 5.8 Sandbox

edited December 4, 2017 in Questions
Just doing some sandbox testing with 5.8 and I can't figure out why I'm getting duplicate text fields within a single row (see attached). There is some javascript running in the background to make this work, which is now creating a duplicate entry for 2 separate fields within one row. When I hit save it executes properly and only saves one record, but obviously I don't want users getting confused.


The snippet for departure airport looks like this:

(function(skuid){ var $ = skuid.$,
departAirportFieldReference = 'stack__Depart__r',
departAirportFieldId = 'stack__Depart__c',
arriveAirportFieldName = 'stack__Arrive__r',
arriveAirportFieldId = 'stack__Arrive__c',
sectorNumberFieldName = 'stack__SecNum__c';

skuid.snippet.registerSnippet('fromAirportRenderer', function () {
var field = arguments[0],
//value = arguments[1];
value = field.row[departAirportFieldReference] !== undefined ? field.row[departAirportFieldReference].Name : null;

if (field.mode == 'read') {
//This just outputs what the standard Skuid control would output anyway, since we require no special behavour for rows that are not being edited.
skuid.ui.fieldRenderers.REFERENCE.read(field, value);
else {

var referenceFieldId = field.metadata.rel;

//var modelContext = getModelContext(field);

var modelContext = getModelContext(field),
items = modelContext.items;

//If depart airport is empty && this is a new row (i.e. there is no existing value, and no rendered item matching the Id of the current row)
if(items.length > 0 && value === null) {
var prevRow = items[items.length - 1].row,
prevId = prevRow[arriveAirportFieldName] !== undefined ? prevRow[arriveAirportFieldName].Id : null,
prevLabel = prevRow[arriveAirportFieldName] !== undefined ? prevRow[arriveAirportFieldName].stack__apName__c : null;

var modifications = {};
modifications[field.id] = prevId;
modifications[referenceFieldId] = {Id: prevId, Name: prevLabel};
value = modifications[referenceFieldId].Name;


new fieldChangeListener(field, function(changes){ 

skuid.ui.fieldRenderers.REFERENCE.edit(field, value);


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!