Hi,
In this code, the intent is to iterate through the tasks and modify the ID
field. The Task record (entity) should not be modified if it's state equals
"Completed".
When I run this routine, there are two problems:
Problem 1) The "if" statement is not being evaluated. The record (even if it's
in the "Completed" state is being modified.
Problem 2) Subsequent records (ie any record after the first one is not
modfied). In other words, if I have multiple records, just the first one in the
list gets modified. All others are skipped.
Can someone help me figure out where I am going wrong with this? Thanks.
<snip>
# Iterate through all tasks
foreach (@$tasks) {
# Get a task entity for the current taskid (in $_)
my $taskEntity = $session->GetEntity ('almtask', $_);
$taskEntity->GetFieldValue(state)->GetValue();
if ($taskEntity eq "Completed") {return;}
# did not work# if ($taskEntity eq "Completed") {return '';}
# did not work# if ($taskEntity eq "Completed") {exit 1;}
else {
$session->OutputDebugString ("Setting task entity to modify\n");
# Modify this task...
$taskEntity->EditEntity ('Modify');
$session->OutputDebugString ("Modifying task\n");
$session->OutputDebugString ("Setting task's project id to $ProjectID");
# Set the project field to the new ProjectID
my $returnMsg = $taskEntity->SetFieldValue ('project', $ProjectID);
return $returnMsg unless $returnMsg eq '';
<snip>
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/