Skip to main content
Nintex Community Menu Bar
Question

Reference field rendered as picklist with filter... AND custom snippet?

  • July 11, 2024
  • 8 replies
  • 14 views

Forum|alt.badge.img+7

Hi,
I have a reference field that is implemented as a picklist with a filter (in v1).  All works fine.  Now we’d like to highlight the field if it is blank.

We are doing this in other fields in the table with a custom snippet.  However, if we use a custom snippet, I lose the conversion to a picklist with filtered field values.

Is there an easy way to have both?  Or do I have to build in js the filter query if I want to highlight the field (if so, an suggestions on how to best do that)?

Thanks!

This topic has been closed for replies.

8 replies

Forum|alt.badge.img+20

Have you tried to override the field metadata in the model?


Forum|alt.badge.img+7
  • Author
  • Rookie
  • July 11, 2024

Hi Pat. Picklist is not presented as an override option, unfortunately.


Forum|alt.badge.img+20

What is the filter criteria?


Forum|alt.badge.img+17
  • Nintex Employee
  • July 11, 2024

Ok - I realize this is using a hammer to strain a gnat.  But in V2 you can do conditional styling as a declarative feature.  This means you can get the highlighted field when the value is something (even blank),  as well as the picklist and reference field filtering. 


Forum|alt.badge.img+7
  • Author
  • Rookie
  • July 11, 2024

It’s a contact lookup that is rendered as a picklist with values filtered by the account set in another field in the row.

So in JS, I’d need to query this for each row (or filter it), so trying to leverage this functionality - all I want to do is highlight the field if it is null - not rebuild the picklist filter/generation capability.

Any thoughts?


Forum|alt.badge.img+7
  • Author
  • Rookie
  • July 11, 2024

I’m not even seeing an option to convert the reference to a picklist in v2 - where did the “field renderer” field go?


Forum|alt.badge.img+7
  • Author
  • Rookie
  • July 11, 2024

Wound up recreating it.  Was less JS than I anticipated.  For those that may need something similar, here it is.  The biggest risk is too many contacts, but I’ve got a filter on the model so I don’t have to requery on each row, just select the ones I’ve got.

I’m sure there are more elegant ways to do this, but it seems to work.

var field = arguments[0], 
value = arguments[1],
CounselContacts = skuid.$M(‘CounselContacts’),
selectedName = CounselContacts.getRowById(value),
$ = skuid.$; 

var row = field.row;
//get value of valuation status from row
var deals = skuid.$M(‘Deal_Pipeline’);

field.metadata.picklistEntries = ;
$.each(CounselContacts.getRows(), function(r,ccRow){
    if(ccRow.Name != selectedName.Name && deals.getFieldValue(row, ‘Company_Counsel_Firm__c’) == ccRow.AccountId ){
        field.metadata.picklistEntries.push({value: ccRow.Id, label: ccRow.Name, active: true});    
    }
});

skuid.ui.fieldRenderers[‘PICKLIST’]field.mode;

if(value == null){
        field.element.css({‘border-radius’: ‘3px’, ‘background’ : ‘#F4FF95’, ‘padding’ : ‘10px’ ,‘color’: ‘white !important’, ‘text-align’ : ‘left’ }); 

}


Forum|alt.badge.img+17
  • Nintex Employee
  • July 11, 2024

Look for the “Display As” field property on the table or form.  Relabled, but hopefully clearer.