User Exit and Server Exit in Teamcenter

From Teamcenter developer’s point of view, finding a customization hook is very important. Once we identify the correct hook we can plug-in our custom code to either override the default behavior or add custom behavior in Teamcenter.

Customization Hook– It is an exit point from Teamcenter standard functionalities where we can either override the OOTB functionalities or add custom functionalities by writing custom codes.

There are two types of exit points:

  1. User Exit
  2. Server Exit

User Exit

It is an ITK function called during the course of server operations and which can be overridden by writing custom ITK code to replace the default behavior of Teamcenter. These functions are prefixed by USER_ and are defined in the user_exits.h header file in include directory of TC_ROOT.

custom user exit is a user exit that is overridden with a custom implementation. Some of the common OOTB functions which can be overridden:

USER_validate_item_rev_id()

USER_new_item_id()

USER_new_revision_id()

USER_new_dataset_name()

USER_new_folder_name()

USER_new_form_name()

USER_validate_item_rev_id()- It is used to validate the item_id and item_revision_id fields of a newly created item in Teamcenter.

USER_new_item_id()/USER_new_revision_id()- It is used to supply a new ID or name value when a user clicks on an Assign button on Item create dialog window.


                  Explanation of ITK Login Program


Customizing a User Exit

There are two ways to customize a user exit:

      1. Rebuild libuser_exits.dll

Teamcenter provides option of editing some sample source code files available in Sample directory of TC_ROOT and then recompiling the default shared library libuser_exits.dll available in lib directory of TC_ROOT.

       2. Registering a Custom dll

Write your custom code (.c file) using and create a custom dll using Visual studio. Register the custom dll using Teamcenter Menu:

Edit->Option->Preferences and under the TC_customization_libraries preference add the exact name of the custom dll. When Teamcenter session starts it looks for the libraries mentioned by this preference and load them in to memory.

Below is the sample code to override the USER_validate_item_rev_id() user exit:

extern “C” // for C++ compilation

DLLAPI int globalplm_validate_item_rev_id(

int *decision, va_list args)

{

// business logic…

}

// Example: Registering a user exit callback function

extern “C” // for C++ compilation

DLLAPI int libglobalplm_register_callbacks()

{

CUSTOM_register_exit( “libglobalplm”, // Custom library name   “USER_validate_item_rev_id”, // the user exit we’re customizing (CUSTOM_EXIT_ftn_t) globalplm_validate_item_rev_id   // the callback function );

return 0;

}


               Teamcenter Unified Data Model Concept


Server Exits

These are Exit points from standard Teamcenter functionality to Java. These exit points are also known as user services. Use them when you want to call a custom ITK functions from Java in the Teamcenter rich client. These are used to customize the Teamcenter rich-client interface by adding new commands to the menus. Teamcenter provide rich client JAVA APIs to call server side ITK code on click of command menus. Business logic execution happens on server-side, and then return the results back to the client. IMANUserService service which helps to implement ITK server exit to rich client. IMANUserServices class provides user services to the IMANSession component. From IMANSession, we can instantiate the user service. Below is the sample code snippet to explain the flow:

IMANUserService globalplmsrvc = session.getUserService(); //session is an object of IMANSession class
String[] globalplmargs = new String[int];// number of arguments in server exit function
globalplmsrvc.call(“Exact name of server exit function”, globalplmargs);

 

We will more post on PLM TUTORIAL–>Teamcenter Customization in upcoming days.

Kindly provide your valuable comment on below Comment section and also have you any question kindly ask to ASK QUESTION in FORUM. Our Team will try to provide the best workaround.

DEV ADMIN

View Comments