[solved] API call to change InciState of CI

English! place to talk about development, programming and coding
Post Reply
RStraub
Znuny guru
Posts: 2210
Joined: 13 Mar 2014, 09:16
Znuny Version: 6.0.14
Real Name: Rolf Straub

[solved] API call to change InciState of CI

Post by RStraub »

Hello again !

I'm currently trying to write an event which parses an article, links the ticket to a corresponding CI and changes it's incident state. All but the incident state change is working fine by now, but I seem unable to find the correct API call to edit a CI.

From what I see in the AgentITSMConfigItemEdit.pm, edited CIs are read completly and then saved as a new version (including upload and re-adding of attachments).

So, is there an "easy" function I could use to just edit the Inci state? What would you recommend as alternative, as I thought of an sql query to manipulate the db directly.

Best regards and many thanks,
Rolf

Edit:
Just as reference if someone stumbles upon this post. There is no CI - edit, only the versionadd. Important thing is to pass the XMLData, or your CI will be empty. This is an example:

Code: Select all

    my $OldVersion_ref = $ConfigItemObject->VersionGet(
        ConfigItemID => $ConfigItemID,
        XMLDataGet => 1,
    );
    my %OldVersion = %$OldVersion_ref;
    my $VersionID = $ConfigItemObject->VersionAdd(
        ConfigItemID => $ConfigItemID,
        Name         => $OldVersion{Name},
        DefinitionID => $OldVersion{DefinitionID},
        DeplStateID  => $OldVersion{DeplStateID},
        XMLData      => $OldVersion{XMLData},
        InciStateID  => $NewInciStateID,
        UserID       => 1,
    );
Currently using: OTRS 6.0.14 -- MariaDB -- Ubuntu 16 LTS
Post Reply