Transferring tickets

Pat Surtan
Tera Expert

Hello,

 

I have a request to transfer between IT and Account. Here is the script I am using.

 

var gr = new GlideRecord("incident");

gr.initialize();

gr.u_requested_by = current.caller_id;

gr.short_description = current.short_description;

//copy all the fields needed.
gr.contact_type = current.contact_type;

gr.state = current.state;

gr.description = current.description;

gr.insert();

 

 

For the most part, this is working. The incident ticket is created. However, I would like to improve this more.

 

1. Change the state of the Account ticket to Close when the Incident ticket is created from transferring.

 

2. Post a message in Additional comments to say Account ticket XXXX was closed and INCXXXXX was created.

 

3. Post the same message from requirement #2 on top of the screen to show the record and redirect to the new INC ticket create.

 

Can someone help with this?

3 REPLIES 3

Allen Andreas
Administrator
Administrator

Hello,

We don't know where you're running this script, but if you have access to current object, you can set current (I assume Account ticket is the "current" object) ...so you can use:

current.field_name = value;

 

So you can add state and set the value to closed, you can add comments and make the statement as you've mentioned, and you can use gs.addInfoMessage("message"); to show the info message, etc.

 

Please try this on your own and let us know if you're still having issues. It's best for you to attempt yourself instead of just posting the requirements on the forums and people giving you exact script to use.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi Allen,

 

I think I got most of it working now. Question though. When I mapped contact type, the values carry over from accounting table to incident table. But, the value is showing in blue within Incident record. Why is that? Why isn't that value just carrying over normally?

Hi,

I'm glad my reply above as Helpful 🙂

 

When you see a blue result like that, that means that that server value (not display value) is not found on that choice list. So it's showing it, because you set it as it, but it's not a real value for that table and field. That means that the value of Self-Service on the table your copying from...is different than the value of Self-Service on the table you're copying to. So you may need to double-check those field values on the 1st table and then adjusting them for the 2nd table. If you navigate to the first table and a return there and right-click the field in question, you can choose "Configure Dictionary", then scroll down and look at the choice fields and their value. Repeat the same for the 2nd table and relevant field. Most likely, you'll see a difference.

 

In your script, you'd want to add a conversion section such as:

 

if (current.contact_type == 'value_of_self_service_here') {
gr.contact_type = '2nd_table_self_service_value_here');
}

 

and so on as needed to help them convert to the right values for the other table.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!