Interesting one I picked up the other day. I was putting a URL in an email notification for a user (destination) to complete a worklist item. The user kept on reporting that under some conditions, he would hit the link, but the page would not open correctly because the serial number that was past of the URL query string, got cut off at a comma.
K2.net builds serial numbers for client events in order to correctly identify a specific client event for a given activity instance:
How does k2 generate the serial number?
http://forum.k2workflow.com/viewtopic.php?t=2&sid=6b1b93ac90bad66f0c700a8bef7d910e
The Serial Number is unique for each event instance within the process instance. This means that if you have an activity that contains 2 events (for example a server and client event), then during the execution of the process, each of these will have their own unique serial number. The serial number is basically the most granular unique identifier within the process. It identifies a single step, within a specific activity instance, within a specific process instance, and if it is a client event, the serial number also uniquely identifies which user it is allocated to. Therefore, if an activity is set to have 3 users in it's destination rule, then for the client event, there will be 3 different serial numbers for each user that the client event is sent to.
The format of the serial number is something like SERVER,xx,yy. When I included the URL of the client page in the email notification to the destination, his email client would sometimes (if the line needs to be line wrapped) cut the URL into two lines in the email. It would do this at one of the commas.
To avoid this, I had to UrlEncode the serial number part in the URL. This will avoid that the URL gets cut in two pieces (even if the line gets line wrapped) when included in an text email.
The code looks like this:
sn = System.Web.HttpUtility.UrlEncode(K2.SerialNumber);
URL before using HttpUtility.UrlEncode:
http://server/sites/page.aspx?sn=SRV,12,13
URL after using HttpUtility.UrlEncode:
http://server/sites/page.aspx?sn=SRV%2c12%2c13
No comments:
Post a Comment