Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Storing the number after a GlideRecord Insert

Ashley
Kilo Sage

Hello,

So I am writing a Before Insert Business Rule on the Request_Item Table

So if a user updates the Customer Visible notes on the Request Item it creates a new Chat Queue Entry:

Script:

if(ourUser.hasRole('role_name')) {

  var gr = new GlideRecord('chat_queue_entry');   //Stores user requests for live support. Extends Task [task]

  gr.initialize();

  gr.queue = queue;

  gr.action = 'waiting';

  gr.short_description = myNumber +": " + comments;

  gr.group = user_display_name +', ' + "Service Desk";

  gr.active = true;

  gr.insert();

}

it does the insert fine but I am trying to find how I can store the "Number" i.e. CHAT0012806 into a variable after the insert.

Would I need to do a table query afterward?

Any help would be appreciated

1 ACCEPTED SOLUTION

anurag92
Kilo Sage

After insert try this:



gs.addInfoMessage("A new chat queue has been created for you with number: "+gr.number);


View solution in original post

2 REPLIES 2

anurag92
Kilo Sage

After insert try this:



gs.addInfoMessage("A new chat queue has been created for you with number: "+gr.number);


I don't know why I didn't think of that, I just add "var chat_queue_entry = gr.number" after the insert



Thanks for the quick reply.