I am a new user of NW and I am enthusiastic about developing workflows, but I run into the need to perform more advanced calculations (even at the level of calling user defined functions) from those offered in the standard set of NW actions.
So far I found two methods to achieve this:
A) By using SQL
B) By using Web Services
Here is the description of the first method (using SQL):
1) Create in an MS SQL Server (or other RDBMS) a table with one field (arbitrary field name ) and one record (arbitrary field value). Let us name it xTable.
2) In your Workflow insert "Execute SQL" actions and use SQL commands like:
- select substring('{ItemProperty:Title}',1,3) from xTable (using standard RDBMS functions)
- select dbo.f('{ItemProperty:Title}') from xTable (using scalar user defined functions)
Here is the definition of the simplistic function f just for demonstration purposes:
CREATE FUNCTION f (@x varchar(50) = '')
RETURNS varchar(50) AS
BEGIN
declare @y varchar(50)
select @y = Upper(@x) + '>>'
return @y
END
So this method exploits the capabilities of the SQL language and the RDBMS system.
Now I will describe the (more) orthodox and flexible method (web services):
1) Create a asmx file using notepad or VS 2005 similar to the following:
<%@ WebService Language="VB" Class="TempConvert" %>
Imports System
Imports System.Web.Services
Public Class TempConvert :Inherits WebService
<WebMethod()> Public Function WSF_UCase (ByVal xVar As String) As String
return UCase(trim(xVar))
end function
... other user defined functions ....
end class
Name it xxx.asmx and copy it into : C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\CustomWebServices
where CustomWebServices is a new sub-folder which should be created by you.
2) In your Nintex workflow add a "Call Web Service" Action, put as Url the following : http://yoursite/_layouts/customwebservices/xxx.asmx and now you can calculate your workflow variables using the functions in your xxx.asmx file.
Now you have the (almost) unlimited capabilities and flexibility of web services !!!
I hope that this post will be of some help to some colleagues in the NW community.
Best Regards from Athens Greece,
Stratos Parellis