How to get the Change-State by Perl

Moderator: crythias

Locked
Rasputin80
Znuny newbie
Posts: 16
Joined: 29 Feb 2016, 20:04
Znuny Version: 4.0.18
Real Name: Oliver

How to get the Change-State by Perl

Post by Rasputin80 »

Hello,

We are using a customzied Version of AgentChangesInEventCalendarEvents.pm (https://github.com/reneeb/otrs-ChangesI ... rEvents.pm) and i'm unsure how i get the Change-State (text) in to a Variable,
our change states comes from ITSM::ChangeManagement::Change::State. I'd like to fil a Variable with "successful" or "aborted" etc.

Thanks for a Tip
Oliver
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: How to get the Change-State by Perl

Post by reneeb »

The ChangeGet method returns a hash with various information, there is a key 'ChangeState'... https://github.com/OTRS/ITSMChangeManag ... MChange.pm

And you can get all states with the GeneralCatalog-Object:

Code: Select all

    my $StateList = $Kernel::OM->Get('Kernel::System::GeneralCatalog')->ItemList(
        Class => 'ITSM::ChangeManagement::Change::State',
);
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Rasputin80
Znuny newbie
Posts: 16
Joined: 29 Feb 2016, 20:04
Znuny Version: 4.0.18
Real Name: Oliver

Re: How to get the Change-State by Perl

Post by Rasputin80 »

So actually that should work?

Code: Select all

my $Change = $ITSMChangeObject->ChangeGet(
			UserID   => $Self->{UserID},
			ChangeID => $WorkOrder->{ChangeID},
			
	);
		
	my $ChangeState = $Change->{ChangeState};
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: How to get the Change-State by Perl

Post by reneeb »

yes
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Locked