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.

Issues with Virtual Agent Case Card, State defaults to draft, record number link takes me to esc.

Dario Idrovo1
Tera Contributor

So I am encountering a couple of issues. 

1. When the HR Case is created on the virtual agent, it is being created in Draft, why is that? How can I fix this?

2. When I click on the record number hyperlink on the case card, it takes me to the esc portal, how can I route this to take me to our other portal instead (hrhelp)

 

DarioIdrovo1_0-1710281893386.png

 

5 REPLIES 5

Hi @Dario Idrovo1 ,

 

We found a solution to this. It is correct that you cannot change the url for a card and direct users to a different portal, but we found that you can disable the link entirely. We then used a link bot response immediately after the card to direct the user to the record on our custom portal. 

To disable the link, go to script include "VaRecordCardOutput". Line 39 is the subtitle in the card (this is the link) and line 40 is the sys_id of the record for the link. 

Sumanth16_0-1710304198010.png

 

Make the subtitle value an empty string to remove the link from the card. We also commented out the sys_id field as we don't need it.

Sumanth16_1-1710304198011.png

 

Then use the Link bot response to link to the record. This lets you build the link per your requirements, so you can go to any portal instead of just SP. 

This is what you end up with:

Sumanth16_2-1710304198011.png

 

This also works in Slack, where you cannot use "VaRecordCardRenderer" to create a scripted card to control the link.

 

Please refer following thread:

https://www.servicenow.com/community/now-platform-forum/virtual-agent-card-response-properties/m-p/1...

 

 

 

Approach 2:

  1. Open the topic in Designer.
  2. In Madrid, the topic uses Bot Response 'Card' to display the new incident
  3. Instead of using 'Card' add 'Script Output'
  4. Now in the Response Properties add the following:
    • Name: Incident Card
    • Script Output Type: Single-part
    • Script Response Message:

 

(function execute() {
  var incident = new GlideRecordSecure('incident');
  incident.get(vaInputs.create_incident);
  var title = {
  url: gs.getProperty('glide.servlet.uri') + '/' +
    gs.getProperty('sn_itsm_va.com.snc.itsm.virtualagent.portal_url') +
    '?sys_id=' + incident.sys_id + '&id=ticket&table=incident',
    label: incident.number
  };
  var fieldList = ['category', 'assignment_group', 'short_description', 'state'];
  var cardRenderer = new global.VaRecordCardRenderer(true);
  var fields = cardRenderer.createFields(fieldList, incident);
  var html = cardRenderer.renderCard(title, fields);
  return html;
})();​

 

  • In above code  gs.getProperty('sn_itsm_va.com.snc.itsm.virtualagent.portal_url')  replace with your system property name and try it.
  • And update these field names to HR field names in the script incident.sys_id+'&id=ticket&table=incident',
    label: incident.number
  • Save the topic.
  • Now go to sys_properties.list
  • Find the following property: sn_itsm_va.com.snc.itsm.virtualagent.portal_url
  • It must be set to sp. Change it to the desired portal.

     

    If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

Thanks & Regards,

Sumanth Meda