How to make reference field readonly in <sn-record-picker>

amaradiswamy
Kilo Sage

Hi All,

I am creating a referenced field by using <sn-record-picker> directive in service portal. And, it will default to some value

Now, i want to make this field readonly. Is there any way to disable editing of this field?

Regards

Swamy

1 ACCEPTED SOLUTION

dvp
Mega Sage
Mega Sage

You can use


sn-disabled="c.data.variable_name"




Here is an example


<sn-record-picker sn-disabled="c.data.hasRole" field="c.requestedFor" table="'sys_user'" display-field="'name'" value-field="'sys_id'" search-fields="'name'" page-size="100" ></sn-record-picker>


View solution in original post

11 REPLIES 11

This is the only information i was able to find



Attributes in sn-record-picker



scope: {


field: '=', // The field object, like all other form elements have.


table: '=', // The table to search.


defaultQuery: '=?', // A base query that provides further result filtering. Like a reference qualifier.


searchFields: '=?', // Comma separated fields to search


valueField: '=?', // Field to use for field.value. Default is sys_id.


displayField: '=?', // Field to use for field.displayValue. Default is determined by getDisplayValue


displayFields: '=?', // Additional fields to show in result row.


pageSize: '=?',


onChange: '&',


snDisabled: '=',


multiple: '=?',


options: '=?',


placeholder: '@'


}



Source: sn-record-picker directive · Issue #59 · service-portal/documentation · GitHub


Sanjay27
Tera Contributor

Please use this

<sn-record-picker sn-disabled="fieldName" field="c.requestedFor" table="'sys_user'" display-field="'name'" value-field="'sys_id'" search-fields="'name'" page-size="100" ></sn-record-picker>

 

Here "fieldName" refers to the value of attribute "field".