Code Sample: Searching / Selecting Tickets


As a best practice in automating portions of Workflows one could have a process that scans tickets for every X number of minutes. With the API one could then select tickets in that automated process that are part of a workflow step that do not require manual interaction from the help desk personel.

            var request = new Request()
            {
                SearchWithin = EnumSearchWithin.Tickets,
                WorkFlowStepId =10 // for example a license request.
            };
            var search = new SearchEventArgs(request) { SortBy = "TicketId", SortOrder = EnumSortOrder.ASC };
            var tickets = Tickets.SelectTicketss(search);

            for (int i = 0; i < tickets.Count(); i++)
            {
                var ticket = (InstantASP.InstantKB.Components.Ticket)tickets[i];
                // do something with the ticket.
            }

 Sjef van Leeuwen | Lead Developer | Oxford Computer Group BeNeLux

www.oxfordcomputergroup.nl | Expertise in Identity & Access Management



Thanks for sharing Sjef. We do hope to carry over the scheduled tasks feature from InstantForum.NET which allows you to run .aspx pages every X number of seconds into a future InstantKB.NET update. This would certainly help with things like this. 

Thanks again :)

http://www.instantasp.co.uk/images/line.gif
Kindest Regards,

Ryan Healey



ryan@instantasp.co.uk
www.instantasp.co.uk
Blog | Community | Docs

http://www.instantasp.co.uk/core/assets/images/email/facebook.png http://www.instantasp.co.uk/core/assets/images/email/twitter.png http://www.instantasp.co.uk/core/assets/images/email/google.png http://www.instantasp.co.uk/core/assets/images/email/linkedin.png

I have put my scheduler on codeplex.
https://iisprocessscheduler.codeplex.com/

It runs as soon as IIS is started, also restarts after stuff like IISReset, assuring the service is always running.


 Sjef van Leeuwen | Lead Developer | Oxford Computer Group BeNeLux

www.oxfordcomputergroup.nl | Expertise in Identity & Access Management



Very cool Sjef. How do you tell your scheduler which code to execute? Is this within the IISProcessSchedulerPreWarmUp class? If so i don't suppose you can post an example. Can you configure the poll interval? Just curious :)

http://www.instantasp.co.uk/images/line.gif
Kindest Regards,

Ryan Healey



ryan@instantasp.co.uk
www.instantasp.co.uk
Blog | Community | Docs

http://www.instantasp.co.uk/core/assets/images/email/facebook.png http://www.instantasp.co.uk/core/assets/images/email/twitter.png http://www.instantasp.co.uk/core/assets/images/email/google.png http://www.instantasp.co.uk/core/assets/images/email/linkedin.png

Yes polling is configurable.
<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key ="Interval" value="1" />
    <add key ="TouchUrl" value ="https://localhost/IISProcessScheduler/CallTest.aspx" />
  </appSettings>
    <system.web>
        <compilation debug="true" targetFramework="4.0" />
    </system.web>
</configuration>

I have kept it simple now... it just allows touching a url, but i suppose i'm going to extend it with a app.configuration that allows you to invoke a constructor through reflection.

 Sjef van Leeuwen | Lead Developer | Oxford Computer Group BeNeLux

www.oxfordcomputergroup.nl | Expertise in Identity & Access Management



Oh very cool. Thanks for sharing Sjef and thanks for your feedback on the tickets yesterday. I look forward to taking a closer look at some of your suggestions ASAP. 

http://www.instantasp.co.uk/images/line.gif
Kindest Regards,

Ryan Healey



ryan@instantasp.co.uk
www.instantasp.co.uk
Blog | Community | Docs

http://www.instantasp.co.uk/core/assets/images/email/facebook.png http://www.instantasp.co.uk/core/assets/images/email/twitter.png http://www.instantasp.co.uk/core/assets/images/email/google.png http://www.instantasp.co.uk/core/assets/images/email/linkedin.png
GO

Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....







InstantASP Forums


Search