Delete record(s) via virtual agent

Nour el houda
Tera Contributor

Hello everyone,

So my question is how  can I delete record(s) with virtual agent using a topic.

I did a try with a script action using a simple script with glideRecord and deleteRecord and in the conversation, it says that the record was deleted . But it still exist in the table and it wasn't deleted.

Have you a solution?

Thank you very much

5 REPLIES 5

Chris D
Kilo Sage
Kilo Sage

You should be able to delete a record using GlideRecord. Can you share your code?

code.png

Hm, nothing strikes me as immediately wrong at first glance...

Not sure why you're gr.Get'ing the record with its number rather than its sys_id when you have a Reference input to pass into it, i.e. gr.Get(vaInputs.appointment)

(I don't recall offhand, you may need to .toString() that)

But that's more a recommendation to improve the code, not to fix what's broken.

 

Check the variable log to ensure you got a value for vaInputs.appointment and add in extra logging (i.e. gs.log()) into your GlideRecord query to help debug to ensure that you're getting something from that query before deleting it.

Muralidharan BS
Mega Sage
Mega Sage

The user may not have delete access to that table. You can trigger a flow from the topic and delete the record as system user.