Best Practices regarding storage of data and using data fields


Badge +6

We were wondering what the best practice is concerning workflow data and the use of the data fields in the many wizards provided. Here is my example;


We have our users data (fax, phone, address, name) in a SQL database. We use an ID field as our primary key. A requirement of the workflow process is to list our users information in an email, which we use the email event. When building an email through the wizard, we use data fields to populate the users information. What this does is duplicate the data (one in our source and another in our workflow DB) -


Is there a way to use the wizards (in this case the email event) fields and pull from our source database only (using the ID at the key) so we dont house the same data (users information) in two different locations?


thanks


4 replies

Badge +4

Hello,


In your example, I would do the following:


- Use the SQL Server Service (out of the box now) to setup a service object for your SQL DB.


- Create a SmartObject against your table/view/sprocs for use in your process


- Within the process, add a reference to the SmO you just created, passing in your key datafield


Now, within your e-mail event, you can use all of the fields from your database via the reference you just created. No more need to duplicate any data.


HTH,


Tyler

Badge +6

thanks Tyler, I'm going to try that approach. Since we are new at this, can you point me in the direction of a solid tutorial on creating a service object? When you mention SQL Service service to create a service object  - is that a K2 function - or a SQL server function?


thx again

Badge +4

Hello again,


All of the SmO/Service Objects are K2 functions, not SQL. The SQL Server Service Broker (a K2 device) is designed to allow access to all of your existing SQL work without doing anything from the SQL side (other than potentially security changes so the K2 service account can access those artifacts if you choose to setup your service object as "ServiceAccount" security). Here's the service i'm referring to, from the docs:


http://help.k2.com/helppages/k2blackpearlUserGuide4.6.1/WS_SQL_01.html


Here's how to create a new service object:


http://help.k2.com/helppages/k2blackpearlUserGuide4.6.1/How_to_configure_the_Service_Instance.html


Here's how to create a new smartobject against your new service object (this example uses a SQL View, but the exact same steps apply to a table or stored procedure):


http://help.k2.com/helppages/k2blackpearlUserGuide4.6.1/SQL106.html


From here, you can use the SmO in your process as I mentioned previously.


I hope that helps!


Tyler

Badge +6

thanks Tyler.


That info is a tremendous help.

Reply