How to access Gliderecord data from portal widget HTML page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2017 04:55 PM
I have created a Service Portal widget where the Server script runs a GlideRecord query and returns 3 records.
I have a line in the Server script that returns the 3 records GR query :
data.info = gr
where gr is the gr object from the Server script.
In the widget HTML, I use the ng-repeat directive to loop through the 3 records like so :
<div ng-repeat="record in data.info" >
but that does not work.
Can someone explain the concepts and the HTML/Angular syntax to use in order to loop through the GR records and be able to access the records fields (something like {{record.sys_id}}, for example) ?
I have also seen examples like this {{::record.sys_id}}.
What is the difference between the syntax with and without the "::" ?
Any good reference documentation on this subject would also be useful.
Thanks.
- Labels:
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2017 05:07 PM
Take a look at : Ask the Experts - TechNow Ep 28 - Service Portal - YouTube

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2017 11:54 PM
Hi Yves,
For the records, you should push each gr record to data.info instead of using =.
So if you are using while loop to pull three records, you need to push them into data.info.
while (gr.next())
{
data.info.push(gr);
}
the '::' is used to watch the value of that attribute. For example, If I want to show the users any changes to state field without user refreshing the form, I would put a ::. If I dont want to show the changes without a page refresh, I woudn't use ::
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2018 07:31 PM
Hi Sanjiv.
I am not sure if you tried what you suggested but it does not work (at least for me).
In fact, what I have found is that what you need to do to pass data from the server script to the HTML template is to pass it as string values using the following method :
- Create an array under the data object, like here : data.info = [];
- Create an object, either directly or dynamically, using the {} notation
- Pass the required GlideRecord data as strings, using the GlideRecord getValue() or JS toString() function, inside the object defined in step 2
- Loop through the data array in the HTML template like here : ng-repeat="record in data.info"
- Use the required data in the HTML template using the {{record.fieldName}} notation
As for the :: notation, I found in the AngularJS doc that it is defined as:
One-time binding
An expression that starts with ::
is considered a one-time expression
So what I understand is that by default, the expression is watched. But with :: , it is not.
Let me know if you disagree with what I found.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2018 10:44 AM
Hi Yves,
You can refer few out of box widgets to build your functionality. Below is an example to retrieve approvals and push it to an array and in HTML, loop through the array.
You can also watch the below ask the expert episode, which has a good example.
Ask the Expert: Service Portal, TechNow 28
For the double colon, you are correct. It tells angular not to change it.
Please mark this response as correct or helpful if it assisted you with your question.