Cancel
Showing results for 
Search instead for 
Did you mean: 

USER_item_created - Edit an item with using post action

Experimenter
Experimenter

Hi,

 

I need a customization for an item type, so i create a dynamic link library to achive that with using post action (USER_item_created). I want to get the created item tag and do something on it, but the item tag and item revision tag returns NULL.

 

Here is the sample code..

 

extern int ITK_user_main(int argc, char * argv[])
{
     (CUSTOM_EXIT_ftn_t)CUSTOM_method_register_callbacks();

     return ITK_ok;
}

 

extern DLLAPI int CUSTOM_method_register_callbacks()
{
     CUSTOM_register_exit("CUSTOM_method", "USER_item_created", (CUSTOM_EXIT_ftn_t)CUSTOM_method_call);

     return (ITK_ok);
}

 

extern DLLAPI int CUSTOM_method_call(int *decision, va_list args)
{
     tag_t tItem = NULLTAG;

     tag_t tItemRev = NULLTAG;
     char * cItemID = va_arg(args, char *);
     char * cItemRev = va_arg(args, char *);

     printf("Item ID: %s\n", cItemID); // Item ID gets correctly
     printf("Item Revision : %s\n", cItemRev); // Item Revision gets correctly

 

     ITEM_find_item(cItemID, &tItem); // Item Tag is NULL ?

     ITEM_find_revision(cItemID, cItemRev, &tItemRev); // Item Revision Tag is NULL ?

 

     if (tItem != NULLTAG)
     {
     *decision = ONLY_CURRENT_CUSTOMIZATION;
     }
     else
     {
     *decision = NO_CUSTOMIZATION;
     }
     return ITK_ok;
}

 

Best regards.

3 REPLIES

Re: USER_item_created - Edit an item with using post action

Do you want to just add a post action on item creation? or is there any special requirement which can be fulfilled by user exits?

 

can you explain the requirement?

 

 

Re: USER_item_created - Edit an item with using post action

Experimenter
Experimenter

I will create some dataset after creating new item revision (data will come other system) and some changes on item revision relations. I research doing all that on post action, but it requires custom codes on BMIDE. So I want to try USER libs. According to the documentation it sould be possible.

 

In documentation it says:

 

USER_EXITS_API int USER_item_created ( const char * item_id, const char * revision_id )

 

This USER EXIT ITK provides a hook point for customers to plug the customization codes into the item creation. It is called at the end of successful item creation.

 

Parameters

item_id (I) Id assigned to newly created item

revision_id (I) Revision id assigned to the newly created item revision

Re: USER_item_created - Edit an item with using post action

try this, without writing single line you can do it.. if only need to is to create dataset upon item creation

 

Capture1.PNG

 

 

Capture2.PNG