How to get value in array?

Sid_Takali
Kilo Patron
Kilo Patron

Hi all,

I have a requirement where I have to get a Phone Number and, Alternative Phone 1, Alternative Phone 2 field values in Array. How can I define an array[] to get the values from consumer table. 

 

1 ACCEPTED SOLUTION

kunal20
Kilo Guru

Hi Siddharam,

You can use the following code to push the data in an array and I have also created one separate array so You can display the data easily.

 

var consumerData = new GlideRecord('csm_consumer');
consumerData.query();
consumerData.setLimit(5);
var consumers = [];
while(consumerData.next()){
    var tempArray = []
        tempArray.push(consumerData .getValue('number') + '');
        tempArray.push(consumerData .getValue('mobile_phone') + ''); 
        consumers.push(tempArray); 
}
gs.info(consumers[0])

Kindly mark this as helpful.

Thank You,

Kunal

View solution in original post

6 REPLIES 6

You can achieve that by using GlideAjax in the client script.

If you can provide me script it would be helpful for me. Thanks