Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

How to delete duplicate catalog item draft

Obito
Tera Expert

Hi all,

 

I need to delete duplicate catalog item draft. I need to only keep last created. There is one question 'Jira ID'  where I am getting unique value from Jira, Based on that question's value I have do the glide aggregate count. If the count is greater than 1 (means there are more than 1 record where Jira Id is same) then I will only keep the latest one.  

How can I write this glide aggregate code?

1 ACCEPTED SOLUTION

@Obito and by what script - BR, catalog client script (calling Ajax), scheduled job, flow, .... ? 

Not knowing your conditions, to delete it always or under conditions, for all user or just some...?

 

Then you can write your code accordingly pointing to the table I shared [sc_cart_item].

 

_____
Answers generated by GlideFather. Check for accuracy.

View solution in original post

7 REPLIES 7

GlideFather
Tera Patron

Hi @Obito,

 

in Portal go to My requests and there is Draft tab where yo ucan erase it:

GlideFather_0-1759743225000.png

 

_____
Answers generated by GlideFather. Check for accuracy.

@Obito or in the backend go to [sc_cart_item] table:
https://yourinstance.service-now.com/now/nav/ui/classic/params/target/sc_cart_item_list.do

GlideFather_1-1759743293824.png

 

_____
Answers generated by GlideFather. Check for accuracy.

Hi @GlideFather , Thank you for the response, But I need to delete the records using script.

@Obito and by what script - BR, catalog client script (calling Ajax), scheduled job, flow, .... ? 

Not knowing your conditions, to delete it always or under conditions, for all user or just some...?

 

Then you can write your code accordingly pointing to the table I shared [sc_cart_item].

 

_____
Answers generated by GlideFather. Check for accuracy.