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.

Cooperation from Virtual Agents

服部稜
Tera Contributor

Hi
I need someone to help me
I want to link data entered from a virtual agent to file an incident, but one day I can no longer link the data.

The code is using the following

var grbusinessservice = new GlideRecord('cmdb_ci_service');
grbusinessservice.addQuery('name', producer.q_business_service);
grbusinessservice.setLimit(1);
grbusinessservice.query();
if (grbusinessservice.next()) {
current.business_service = grbusinessservice. getUniqueValue();
current.update();
} else {
gs.warn('Team in charge "' + producer.q_business_service + '" not found in business_service');
}

_0-1751591708606.png

 



What changes should I make to get this to work?


5 REPLIES 5

服部稜
Tera Contributor

Thanks Prasanna.

Does that mean I should try the following?

var inc = new GlideRecord(‘incident’);
inc.initialize();
inc.short_description = inputs.issue_description;
inc.caller_id = gs.getUserID(); inc.caller_id = gs.getUserID();

var grbusinessservice = new GlideRecord('cmdb_ci_service');
grbusinessservice.addQuery('name', producer.q_business_service);
grbusinessservice.setLimit(1);
grbusinessservice.query();

if (grbusinessservice.next()) {
inc.business_service = grbusinessservice.getUniqueValue();
} else {
gs.warn('Team in charge "' + producer.q_business_service + '" not found in business_service');
}

inc.insert();
outputs.inc_number = inc.number;