Question on Dynamically setting values in StringTable

Last post 04-03-2008, 10:35 AM by DavidL. 2 replies.
Sort Posts: Previous Next
  •  04-01-2008, 9:38 AM 22861

    Question on Dynamically setting values in StringTable

    I have inherited some workflows and I understand how they work but now the K2 side, so check it.... I have a String Table that has these value

    Execuitve = "Some Name";

    ExcutieveEmail = "SomeName@SomeDomain.com";

    Now with these values already set in the string table is it possible for me to change those values dynamically...in one of my desitination rules there is this code..

         K2.Destinations.Add(DestinationType.User, K2.ProcessInstance.DataFields["Executive"].Value.ToString());

    is there a way i can do something like this????

    K2.ProcessInstance.DataFields["Executive"].Value = "WhatEverValueIWant"

    K2.ProcessInstance.DataFields["ExecutiveEmail"].Value = "WhatEverEmailIWant";

    K2.Destinations.Add(DestinationType.User, K2.ProcessInstance.DataFields["Executive"].Value.ToString());  

    K2.Destinations.Add(DestinationType.User, K2.ProcessInstance.DataFields["ExecutiveEmail"].Value.ToString());  

     

     

     


    Give yourself a round of applause!
  •  04-03-2008, 9:49 AM 22945 in reply to 22861

    Re: Question on Dynamically setting values in StringTable

    Yes, your example seems do-able, but you should not get confused between string table and data fields. In your example you are accessing process data fields and not string table values. Data fields has many advantages, but the problem is that you want be able to change them as easy out of the box such as string table values.

    To do the same but with your string table vars: K2.StringTable["Executive"];

    Also remember that "Some name" probably has to be a valid AD user name.

    Cheers,

     


    Gerhard
    -----------------------------------------------------------------------------
  •  04-03-2008, 10:35 AM 22948 in reply to 22861

    Re: Question on Dynamically setting values in StringTable

    I think there may be some confusion over stringtable values versus data fields in your question.  But I think your question raises an interesting point:  If you can change stringtable values dynamically, do you really want to?  Stringtable values / enviroment library settings are intended to be used to store value that might change between environments (dev/test/prod) that otherwise might have to be hardcoded.  String table entries exist independently of any workflow or workflow instance.  There is only one instance of a string tablevalue for all workflows--when you change that value, all workflows will see that value.  This also means there would be concurrency issues updating stringtable values dynamically.  I would suggest using the string table as a substitue for global literal values, but not to store transactional data.
    The statements and opinions made in my postings are my own, and do not reflect the opinions of SourceCode Technology Holdings, Inc. or its subsidiaries. All information is provided as is with no warranties, express or implied, and grants no rights or licenses.
    Filed under: ,
View as RSS news feed in XML