sn-record-picker choices display issue

venkat57
Tera Contributor

Hi,

 

I have created a widget with sn-record-picker which needs to display the users..

 

sn-record-picker has a default-query which gets a comma separated sys_id's of users from a script include but unable to show them on the choice of record picker..

 

HTML:

 

<div ng-if="data.canRead" class="panel panel-primary b">


<div class="panel-heading">


<h4 class="panel-title pull-left">


${Watch list}


</h4>


<div class="clearfix"></div>


</div>


<div class="panel-body">


<div class="text-center text-italic text-muted">


<sn-record-picker field="watch_list" table="'sys_user'" display-field="'name'" search-fields="'name'" value-field="'sys_id'" default-query="'sys_idIN{{data.query}}'" multiple="true"></sn-record-picker>


</div>


</div>


</div>

 

Client Controller:

 

function($scope, spUtil) {


       var c = this;


       
alert(c.data.query);

       $scope.watch_list = {  


               displayValue: c.data.displayValue,  


               value: c.data.value,


               name: 'watch_list'  


   };


}
 
Server Script:
 
(function() {


       


       var table = $sp.getParameter('table');


       var sys_id = $sp.getParameter('sys_id');
var lu = new sn_customerservice.CaseWatchListFunctionscsm();
data.query = lu.refQual(sys_id);

       var gr = new GlideRecord(table);


       if(gr.get(sys_id)){


               data.canRead = gr.watch_list.canRead();


               data.canWrite = gr.watch_list.canWrite();


               if(data.canRead){


                       data.displayValue = gr.getDisplayValue('watch_list');


                       data.value = gr.getValue('watch_list');


               }


       }


})();


Script include:
 
var CaseWatchListFunctionscsm = Class.create();
CaseWatchListFunctionscsm.prototype = {
    initialize: function() {

    },
    refQual: function(project) {
        var code;
        gs.info('CaseWatchListFunctionscsmran');
        gs.info('project1' + project);
        var grc = new GlideRecord('sn_customerservice_case');
        grc.addQuery('sys_id', project);
        grc.query();
        if (grc.next()) {
            code = grc.u_project;

        }
        gs.info('project12' + code);
        var members = [];

        var gr = new GlideRecord('u_m2m_project_users');
        gr.addQuery('u_project', code);
        gr.addQuery('u_active', true);
        gr.query();
        while (gr.next()) {
            members.push(gr.u_user.sys_id.toString());
            // if (members == '') {
            //     members += gr.u_user.sys_id;
            // }
            // if (members != '') {
            //     members += ',' + gr.u_user.sys_id;
            // }
           
        }
        gs.info('project12members' + members);
        // return 'sys_idIN' + members;
        return members.toString();

    },

    type: 'CaseWatchListFunctionscsm'
};
 
 

Can someone please help me on this..

 

Thanks in advance..

 

0 REPLIES 0