Discussions  >  CollabNet TeamForge APIs  >  Perl createartifact3 not able to set flex fields

Back to topic list

Perl createartifact3 not able to set flex fields

Author mksingh
Full name manish singh
Date 2012-01-20 10:11:12 PST
Message Hi,

I am trying to create artifact in one of the tracker with following -
...
....
.....
my $fValues = {
    'Project Type' => "Maintenance",
    'Issue Type' => "Defect",
    'System Status' => "Development"
};

my $flexFields = SoapFieldValues->​new($fValues);
my $hasFlex = 0;

while ( my ($k,$v) = each %{ $fTypes } ){
    $hasFlex = 1;
    $flexFields -> type($k,$v) ;
}

$flexFields = $flexFields -> prepare('flexFields');
$flexFields = undef if ( not $hasFlex );

my $tempTargetArtifact = $tf->TrackerApp-​>createArtifact3(​
    $sk, # session
    "tracker1234", #tracker
    $srcArtifact->title, # title
    $srcArtifact->description, # descr
    undef, # group
    $srcArtifact->category, # cat
    $status, # status
    undef, # customer
    $srcArtifact->priority || 3, #prio
    0, # est effor
    0, # rem effort
    0, # auto sum
    0, # points,
    $srcArtifact->assignedTo, # assigned to
    $srcArtifact->$​reportedReleaseId, # release id
    $targetPlanningFolder, # planning folder
    $flexFields,
    undef,
    undef,
    undef
);

$tf->createAssociation($sk, $tempTargetArtifact->id, $srcArtifact->id, "Creating association for Given Artifact");

printf("%d. New Created Artifact - %s. Updating it. \n", $counter, $tempTargetArtifact->id);

my $targetArtifact = $tf->TrackerApp-​>getArtifactData3​($sk,$tempTargetAr​tifact->id);
## Set flexfields
$targetArtifact-​>flexFields->fiel​d("Issue Type","Defect");
$targetArtifact-​>flexFields->fiel​d('System Status',"Development");

eval {
    $tf->TrackerApp-​>setArtifactData3​($sk,$targetArtifa​ct,"Ceated Artifact",undef,undef,undef);
};
if ( $@ ) {
    printf "ERROR: %s\n", $@;
}
....
....

On exectuting this, creating and associating goes through. But flexfileds are not updated. Not only that setArtifactData3 does not update artifact. if I got to UI and press Update (or Update and View), scripts start working after that.

XML data captured is as follows.
......
.....
SOAP::Transport::HTT​P::Client::send_rece​ive: HTTP/1.1 500 Internal Server Error
Cache-Control: max-age=30
Connection: close
Date: Wed, 14 Dec 2011 11:06:08 GMT
Server: Apache-Coyote/1.1
Vary: User-Agent
Content-Type: text/xml;charset=utf-8
Expires: Wed, 14 Dec 2011 11:06:38 GMT
Client-Date: Wed, 14 Dec 2011 12:06:50 GMT
Client-Peer: .......
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
CtfUserName: .....
X-Powered-By: JBoss

<?xml version="1.0" encoding="utf-8"?​><soapenv:Envelop​e xmlns:soapenv="http://schemas.xmlso​ap.org/soap/envelope​/" xmlns:xsd="http://www.w3.o
rg/2001/XMLSchema" xmlns:xsi="http://www.w3.org/20​01/XMLSchema-instanc​e"><soapenv:Bod​y><soapenv:Fau​lt><faultcode xmlns:ns1="http://schema.op
en.collab.net/sfee50​/soap50/type">ns1​:IllegalArgumentFaul​t</faultcode>​<faultstring>Th​e field Issue Type is a required field in folder tracke
r4124 and therefore must have a value.</faultstri​ng><detail>​<ns2:exceptionNam​e xmlns:ns2="http://xml.apache.org/axis/">com.collabnet.ce.soap
50.fault.IllegalArgu​mentFault</ns2:ex​ceptionName><n​s3:hostname xmlns:ns3="http://xml.apache.org/axis/">serverNme</ns3:hos
tname></detail​></soapenv:Fau​lt></soapenv:B​ody></soapenv:​Envelope>

what else should be done to make it work ?

Regards,
Manish
Attachments

« Previous message in topic | 1 of 2 | Next message in topic »

Messages

Show all messages in topic

Perl createartifact3 not able to set flex fields mksingh manish singh 2012-01-20 10:11:12 PST
     RE: Perl createartifact3 not able to set flex fields srinivasan2407 Srinivasan AR 2012-02-12 08:58:27 PST
Messages per page: