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.

How to add the contacts tab to the incident form, to cascade / list all contacts from the site, acco

mania
Tera Contributor

Hi,

 

How to add the contacts tab to the incident form, to cascade / list all contacts from the site, account and parent account for Incident form.
I have wrote one script but not working completely and please correct my code if needed.
Can anyone help on this. It will be helpful.

 

 var current = new GlideRecord('incident');

      current.get('b792c2ea1be4c65018d297d8b04bcb1d');

     

      var accounts = addAccount(current.u_account);

      var site = addSite(current.u_site);

    var acc_str = "";

    var site_str = "";

    var acct = '';

 function addAccount(account) {

//          gs.print("account in function : "+ account);

 

        acct += "," + account;

      //  gs.print(acct + "testing");

        var checkParent = new GlideRecord("customer_account");

        checkParent.get(account);

        if (checkParent.account_parent) {

            return addAccount(checkParent.account_parent);

        }

        return acct;

}

function addSite(site){

    site_str +="," + site;

return site_str;

}

 gs.print("site_str : "+ site.split(',').slice(1));  // we are getting Site sys_id ;

   gs.print(accounts.split(',').slice(1));    // we are getting account SYS_ID;  

   function getContacts(account,site){

    var cust = new GlideRecord('customer_contact');

    cust.addQuery('account', account).addOrCondition('u_site', site);

    cust.query()

   }

 

Thanks in Advance!

 

 

0 REPLIES 0