workflow action handler registration for the task

Upload: taufique98

Post on 12-Oct-2015

285 views

Category:

Documents


6 download

DESCRIPTION

Workflow Action Handler Registration for the Task

TRANSCRIPT

Teamcenter Unified Architecture Workflow Action Handler Registration for the Task Action Handler :Action Handler are ITK program written to customize the task action .Suppose we want to get some set of information from the particular task when that task is executed in workflow in such case we register our Handler or ITK program with the task in workflow designer so that handler get called when task is executed. As a beginner it is difficult to write task handler , so I thought to present you with simple example of writing Action Handler. We will write Custom exit for the Handler program.

Description of Function is written as comment just above the functions .//Call back function which is executed when library is loaded by team center i.e at the start of//teamcenter in below function simple_custom_handlers function is register to execute when//library is loaded .extern DLLAPI int tata_register_callbacks(){ CUSTOM_register_exit("tata","USER_gs_shell_init_module",(CUSTOM_EXIT_ftn_t)simple_custom_handlers); printf("\nTata custom ets_Test_Workflow registering"); JOURNAL_comment ("Tata custom ets_Test_Workflow registering"); return ( ITK_ok );}//This function is executed from tata_register_callbacks() function above on library loadextern DLLAPI int simple_custom_handlers( int *decision , va_list args){ int retcode = ITK_ok; retcode = ActionHandler_register_action_handlers(); *decision = ALL_CUSTOMIZATIONS; args = NULL; return retcode;}//This function is executed from simple_custom_handlers(int *decision , va_list args) function//above on library load in this function we have registed our Our Funciton or Handler //(ets_Test_Workflow) using EPM_register_action_handler .int ActionHandler_register_action_handlers(){ int retcode = ITK_ok; if ( retcode == ITK_ok ) { retcode = EPM_register_action_handler ( "ets_Test_Workflow", "Description Assigned", ets_Test_Workflow );printf("\nTata custom ets_Test_Workflow registering***************************"); } return retcode;}//This function is executed at the task where you have registered it int ets_Test_Workflow(EPM_action_message_t msg){ tag_t *attachments = NULLTAG; int n_items =0; tag_t *item_tags = NULLTAG; int noAttachment =0,t=0,R=0; tag_t rootTask = NULLTAG; char *inTask = NULL; int ifail =0; printf("\nets_Test_Workflow\n"); /* ifail=(WSOM_find("eTS",&n_items,&item_tags)); printf("\n item %d \n",n_items);*/ ifail=(EPM_ask_root_task(msg.task,&rootTask)); AOM_ask_value_string(msg.task,"object_name",&inTask) ; printf("\nInput Task Name:%s\n",inTask);fflush(stdout); ifail=(EPM_ask_attachments(rootTask,EPM_target_attachment,&noAttachment,& attachments)); printf("Target Attachment:%d\n",noAttachment); return 0;}

How to Compile :Set MSDEV_HOME Variable if you have not done it before or set it as environment variable1) Set MSDEV_HOME=c:\Program Files (x86)\Microsoft Visual Studio 8\VC2) compile -DIPLIB=none eTs_Workflow.c3) link_custom_exits tata

{Note: Parameter for link_custom_exits is library name/sitename}Handler is written and library is generated . Now how we make it available in Handler pane for registration with task .

Please refer my previous Article of Teamcenter Unified Architecture Register Custom exit

WorkFlow Designer :Now we will use workflow designer to attach Handler to Task. I am considering here that you have created a simple workflow using workflow designer .We will edit the workflow to attach our Action handler to task.

Select Process Template >> select edit mode as shown in snap below :

After we click OK Part will get submitted to life cycle

Action Handler get executed once Task of Handler get executed.Posted by Anil at 22:42 Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest1 comment:1. busetto25 March 2014 12:23Please, just work with visual studio 2005? ThanksReply