- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2017 06:12 AM
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
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2017 06:31 AM
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>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2017 06:31 AM
I don't see a widget option or parameter to make it read-only so the only way I can think is what I mentioned. Something like:
<sn-record-picker class="user" field="c.ed_user" table="'sys_user'"
display-field="'name'" value-field="'sys_id'"
display-fields="'user_name'" search-fields="'user_name,name'" page-size="300"
options="{cache: true, allowClear: false}"></sn-record-picker>
CSS:
.user:-moz-read-only { /* For Firefox */
background-color: #888;
}
.user:read-only {
background-color: #888;
}
I haven't tested this so let me know what you find.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2017 06:43 AM
Thank you !!
I am able to make field readonly by using sn-disabled attribute (as per the reply from,dvp)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2017 06:31 AM
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>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2017 06:40 AM
Thank you !!
It worked perfectly, i tried with ng-disabled and it didn't work
Is there any documentation available to check for these type of directives and attributes

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2017 06:45 AM
There is quite a bit of documentation here
I did not see the sn-disabled mentioned anywhere however.