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.

Set contact type as chat

Nivedita9
Tera Contributor

Hi ,Interaction 2.pngInteraction 1.png
I need help on SOW . Whenever the request is created from interaction the contact type field should be set to chat instead of self-service. Can anyone help me understanding where this modification can be done?
Attaching the screenshot as well.

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Nivedita9 

I think you will have to create a custom "Create Request" button something similar to OOTB

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Chaitanya ILCR
Mega Patron

Hi @Nivedita9 ,

you can create a before insert BR on the sc_req_item table for that

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here
    var gr = new GlideRecord('interaction_related_record');
    gr.addEncodedQuery('document_table=sc_request^document_id=' + current.getValue('request'));
    gr.query();
    if (gr.hasNext()) {
        current.contact_type = 'chat'; /*update the backend name of the chat choice if needed*/
    }

})(current, previous);

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya