Code Fix: An exception occurs when executing a List Method on an Advanced SmartObject.
KB001368
PRODUCT
Introduction
When executing an Advanced SmartObject List Method where a filter is applied on the method, an exception occurs. This will cause the K2 process instance to go into an error state as soon as the event referencing the SmartObject List Method is reached.
Error Scenario
- Open K2 Designer for Visual Studio and select to create a new Empty K2 Project.
- Add a new item to the project and select SmartObject.
- Name the SmartObject AD Users.
- Click on Advanced Mode. See image below.
- Remove all the SmartObject Methods. See image below.
- Click Ok on the warning message.
- Add a new SmartObject method. See image below.
- Name the method GetUsers and add the GetUsers Service Object Method from the Active Directory Service2 ServiceObject Server. See image below.
- Select Create All and finish the wizard. See image below.
- Deploy the SmartObject.
- Create a K2 process and drag an E-mail event to the design canvas.
- Add the GetUser List Method from the AD User SmartObject to the Message Body of the E-mail event.
- Add a Filter as per the image below.
- Select the DisplayName return property.
- Select the Return all results that match filter option.
- Finish the wizard and deploy the process.
- Start an instance of the process.
- The process instance will go into an error state.
Resolution
This Hotfix is contained within the latest Update. Install the update package to resolve the issue.
Note that for running instances to work after the update, a GoTo Activity function needs to be performed to the activity containing the SmartObject reference. The process instance will then be able to continue.
New Instances will function as expected.
Important Note
When configuring an IsNotNull or IsNull filter on an Advanced SmartObject when executing the GetUser method, some of the properties will not return the correct data as per the filter configured. This is by design and dependant on the way Active Directory returns the data. See the table below for results.