Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

VA conversational catalog items

preethigovi
Tera Contributor

Hi Team,

 

I need to make one of record producer to conversational item and i have made it.

There is one error that we must not use DOM objects in client script to make conversational.

This is the client script we use.

 

function onSubmit() {
   //Type appropriate comment here, and begin script below
    if((g_form.getValue('does_the_proposed_delegate_report_to_the_manager') == 'No') && this.document.getElementsByClassName('get-attachment').length == 0) {
        g_form.addErrorMessage(getMessage('You must attach a confirmation message from your proposed delegates manager with this ticket before proceeding.'));
        return false;
    }  
}
 
 
How we can modify so it supports VA.
 
 

 

5 REPLIES 5

@preethigovi 

g_form.hasAttachments() doesn't work on portal, the script is wrongly shared

see if this works for you and you are able to use VA Conversational for this item

function onSubmit() {
    //Type appropriate comment here, and begin script below
    if ((g_form.getValue('does_the_proposed_delegate_report_to_the_manager') == 'No') && getRPAttachmentCount() == 0) {
        g_form.addErrorMessage(getMessage('You must attach a confirmation message from your proposed delegates manager with this ticket before proceeding.'));
        return false;
    }
}

function getRPAttachmentCount() {
    var length;
    try {
        length = angular.element("#sc_cat_item_producer").scope().attachments.length;
    } catch (e) {
        length = -1;
    }
    return length;
}

If not then you can't use this ITEM for Conversational VA

💡 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