Hi I want to validate if attachment is attached before submitting catalog request

Nidhi6
Giga Contributor

Hi,

I have written catalog script and script include. While submitting form without checking attachment the form is getting submitted.

Screenshots of client script and Script Include is attached below: 

Please help me where my code is getting wrong.

find_real_file.png

 

 

find_real_file.png

 

 

1 ACCEPTED SOLUTION

Just give me 10 minutes, I am doing corrections

Thank you,
Abhishek Gardade

View solution in original post

9 REPLIES 9

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Since Madrid, there's out-of-the-box, a checkbox which makes Attachments mandatory on Catalog Items in the Service Portal.

I wrote an article on this. Have a look, it might help to achieve this without any scripting.
https://community.servicenow.com/community?id=community_article&sys_id=aff2e9ccdbc17300d82ffb2439961...

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

I suggested her to check out your blog, But she wants to do with scripting.

Thank you,
Abhishek Gardade

AbhishekGardade
Giga Sage

Hello Nidhi,

I can see you are posting same question again and again. Even you are not responding with issues on that.

Let it be,

Correct these in your script:

IN your code, LINE number 5, attachment should be in quote like "attachment "

Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade

Thank you,
Abhishek Gardade

2.Also your script include is INACTIVE:

3. Alert wont work in server side scripts like business rule, script include. so add gs.log or gs.addInfoMessage()

Thanks,

Abhishek

Thank you,
Abhishek Gardade