Monday, July 25, 2011

Importing Data to an AR System Form on Database Level

You have more than one option to load data into an AR System form. You can use Remedy Import tool however you may need to build data on database level with a query for some data fix or administration tasks. E.g. There might be some number of corrupted tickets on your system and you may need to close them via an escalation. (The reason to use an escalation here is that tickets need to be closed by the workflow properly). First you have to create a regular AR System form, let's say "zz_Data_Fix" with default core fields plus character field named "ticket_number". Here I will also use a temporary table named zz_Intermediate for a better understanding. You populate this intermediate table with the query where you select the tickets which needs to be closed:

create table zz_Intermediate as
select ticket_number from mytickets where <condition for selecting tickets to be closed>

Here "mytickets" is the database table where you keep all your ticket data. You can also use joins in this query. Then you import ticket numbers into your zz_Data_Fix form (in order to find the schemaid of zz_Data_Fix, you can use the following: select schemaid from arschema where name = 'zz_Data_Fix'):

insert into zz_data_fix (request_id, ticket_number, create_date, last_modified_by, modified_date, status)
select rownum, ticket_number, 1, 'username', 1, 0 from zz_Intermediate


With running this query, records are loaded into the T table which keeps the data in AR System environment. (You have the option to directly import to T table but this way seems easier for me). However you also need to load H table which keeps status history info of every record. If you do not do that, you may not see your record in Remedy User.


insert into H1413 (entryid)
select C1 from T1413

Please note that form zz_Data_Fix is created from scratch therefore both T1413 and H1413 are empty. Some H tables might have different structures so you may need to adjust your query a little. After committing the above queries, you should see your ticket numbers when you make an unqualified search in Remedy User zz_Data_Fix form.

As the last step, you can write an escalation on zz_Data_Fix and make a Push Fields to your original ticket form with a PushFields if condition: $ticket_number$ = 'ticket_number' and modify any field you want.

No comments:

Post a Comment