- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2017 05:00 PM
Hello,
I am trying to setup two SN record pickers where one is the assignment group and the other is the assigned to user. I want the assigned to user SN record picker to only show the group members of the currently selected group in the first picker. My issue is that the SN record picker seems to be ignoring the data variable. I am able to output the variable in HTML, but it is ignored when I put it in the SN record pickers default-query variable in the inline HTML. I can't seem to pass the data.assigned_to_query into the default-query variable. Can you please help me pass the {{data.assigned_to_query}} variable to the SN record picker? Once I am able to pass the variable, I will be able to setup the dynamic part of the query.
HTML:
<div class="col-xs-6 form-group">
<label class="m-n">Assignment group</label>
<sn-record-picker field="assignment_group" table="'sys_user_group'" display-field="'name'"
value-field="'sys_id'" search-fields="'name'" page-size="100"
default-query="'active=true'" >
</sn-record-picker>
</div>
<div ng-if="data.assigned_to_query.length > 0" class="col-xs-6 form-group">
<label class="m-n">Assigned To</label>
<sn-record-picker field="assigned_to" default-query="'{{data.assigned_to_query}}'"
table="'sys_user'" display-field="'name'"
value-field="'sys_id'" search-fields="'name'" page-size="100" >
</sn-record-picker>
{{data.assigned_to_query}}
</div>
Client Script:
function ($scope, spUtil) {
$scope.assignment_group = {
displayValue: $scope.data.assignment_group_name,
value: $scope.data.assignment_group,
name: 'assignment_group'
};
$scope.assigned_to = {
displayValue: $scope.data.assigned_to_name,
value: $scope.data.assigned_to,
name: 'assigned_to'
};
$scope.$on('record.updated', function(name, data) {
spUtil.update($scope);
})
}
spUtil.update($scope);
})
}
Server Script:
data.assigned_to_query = 'nameSTARTSWITHb';
Here is the Assigned To SN record picker. You can see the default query isn't working since it should only show names that start with "B". The default query works when I set it to default-query="'nameSTARTSWITHb'", but not when I set it to default-query="'{{data.assigned_to_query}}'".
Here you can see that the {{data.assigned_to_query}} variable was passed here in the HTML, but the default-query is still not working.
Any help would be appreciated!
Thanks,
Forrest
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2017 05:34 PM
change: default-query="'{{data.assigned_to_query}}'" To: default-query="data.assigned_to_query"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2017 05:34 PM
change: default-query="'{{data.assigned_to_query}}'" To: default-query="data.assigned_to_query"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2017 07:49 PM
Thank you so much for the help! Worked like a charm!
- Forrest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2017 04:42 AM
Hi Forrest,
Would you please tell me how is it working? Because I have just copied your code base with the given solution but, have a look:
Please Help me. I am facing this problem for several days.
In RMA Approver all the users are showing whereas only two users are there.!!!!
Please Help Me.
Thanks,
Saptashwa