OwnerId field, only give "user" option.

Is there a way to prevent the picklist that shows “user” and “group” when using the OwnerId reference field?


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

Look here: https://community.skuid.com/t/can-i-limit-which-objects-are-possible-targets-of-polymo…

Perfect! I actually used this earlier on a task related table and completely forgot about it. Thanks!

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

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) &amp;&amp; (!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); }