getting number of links from a CI.

Moderator: crythias

Locked
Basia
Znuny newbie
Posts: 7
Joined: 16 Jan 2015, 10:30
Znuny Version: 3.3.10
Real Name: Seba

getting number of links from a CI.

Post by Basia »

hi,

is it possible to get the number of links a CI has?

something like:

Code: Select all

@ListOfLinks = CommonObject{ConfigItem}->ConfigItemLinksGet(
	ConfigItemID => 'Id number';
}
i need to check how many other CI's are linked to a CI.

thank you.
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: getting number of links from a CI.

Post by RStraub »

Like this?

Code: Select all

LinkList()
get all existing links for a given object

Return $LinkList = { Ticket => { Normal => { Source => { 12 => 1, 212 => 1, 332 => 1, }, }, ParentChild => { Source => { 5 => 1, 9 => 1, }, Target => { 4 => 1, 8 => 1, 15 => 1, }, }, }, FAQ => { ParentChild => { Source => { 5 => 1, }, }, }, };

   my $LinkList = $LinkObject->LinkList(
       Object    => 'Ticket',
       Key       => '321',
       Object2   => 'FAQ',         # (optional)
       State     => 'Valid',
       Type      => 'ParentChild', # (optional)
       Direction => 'Target',      # (optional) default Both (Source|Target|Both)
       UserID    => 1,
   );
from:
http://otrs.perl-services.de/docs/otrs/ ... bject.html
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
sebasia
Znuny newbie
Posts: 13
Joined: 23 Mar 2015, 15:28
Znuny Version: 4.0.7

Re: getting number of links from a CI.

Post by sebasia »

i had to make a new user as i lost my old credentials, but thanks for answering.
i have some more questions i hope you can answer.


can this be done with a CI in the cmdb?

an object like this:

Code: Select all

    my $ConfigItem =  $CommonObject{ConfigItemObject}->ConfigItemGet(
        ConfigItemID => $ConfigItemID,
        );
i am not sure how i would call fx. LinkList()
on this object.
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

Re: getting number of links from a CI.

Post by RStraub »

Sorry - I was on vacation :)

And sure you can. All you need is the ConfigItemID:

Code: Select all

    my $LinkList = $Self->{LinkObject}->LinkList(
        Object  => 'ITSMConfigItem',
        Key     => $MyConfigItemID,
        State   => 'Valid',
        UserID  => '1',
    );
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Locked