Solved

Dynamic Variables Help


I’m new to front and new to apis so forgive me if this is simple but any help would be greatly appreciated.

 

We use an ITSM tool called Autotask and I’m trying to create dynamic variables in front that recognise autotask ticket numbers (T20240518.1010) and then using the autotask API pull through details about the ticket.

 

I’ve got the connection to autotask working.

The difficulty I’m facing is trying to get the target URL to work. 
It’s this
https://ww16.autotask.net/Mvc/ServiceDesk/TicketDetail.mvc?workspace=False&mode=0&TicketID=TICKETID

Unfortunaltey TICKETID isn’t the ticket number mentioned above, it’s a separate 6 digit number.

So….
I’m creating a dynamic variable that uses the autotask API to get the ticket ID when inputting the ticket number.

When I use postman with a known ticket number in the API endpoint (not sure if that’s correct terminology)


https://webservices16.autotask.net/atservicesrest/v1.0/tickets/query?search={ "IncludeFields": ["id"], "filter":[{"op":"eq","field":"TicketNumber","value":"T20240516.0050"}]}

I get this json back (where id is the number I need):

{
"items": [
{
"id": 252316,
"userDefinedFields": []
}
],
"pageDetails": {
"count": 1,
"requestCount": 500,
"prevPageUrl": null,
"nextPageUrl": null
}
}

I know that Front only allows you to look at the top level but one of the Front team suggested I try this:

 

Fetch from server:
https://webservices16.autotask.net/atservicesrest/v1.0/tickets/query?search={ "IncludeFields": ["id"], "filter":[{"op":"eq","field":"TicketNumber","value":"TEXT PATTERN"}]}

(Where TEXT PATTERN is Tdigits.digits)

Parse as JSON

<> Extract object property
items

Parse as array

<> First Element

<> Extract object property
id

Parse as number

 

But when I do this and then test it I just get:

 

Happy to share as much info as needed. If anyone can help me out I’d be so grateful!

 

 

(Extra info: I tried as a test changing the text pattern to ORDER-DIGITS where DIGITS was a known 6 digit number that was an ID and then put that in the Target URL and that returned this:

So I know if I can get the order ID this bit will work. I just can’t get the order ID)

icon

Best answer by justin 20 May 2024, 19:26

View original

4 replies

Userlevel 3
Badge +8

Hi Mike! 

Thanks for writing in. It looks like you are setting up a Dynamic Object based on a text pattern that will link to a URL, while fetching additional details from your server, is that correct? 

If so, I’ve rebuilt this from what I can see on my end, completing the same test pattern and it seems to work.

 

The Dynamic Object testing will use the text pattern set in step 1 and link to the specified URL set in step 2. The additional fetch you are completing in the dynamic variable can be used to extract top-level fields that can be added as details in your title, description or corresponding custom fields (as shown in the screenshot). 

Does this help?

Best,

Justin

Hi Justin,

 

Thanks for your response. It’s on the right lines but I think there’s a level of complexity that’s missed.

Is yours showing actual autotask or just some general text?
I’m trying to use the autotask API to pull out a ticket ID when given a ticket number.

I can’t see in your example the ticket ID (a 6 digit number) that’s pulled when the specific api is called.

I’m also interested by what’s in your target url (what’s the purpose of the target url - is that a link for clicking on that’ll take you somewhere specific?)

It’s not showing your item id in the test examplen can it show that?

Thanks for engaging.

Mike

Userlevel 3
Badge +8

Thanks, Mike!

While I’m not familiar with Autotask, nor have access to its API, my interpretation was based on using the text pattern specified to generate Dynamic Object from messages and comments. 

The target URL can be any URL that you would like to link to when selecting the created Dynamic Object in a given conversation. These are usually created to be dynamic links using IDs to access a page specific to a given order/item. 

Additionally, the custom fields that you add to your Dynamic Object will appear in the example and conversations where it’s applied. Since I do not have access to this API, my request did not fetch any data, leaving the custom field empty.

On another note, I do see that you’ve contacted our support team separately. We’ll follow up on some of the more specific errors that you’re still running into there since this requires a bit more investigatory work, potentially involving more private details about your app. 

Best, 
Justin

That’s no problem

Andy James is being a hero and working really hard on it which I really appreciate but didn’t know if there was any other resources out there. I’m very happy to keep working with him on this.

 

Thanks

Mike

Reply