Abort Action on record producer

pramodkumar
Tera Expert

Hi All,

I have a record producer on custom table. Based on a value of variable on record producer form (if value already exists in table), the record producer should be aborted with an error message and should stay on the same form. How can we achieve this? The record producer is on service portal.

 

Thanks!

9 REPLIES 9

Tudor
Tera Guru

Hello Kumar,

Please try creating an onSubmit client script with a GlideAjax to query the table.

Hope this helps,

Tudor

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

in record producer script do this

var value = producer.variableName;

if(present){

gs.addErrorMessage('You are not allowed to submit');

current.setAbortAction(true);

}

Regards
Ankur

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

@pramodkumar 

Thanks for marking my response as helpful.

Let me know if I have answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

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

@pramodkumar 

Thanks for marking my response as helpful.

Let me know if I have answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

 

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