Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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.
 
 

 

9 REPLIES 9

preethigovi
Tera Contributor

Even, g_form.hasAttachments() is not supported in VA.

 

@Ankur Bawiskar , Validation done on portal. 

@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

preethigovi_0-1762406795145.png

 

@preethigovi 

if you are still getting the error and that catalog item cannot be used in Conversational VA then you cannot do anything here.

It's OOTB platform limitation.

see this

Now Assist in Conversational Catalog Request: Guidance for making catalog items conversational 

💡 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

preethigovi
Tera Contributor

preethigovi_1-1762406909168.png