- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 09:18 AM
Hello, I have a quick question.
I am developing a widget in Widget Editor. The purpose is to show multiple values in an sn-record-picker by default (with the multiple property set to true).
In my controller script, I have this:
And my sn-record-picker looks like this:
It appears that my c.selectedPerson contains the data, but the sn-record-picker does not show it. My sn-record-picker should show a list of users whose sys_id I have specified in my list.
The c.selectedPerson array contains objects with the following properties:
- displayValue: This contains the user's name from c.data.userNamesFin[i].
- value: This contains the user's sys_id from c.data.userIdsFin[i].
- name: This also contains the user's name from c.data.userNamesFin[i].
Each sys_id in c.data.userIdsFin corresponds to the respective name in c.data.userNamesFin in the same order.
Note: This is a different case from sn-record-picker instances where the multiple property is set to false. Therefore, the solutions provided in other forum posts have not been helpful for my situation.
Do you have any idea ?
Thank you for any help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 08:54 PM
Try the following changes, it worked for me atleast.
<sn-record-picker field="selectedPerson" table="'sys_user'" display-field="'name,email'" value-field="'sys_id'" search-fields="'name,email'" page-size="100" multiple="true"></sn-record-picker>
Replace your controller script with the following.
var userNamesFinal = c.data.userNamesFin;
var userIdsFinal = c.data.userIdsFin;
$scope.selectedPerson = {
displayValue: userNamesFinal.join('####'),
value: userIdsFinal.join(','),
name: 'selectedPerson'
};
Let me know if it is not resolved.
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 08:54 PM
Try the following changes, it worked for me atleast.
<sn-record-picker field="selectedPerson" table="'sys_user'" display-field="'name,email'" value-field="'sys_id'" search-fields="'name,email'" page-size="100" multiple="true"></sn-record-picker>
Replace your controller script with the following.
var userNamesFinal = c.data.userNamesFin;
var userIdsFinal = c.data.userIdsFin;
$scope.selectedPerson = {
displayValue: userNamesFinal.join('####'),
value: userIdsFinal.join(','),
name: 'selectedPerson'
};
Let me know if it is not resolved.
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2024 12:15 PM
Hi @AnveshKumar M ,
Your suggestion worked perfectly and resolved the issue I was facing.
I appreciate your help and the time you took to share this solution. It has been immensely helpful for my project.
Thanks,
Rayane
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2024 01:52 PM
@Rayane Bendahma happy to see it helped you!
Anvesh