Default Client Event

  • 30 October 2007
  • 9 replies
  • 0 views

Badge +5

Hello,


In K2 2003 I had a custom code module that did some Active Directory lookups.


Based on the location of a user, the URL for the tasklist was altered.


How do you this in BlackPearl ? If I click on "View Code - Event Item", a WWF layout is loaded. If I switch to code view, no reference to my URL for tasklist (as set in the wizard) is found ...


Any suggestions ?


Thanks,


Nicolas


9 replies

Badge +9

If you click through the XOML you should be able to locate this within the "SendWorkToInternet" method.  I see the below method for one of my default client events:


        private void SendWorkToInternet(object sender, EventArgs e)
        {
            string strURL = K2.Configuration.InternetUrl;
            strURL = strURL.Replace("{SERIALNO}", K2.SerialNumber);
            K2.AddWorklist(K2.Configuration.InternetPlatform, System.Web.HttpUtility.UrlPathEncode(strURL));                    
        }
 


You should be able to put your URL generation logic here by overriding the value placed in strURL..

Badge +5

OK, thanks for the answer.


And what if I want to use my own custom c# component ? I think this can not be referenced in a blackpearl project, or should this c# component be exposed with smartobjects ? (not really read the details about that)


 

Badge +5

I managed to add a reference to a custom c# component.


However, when trying to run the workflow, an error occurs:


Could not load file or assembly 'My Assembly', Version=1.0.1.5, Culture=neutral, PublicKeyToken=63e1f8899bc791ca' or one of its dependencies. The system cannot find the file specified

Badge +11

We are aware of the problem in this regard - will be addressed shortly.  For now, I think if you copy the assembly to the '...HostServerBin' directory on the HostServer machine, your workflow should run just fine.


Edit: If the assembly is in the GAC on your development machine, you'll also need to add it to the GAC of the HostServer machine.


HTH,


Ockert

Badge +5

Hi NS,


This is a known isuue and have been logged to be fixed. An easy workaround is to add the 3rd party assembly to the K2Server's GAC or to create a deployment package on the client machine and move the package to the K2Server, deploying it there.


 Regards


Gert

Badge +5

Hello,


I copied my dll to the hostserverin folder. I get the error: Object Reference not set to an instance of an object.


This is probably because my .dll requires a config file. Where must I put that config file, and what name should it have? (app.config ? myassembly.config ?)


Thanks,


Nicolas

Badge +3

Gert,


Can you explain "K2Server's GAC"? Do you mean the bin folder of the workprocess.


So the issue is fixed and pending hot fix release?


On a related topic. My workflow has 3 projects with guids. where do those assemplies end up. I'm trying to attach a debugger and the symbols never get loaded, and I assume that's because the .pdb file isn't in the correct place.

Badge +9

NS,


I would try using the blackpearl host server config:


     C:program Filesk2 blackpearlhost ServerinK2BlackPearlServerK2BlackPearlServer.exe.config


It is possible that it doesn't exist, so you may need to create it and restart the K2 service.

Badge +5

Thanks Bob, modifying K2BlackPearlServerK2BlackPearlServer.config did the trick.


Another handy tip from one of my colleagues.


You can put the .dll on a custom folder on your server. eg (c:mylibrariesk2)


Then add to your config file:


<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="c:librariesk2" />
    </assemblyBinding>
  </runtime>


And the appropriate .dll will work in your project.


Regards,


Nicolas

Reply