OwnerId field, only give "user" option.

edited September 2019 in Questions
Is there a way to prevent the picklist that shows "user" and "group" when using the OwnerId reference field?

image
I would like it to not show the picklist and only show user's on the look up.

Comments

  • edited September 2019
    Perfect! I actually used this earlier on a task related table and completely forgot about it. Thanks!
  • edited November 2016
    Craig,
    Could you share the solution of yours? or let me know the tweaks that we have to do here in order to get the changes applied to the ownerId field on a custom object?
    Thanks

  • edited November 2016
    Certainly. I took the solution from Zach in the above linked thread and changed the target object to 'User'. I also have a section that removes the hyperlink when the field is not in edit mode as we prefer not to link to the User object.
    // // CONFIGURATION  //  // Define the possible target objects  var targetObjects = ['User'];  // Render as a Picklist instead of an Autocomplete?  var renderAsPicklist = false;  var field = arguments[0],      value = skuid.utils.decodeHTML(arguments[1]),      metadata = field.metadata,      $ = skuid.$;  if (field.mode == 'edit') {      // Limit the set of target objects      var targets = [],         uniqueTargets = {};      $.each(metadata.referenceTo,function(i,r){         if (($.inArray(r.objectName,targetObjects) != -1) && (!uniqueTargets[r.objectName])) {            targets.push(r);            uniqueTargets[r.objectName] = 1;            if (targets.length == targetObjects.length) return false;          }      });      if (targets.length) {         // Make this field render as a picklist?         if (renderAsPicklist) field.options.type = 'REFPICK';         // Override the current referenceTo         metadata.referenceTo.length = 0;         metadata.ref = $.map(targets,function(targ){return targ.objectName;}).join();        metadata.referenceTo = targets;      }  }  // Run the standard renderer  skuid.ui.fieldRenderers[metadata.displaytype][field.mode](field,value);   //Remove the hyperlink if (field.mode !== 'edit') {    skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode](field, value);         var linkTag = $('a', field.element);         if(linkTag.length){             var output = $('<div>');             output.append(linkTag.html());         }    linkTag.replaceWith(output); }
Sign In or Register to comment.