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

Prasanna_Patil
Tera Guru

Hi Try this code once

var inc = new GlideRecord('incident');

inc.initialize();

inc.short_description = inputs.issue_description;

inc.caller_id = gs.getUserID(); // Or inputs.caller if collected

inc.insert();

 

outputs.inc_number = inc.number;

Please hit like and Mark Helpful if you liked it
Regards,
Prasanna

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;

Hi @服部稜 

 

Yes please try this too

Please hit like and Mark Helpful if you liked it
Regards,
Prasanna

Hi @Prasanna_Patil 
No it didn't work
is there any other code