Can someone help me with showing my assets assigned to user on SP?

John Vo1
Tera Guru

This is what I have done so far.

1.  Created widget called My Assets.

find_real_file.png

2.  Here is my html code:

HTML:


<h4 class="panel-title">


My Assets


</h4>


<div>


<table>


<tr ng-repeat="asset in data.assets">


<td><a href ="nav_to.do?uri=alm_hardware.do?sys_id={{asset.sysid}}">{{asset.display}}"


</a></td>


</tr>


</table>


</div>

 

Server Script


(function() {


data.userID = gs.getUserID();


data.assets = [];


var gr = new GlideRecordSecure('alm_asset');


gr.addQuery('assigned_to',gs.getUserID());


gr.query();


data.recordCount=gr.getRowCount();


data.assets = [];


while (gr.next()) {


var asset = {};


asset.display = gr.display_name + '';


asset.assigned_to = gr.assigned_to.getDisplayValue();


asset.sysid = gr.sys_id + '';

 

data.assets.push(asset);


}


})();

 

3.  I went to SP and added the My Assets but nothing shows up that's assigned to me.

1 ACCEPTED SOLUTION

find_real_file.png

find_real_file.png

 

Attached XML (Widget: assets) as well for reference. In addition, make sure the the server side code is sufficed i.e. atleast an asset or two is assigned to your profile.

 

View solution in original post

35 REPLIES 35

Jaspal,

 

I created the page and put that in the link.  But when I click on it, it takes me to a blank page.  I need it to take me to the cmdb info of laptop.

 

find_real_file.png

Hi John,

 

Try importing attached XML of widget. Widget name: getassetss.

Once done you need to place the widget in the page that you have created. Since, you have already changed the link for the page instead of blank once widget is placed you will get output as below.

You can customize widget as per your business requirement additionally.

find_real_file.png

When I imported the xml the My Assets no longer shows up on the Header on the SP.  

Hi John,

 

This has nothing to do with the Main Menu option of My Assets. Even then in case you can remove the XML imported & create one with attached document snippets.

Jaspal,

It's back on the header now.  Okay so here is what I've done.

 

Imported your xml and now I see getassetss as a widget.  I created a page called My assets info.

find_real_file.png

 

What should I put in this portion?

find_real_file.png