After callin $at->new you have to call $at->Load. Once the asset is loaded you can call AddLink. Links are bi-directional so you don't have to add the reverse link.
On Thu, Aug 13, 2009 at 11:41 AM, Michael Ellis<[email protected]> wrote: > Either I not understanding something or I think I might have confused the > issue by leaving some ambiguity in what I was asking. I'm just dealing with > one DB now. Here's the situation: > > -I have imported the assets themselves from our old helpdesk software's DB > into RTAT's DB. > -I have a table of linked assets from the old system. > -I want to use this table as input to create links in the new RTAT. I can > massage the input data as needed to have it in "Name", "URI", or whatever. > > > I'm a perl newbie so I want to make sure I understand this: > $at->AddLink(Type=>'RefersTo',Target=> $other_at->URI); > > $at = RTx::AssetTracker::Asset->new(RT->SystemUser) > AddLink is presumably a function in AssetTracker > RefersTo is the type of link > Target is the asset to create the ReferTo link to? And what kind of info does > it want here (Name, URI, ?)? > $other_at = ??? (or did I make you think I was trying to link between two > different RTAT systems?) > URI is the uri of the asset the link is created in/from? > > Does the reverse link get created automatically, or should I repeat the > statement, reversing Target and URI and flip the linktype? > > Thanks, > > Mike > > -----Original Message----- > From: Todd Chapman [mailto:[email protected]] > Sent: August-12-09 3:46 PM > To: Michael Ellis > Cc: rt Users; [email protected] > Subject: Re: [rt-users] Asset Tracker API > > My bad. If you want to link $at to $other_at: > > $at->AddLink(Type=>'RefersTo',Target=> $other_at->URI); > > Try it and see. > > On Wed, Aug 12, 2009 at 4:38 PM, Michael > Ellis<[email protected]> wrote: >> Just to clarify, in... >> >> $at->AddLink(Type=>'RefersTo',Target=> $at->URI); >> >> ... "Target" is the URI of the RefersTo link, while the URI at the end of >> the line becomes the corresponding ReferredToBy? >> >> -Mike >> >> -----Original Message----- >> From: [email protected] >> [mailto:[email protected]] On Behalf Of Todd Chapman >> Sent: August-12-09 12:04 PM >> To: Michael Ellis >> Cc: rt Users; [email protected] >> Subject: Re: [rt-users] Asset Tracker API >> >> It should be similar to adding links to tickets. >> >> Ticket example: $TicketObj->AddLink(Type=>'RefersTo',Target=>$ticket->id); >> >> So asset would be: $at->AddLink(Type=>'RefersTo',Target=> $at->URI); >> >> The default link types are: >> >> RefersTo >> ReferredToBy >> RunsOn >> IsRunning >> DependsOn >> DependedOnBy >> ComponentOf >> HasComponent >> Components >> >> Unlike RT, AT's link types are configurable. See AT_Config.pm. >> >> On Wed, Aug 12, 2009 at 12:06 PM, Michael >> Ellis<[email protected]> wrote: >>> (I’m sorry, I’m not sure if this is the right forum for this, If it isn’t >>> I’d love to know what is.) >>> >>> >>> >>> I’ve set up AT 1.2.4b1 with RT 3.8.4 and used a script written by >>> Jean-Sebastien Morisset to import my assets from our old DB. I now want to >>> recreated the links between assets. >>> >>> >>> >>> I’m wondering if anyone could point me in the right direction for finding >>> what the set links equivalent to the set fields code below: >>> >>> >>> >>> my ($id, $t, $msg) = $at->Create ( >>> >>> Name => $csv[$csv_map{"Name"}], >>> >>> Status => $csv[$csv_map{"Status"}], >>> >>> Type => $csv[$csv_map{"Type"}], >>> >>> >>> >>> What file in AT contains the handlers for these so that I can just inspect >>> it to see what else it can do? >>> >>> >>> >>> Thanks, >>> >>> >>> >>> Mike >> _______________________________________________ >> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users >> >> Community help: http://wiki.bestpractical.com >> Commercial support: [email protected] >> >> >> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. >> Buy a copy at http://rtbook.bestpractical.com >> >> > > > _______________________________________________ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: [email protected] Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
