Skip to main content

I know I can override a “view” link globally or for profiles or record types, but can I do it selectively (or remove the link entirely) for an editable lookup field in Skuid? I want users to be able to set values in the lookup field, but NOT have the values in the field be clickable (or, at the very least, be able to override the link so I can take them somewhere else). I don’t see how to do that with the settings for a lookup field.

Hi Peter, Unfortunately there’s no way to do that “Out of the box”. However, this custom field renderer snippet should do the trick.


var field = argumentsu0], value = argumentsu1]; if (field.mode === 'read') { field.element.append(skuid.$('').addClass('nx-fieldtext').text(field.model.getFieldValue(field.row,skuid.utils.getFieldReference(field.id,field.metadata)))); } else { skuid.ui.fieldRenderersdfield.metadata.displaytype]yfield.mode](field,value); } 

Awesome - works like a charm to remove links from the field in read mode. Thanks!


Just wanted to point out for other people referencing this thread. This technique only works for fields of type REFERENCE. Not for any other field type. If you want to remove links on name fields of type STRING, you can use a template component with three curly braces around name like this: {{{Name}}}.


Ben, This works fine and gives an autocomplete… is there a way to have it give a dropdown for a picklist… I tried

field.element.append(skuid.$(‘

’).addClass(‘nx-field editable’) .text(field.model.getFieldValue(field.row,skuid.utils.getFieldReference(field.id,field.metadata))));

but that still gives a autocomplete



Hi Ktyler,


My requirement is same as yours. I was wondering if you found the way around to get the pick list on edit mode and get rid of hyperlink on read mode.


A slight change on above code works ( see below) unless you ‘edit and then cancel the record’ if you do edit and cancel the hyperlink reappears…):


var field = argumentsu0],


value = argumentsu1];

if (field.mode === ‘read’) {


field.element.append(skuid.$('<div>').addClass('nx-fieldtext').text(field.model.getFieldValue(field.row,skuid.utils.getFieldReference(field.id,field.metadata))));

} else {


//Just add this line to get pick list on edit mode
field.options.type = 'REFPICK';

skuid.ui.fieldRenderersdfield.metadata.displaytype]sfield.mode](field,value);

}


Thanks!


-Jnanendra


I, too, need to remove the hyperlink when a lookup field (rendered as a picklist) is in read mode, but Jnanendra’s sample doesn’t seem to do anything for me. Anyone else get his sample to work? Or is there a better way now?


I am trying to remove the hyperlink from the last name when the mode is “Read with inline-editing”. I have tried the above code with no avail. Any help would be greatly appreciated.


Below is the current code I have been playing with.


var field = argumentse0],


value = argumentse1];

if (field.mode === ‘read’) {


field.element.append(skuid.$('<div>').addClass('nx-fieldtext').text(LastName.Contacts.getFieldValue(field.row,skuid.utils.getFieldReference(field.id,field.metadata))));

} else {


skuid.ui.fieldRenderersefield.metadata.displaytype]lfield.mode](field,value);

}


Here is the code that will do what you need. IE turn the link off for any field direclty on the object that salesforce generally renders as a link (First Name, Last Name, Email, etc), but still allows you to edit the field.


var field = arguments[0],    value = arguments[1];
if (field.mode === 'read') {
field.element.append(skuid.$('<div>').addClass('nx-fieldtext').text(value));
} else {
skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode](field,value);
}

Note. If you are trying to do this on a reference field, use Ben’s approach above.


Hi Rob! 

Thank you for such a quick reply.

This may be a stupid question but are there changes that I have to make to the above code? I ask because the pesky links remain. What you say this is for is exactly what I need with the exception of email not being a link. I only want the first name and last name to not render as links. As a note the first name and last name are strings.


I just figured it out. Your code works perfect just as is. I created the resource as an in-line snippet. With that I change the field renderer to “custom (run snippet)” only on the fields that I want this script to change. Thank you!


This helped me. I had to make a few modifications to it though, figured I’d share.


We had two problems. 1) A blank value renders as ‘null’ in view mode, not a blank string. 2) A URL field is not editable. Neither was a difficult fix, but hopefully this will help someone. Code below.


var field = argumentsu0], value = argumentsu1]; if(value === null){ value = ''; } if (field.mode === 'read') { field.element.append(skuid.$('<div>').addClass('nx-fieldtext').text(value)); } else { // If display type is URL convert that to STRING var displaytype = field.metadata.displaytype; displaytype = (displaytype === 'URL') ? 'STRING' : displaytype; skuid.ui.fieldRenderersddisplaytype]yfield.mode](field,value); }


Hello, When I use this, the ampersend gets rewritten as shown in this example:

“Affordable Gadgets &amp; Additions”.

This field is the Account Name and is a STRING. Any ideas how to get this from happenning on view? Exporting the record shows normaly btw.