We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Preventing form submission when there is no attachment

Not applicable
 
14 REPLIES 14

Hi @Community Alums ,

 

Use getXMLWait() instead of getXMLAnswer.

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

Not applicable

but getxml wait is not supported in portal

Hi @Community Alums ,

 

use below code, no need of calling script include.

function onSubmit() {
    // Use the g_attachment API to check for attachments

    if (this.document.getElementsByClassName('get-attachment').length == 0) {
        alert("You must attach Template Document");
        return false;


    }
    return true; // Allow form submission if attachments exist
}

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

Hi @jaycoover ,

Did you tried this? its working for me.

Not applicable

dom manipulation is BPE