Overriding a lookup field link in a table

I have a table with rows from a model with order product records belonging to a specific order. In standard Salesforce functionality, clicking on the “Product” field in the order product related list takes you to the order product record. I want to emulate this behavior with the PriceBookEntryId lookup field of my Skuid table row (that is, linking to the order product (the rows record Id) instead of the pricebookentry lookup record).

I have tried the method from this thread but it doesn’t appear to work (even removing the link does not work, perhaps this method was broken by Banzai?) https://community.skuid.com/t/is-there-a-way-to-selectively-override-remove-a-lookup-fields-link/124

Is there any way to override the lookup fields link so that it targets the rows record id instead of the related pricebookentry? This applies only to the lookup field in read mode, I’d like to use search fields and lookup filters on the pricebookentry object while in edit mode.

Example:

This product link goes to the Order Product record:

This link goes to the PriceBookEntry record:

Magnus,

I think you’ll get what you want by adding a template that looks something like this:

{{{PriceBookEntry.Name}}}

Thanks Matt.  One clarification.  You will also want to wrap the Id field with triple braces.  This will pass the actual ID value into the Href and not try to use the ID field renderers,  which would break the link…

Cheers. 

Thanks for the idea, but a template field won’t quite solve the problem. I already have a row action url redirect that can open the record in question, but what I really want to achieve is for the user to be able to use the lookup field as a link (while in read mode). I suspect this is only possible through a javascript snippet / custom field renderer ala the post I linked. Unfortunately I’m not yet able to figure out how to make that work :slight_smile: Any ideas?

Edit: To clarify, I don’t want to replace the lookup field with a template as I need the lookup-field filtering features for inline creation of new order products, and I don’t want to add another field simply for the link (if possible).

Ah, so you want users to be able to use the field for input in edit mode, but also link to the other object in read mode?

Sounds like a custom field renderer.

var field = arguments[0], value = arguments[1], $=skuid.$;

if (field.mode === ‘edit’) {
skuid.ui.fieldRenderers[field.metadata.displaytype]field.mode;
} else {
var renderLink =  // user skiud.utils.merge here to get your value
skuid.ui.fieldRenderers.TEXT.field.mode;

I’m assuming that text fields will interpret html. is that true?

Thanks again. I couldn’t figure out why this didn’t work, and decided to test it on some other tables / lookup fields. It appears that this custom renderer approach works on most lookup fields, but not on the standard order product ones. This is possibly because they are only editable on record creation and not once the record has been created (you can not associate an existing order product / orderitem with another pricebookentry or order after creation). Does this interfere with the field.mode logic?

Still hoping to find a solution that will let this work. There are obviously workarounds (e.g. row actions) but our users are thoroughly used to clicking the product name in order to get the order product record, so that is a hard sell :slight_smile:




Magnus.  The Opportunity product landscape is pretty fraught with gothchas.  In this space the objects and methods are hardly “Standard” 

We’ve prototyped severla pages for opportunities that might be useful for you.  They all work with an OpportunityJS static resource (which hosts the javascript to run custom renderers and repliate a lot of the code Salesforce is running server side - in the client.  I’d encourage you to check it out. 

You can look for it here: http://help.skuidify.com/m/getting-started/l/151288-copy-paste-individual-sample-pages-you-can-see-i…