Server Item Not Found using Custom Endpoint Assembly DLL in workflow Smart Object Method

  • 8 August 2018
  • 3 replies
  • 25 views

(Apologies have posted this again not sure how it was removed, unless it was removed by a moderator? If so not sure why?)

 

Good Afternoon,

I am having issues in my Workflow with a Smart Object Method using a custom Endpoint Assembly DLL and the "Wait for external system" option.
 

I am passing in the step serial number of the Smart Object Method to restart the step once the code completes using


ServerItem svrItem = k2Connection.OpenServerItem(stepSerial);

 

but when the code executes it throws "ClientException: 25225 Server Item Not Found with Serial 127_40" as one example. I have looked around in the database to try and find the item and came across the Server.ProcInstItemState table and I can see the Process instance of 127 but not an ID of 40.

I have tried removing the Smart Object Method and re adding it in. I also move the step to the beggining of my workflow to see if that made a difference however I still get the same result.


Is there something I am missing to enable the step serial number to be saved properly perhaps?


I used the following to guide me using the Client API section however there is no mention of troubleshotting the error I am receiving. Wait for external system

Thanks
Nathan


3 replies

HI Nathan,

 

Can you maybe clarify what you're trying to do in the end?

It looks like the piece of code you pasted, is used in the endpoint service broker assembly, right? If so, then that's not really how it would work.

 

The idea of the "Wait for external system" checkbox is that the specific SmartObject step that you're performing will not continue onwards after it has been completed. An external system would then (using those few lines of code) connect to K2 and tell it to continue.


The concept here is that you'd use a smartobject and tell an external system which SerialNumber it should use to tell teh workflow to continue.

 

If you do all of this in the same step, than this won't work, as at the time of execution (of the SMO) the workflow has not started 'waiting' for an external event.

 

HI Cyclops,

Thank you for the reply. I have posted some screenshots to try and help explain the situation and will provide some more info but it seems like the problem may lay in trying to start the step again using the actual step itself?

 

As below once everything merges back in I then use the Smart Object to make a call to custom .net code method to formulate an HTML string based on various values throughout the workflow. (I am not sure if there is a better way of doing this part but couldn't seem to find a way of dynamically creating an email body depending on values). It is in this same call that I am trying to kick the step back off again after setting a string datafield with the HTML value formulated. 

 

The Call Custom Method below has one of the input values as the step serial number, but this is the one that is not being found when I try and start the step in the .net code. I have included a screenshot below with the last part of the method that tries to start the step again.

So it seems like I may not be using this the way it is intended?

 

 

Thanks
Nathan

Hi Again,

Doing some testing I changed the method to actually return a string and map to an input field rather setting the datafield in code. I removed the wait for external event step but when the email was sent the string was empty. So I added a timer event after the SOM for 5 seconds to ensure the code had time to complete and return the string and then I received the email with the expected data (Screenshots below)

 

While this solves my problem I would be keen to know how I could have got this to work with my original method using the wait for external event.

Thanks
Nathan

Reply