Catalog item maximum 1 order per user

NMMZ10
Tera Contributor

I have a catalog item that has as requirement maximum 1 order per person.
What would be the best practice on how to do this?

3 REPLIES 3

GlideFather
Tera Patron

Hi @NMMZ10,

 

there might be several ideas how to get this.. but please share more details about the scenario - does it matter what is the state?

 

Thing to consider.. example: somebody submits it and it will be rejected, can they still submit a new one or not anymore?

 

Please first think of the design and based on knowing the details we can discuss what would be the best solution to it... 

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Ankur Bawiskar
Tera Patron
Tera Patron

@NMMZ10 

best way is to use User Criteria and use script and don't show that catalog item itself on portal

Then add that in "Available For" related list of your catalog item.

Something like this in script

var gr = new GlideRecord("sc_req_item");
gr.addQuery("item.name", "Your Item Name Here");
gr.addQuery("request.requested_for", user_id);
gr.setLimit(1);
gr.query();
answer = gr.hasNext();

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@NMMZ10 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader