Topic
  • 2 replies
  • Latest Post - ‏2013-12-04T14:26:10Z by Bzoo
Bzoo
Bzoo
71 Posts

Pinned topic Deleting a record using API

‏2013-12-03T20:32:16Z |
All:
--------------------------
CQ version 7.1.2.08
Windows 7 Client
--------------------
I am trying to delete a record from the database using the following code
The code works (deletes the record) but I get the error message:
Could you please let me know the problem with the code.
This xdelete opertaion is allowed on this record type "myasset" as per the CQ designer.
--------------------------
Error messsage:
 
CRMUD0014E This operation is permitted only when the entity is in an editable state 
(that is, when an AdActionDef of the appropriate type is being app lied). 
at EliminateDuplicate.pl line 90.( at  $Validate = $Record->Validate();) 
----------------------------------------
Code snippet: (EliminateDuplicate.pl)
 
my $Record = $session->GetEntityByDbId( "myasset", $dbid );
$session->DeleteEntity($Record,"xdelete"); 
 
 #$Record->EditEntity("xDelete"); # this does not work.
$Validate = $Record->Validate();
if(!($Validate)){ # Validating modification.
$Commit = $Record->Commit(); # Commiting modification.
 
---------------------------------
 
Any help is appreciated.
Thanks
Bzoo
  • DonaldN
    DonaldN
    255 Posts

    Re: Deleting a record using API

    ‏2013-12-03T23:27:30Z  

    Deletion is not modification so you should not follow the normal flow of record modification.

    The "Validate" method should follow an "EditEntity" method, for modification. Since you already verified that "EditEntity" did not work for deletion, the "Validate" method should not be there as well (due to the entity not being in an editable state - in fact the entity no longer exists).

    The "DeleteEntity" actually returns a string containing error messages should the action fail, so you should check this string directly, rather than use "Validate".

    http://pic.dhe.ibm.com/infocenter/cqhelp/v8r0m0/topic/com.ibm.rational.clearquest.apiref.doc/topics/r_session_deleteent.htm

  • Bzoo
    Bzoo
    71 Posts

    Re: Deleting a record using API

    ‏2013-12-04T14:26:10Z  
    • DonaldN
    • ‏2013-12-03T23:27:30Z

    Deletion is not modification so you should not follow the normal flow of record modification.

    The "Validate" method should follow an "EditEntity" method, for modification. Since you already verified that "EditEntity" did not work for deletion, the "Validate" method should not be there as well (due to the entity not being in an editable state - in fact the entity no longer exists).

    The "DeleteEntity" actually returns a string containing error messages should the action fail, so you should check this string directly, rather than use "Validate".

    http://pic.dhe.ibm.com/infocenter/cqhelp/v8r0m0/topic/com.ibm.rational.clearquest.apiref.doc/topics/r_session_deleteent.htm

    Hi Donald:

    Thanks for your clarification. Great Help!!

    Regards,

    Bzoo.