My Tickets in Service Portal should display all Requests, Ritm's and incidents

Angshuman3
Mega Guru

Hi All,

I am having a requirement in Service Portal. There is 'My Tickets', now the requirement is on clicking My Tickets it should display all the REQ , RITM , INC that is present in descending order, i.e the latest one should be on the top where as the oldest one at the bottom.
If anyone has come across this requirement do let me know how you had developed the same.

Thanks,
Angshuman

4 REPLIES 4

Ashutosh Munot1
Kilo Patron
Kilo Patron

HI,

 

See below code, this is from My tickets:

 

if (st.isValid()) {
st.addActiveQuery();
st.addQuery('opened_by', gs.getUserID());
st.orderByDesc('sys_updated_on'); //There you have to change to sys_created_on, So that it will give you latest first. NOw it gives updated first.
st.setLimit(max);
st.query();
while (st.next()) {
var a = {};
$sp.getRecordValues(a, st, 'short_description,sys_id,number,sys_updated_on');
if (st.short_description.nil())
a.short_description = "(No description)";
a.__table = st.getTableName();
a.type = 'record';
a.sortOrder = st.sys_updated_on.getGlideObject().getNumericValue();
t.items.push(a);
}
}

 

Thanks,
Ashutosh

Keerti2
Mega Expert

kindly let me know to add short description for request , as of now i can isee "item name , request number" when i click on My tickets.

 

now i want to see " item name , short description and request number" . kindly let me know code and where can we update that code.

Himanshu Dubey
Giga Guru

Hi

Please refer below link it will help you

https://community.servicenow.com/community?id=community_question&sys_id=88c41c75db55e7007d3e02d5ca96...

 

Please mark correct and Helpful if it helps

Thanks and Regards

Himanshu Dubey

Please mark the answer correct and close the thread so it will help others