Advanced Customization > Windchill Adapter > Using Windchill Adapter Webjects > Naming the Adapter in INSTANCE Parameters > Programmatically Discovering the Adapter Name
  
Programmatically Discovering the Adapter Name
* 
The previous examples show how you could hard code an INSTANCE parameter name for your Windchill adapter. This is not a desirable option when authoring tasks since it means that they cannot be reused on other installations without being manually modified.
It is best to discover the name of your Windchill adapter using the system configuration.
If your task is being authored for use with a JCA client, then you should use the supporting-adapter input parameter to discover which adapters the system has been configured with.
Not doing so negates the system configuration. In this case your instance parameter should look like the following example:
<ie:param name="INSTANCE" data="$(@FORM[]supporting-adapter[*])"
valueSeparator=";" delim=";"/>
When the task is invoked from a JCA client, the supporting-adapter input parameter is supplied by your system based on how it is configured. In general this is the most common way you should specify INSTANCE parameters for your Windchill adapter webjects.
If your task is not intended for use with a JCA client, then a common thing to do is to use the Get-Properties MGT webject to fetch the wt.federation.ie.VMName property and use that as input to your instance parameters.
<ie:webject name="Get-Properties" type="MGT">
<ie:param name="ATTRIBUTE" data="wt.federation.ie.VMName" />
<ie:param name="GROUP_OUT" data="properties" />
</ie:webject>
...
<ie:param name="INSTANCE"
data="$(properties[0]wt.federation.ie.VMName[0])" />
You can also programmatically provide the value for your INSTANCE parameter by fetching it from Info*Engine either from the VMName or using the system properties object when running in the servlet.
For example:
<%
String vmName = com.infoengine.au.NamingService.getVMName();
// if running in the servlet engine vmName points to the servlet's
// name and not the adapter's name
// the servlet will be configured with its server name pointing to
// the adapter
vmName = System.getProperty ( vmName + ".ieServerName", vmName );
// now VMName should point to the current Windchill adapter
// regardless of whether the task is being runn in the server or
// servlet engine
%>

...

<ie:param name="INSTANCE" data="$(@FORM[]supporting-adapter[*])"
valueSeparator=";" delim=";" default="<%=vmName%>" />