- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2017 10:49 PM
Hi,
In tasks form view, I've related list of "Assets" for a particular user(Relationship). If there is an "asset item" then related list of "Assets" will show all assets assigned to that user, if there is no user assigned to that asset then whoever is "requested for" then it will list all the assets belong to that user. If "asset item" is empty then it'll display all the assets for "requested for" person.
My query is working fine with all users except for "Ryun Truman", for some reason when I search for all assets of this user I don't get any results but if I apply the filter with "contains" then it does show 2 assets belong to this user. I've tried different thing but query works fine for all users in above scenario except for "Ryun Truman". I'm able to find this user in "Users" tables also.
Can you please help me where is the problem.
(function refineQuery(current, parent) {
var r = parent.request;
var rf = r.requested_for;
var pc = parent.u_asset_item.asset_tag ;
if (!pc.nil()){
var res = new GlideRecord('alm_hardware');
res.addQuery('asset_tag',pc);
res.query();
res.next();
if (!res.assigned_to.nil())
{
current.addQuery('assigned_to','CONTAINS',res.assigned_to);
current.addQuery('State','In use').addOrCondition('State','In Excess');
}
else
{
current.addQuery('assigned_to','CONTAINS',rf);
current.addQuery('State','In use').addOrCondition('State','In Excess');
}
}
else
{
current.addQuery('assigned_to','CONTAINS',rf);
current.addQuery('State','In use').addOrCondition('State','In Excess');
}
})(current, parent);
Thank you,
Mujtaba Ahmed
Solved! Go to Solution.
- Labels:
-
Scripting and Coding