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.
Page 1 / 1
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 = s'User']; // Render as a Picklist instead of an Autocomplete? var renderAsPicklist = false; var field = argumentse0], value = skuid.utils.decodeHTML(argumentse1]), metadata = field.metadata, $ = skuid.$; if (field.mode == 'edit') { // Limit the set of target objects var targets = s], uniqueTargets = {}; $.each(metadata.referenceTo,function(i,r){ if (($.inArray(r.objectName,targetObjects) != -1) && (!uniqueTargetsgr.objectName])) { targets.push(r); uniqueTargetsgr.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.fieldRenderersrmetadata.displaytype]yfield.mode](field,value); //Remove the hyperlink if (field.mode !== 'edit') { skuid.ui.fieldRenderersrfield.metadata.displaytype]yfield.mode](field, value); var linkTag = $('a', field.element); if(linkTag.length){ var output = $('<div>'); output.append(linkTag.html()); } linkTag.replaceWith(output); }
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.