Restrict submit catalog item if short description and Requester is same

Samiksha2
Mega Sage

Hi All,

 

Users are creating request through emails. The requirement is to restrict to create request if short description and requested for is same. And the existing record is true.

I read some articles and posts but I didnt find the correct solution.

 

Please help.

 

Thanks,

Samiksha

17 REPLIES 17

Hi @Chetan Mahajan ,

I tried with encoded query. Request is creating. And If I am giving different short description also it is not allowing me to submit requested Item.(Although Request is creating with added error message)

Thanks,

Samiksha

Hi @Samiksha2 ,

You can try the below script in before insert Br.

 

var gr = new GlideRecord('sc_request_list');// Use your table
gr.addQuery('active',true);
gr.addQuery('requested_for',current.requested_for);
gr.addQuery('short_description',current.short_description);
gr.query();
if(gr.next()){
    current.setAbortAction(true);
    gs.addErrorMessage('Hi'+ current.getDisplayValue('requested_for')+', You have submitted the same request already');
}
 
Please mark the answer as correct and helpful, If I answered your query. It will be helpful for others who are looking for similar questions.

Hi @Vengateshwaran ,

For different short description also requested item is not generating. 

 

Thanks,

Samiksha