Execute SQL query directly inside of workflow


Badge +1

I am looking to update a single field of a SmartObject (table)

 

There is this concept of a Deal. When work begins on this Deal it needs to have the Status on it flipped to 'In Progress'. How do I update the database directly to switch the status flag?

 

It would be awesome if I knew how to execute the following super simple statement:

   UPDATE dbo.Deal SET Status = 'In Progress' WHERE id = @ID

 

 

Note that I am using a separate database table that belongs to a custom application.

 

 


5 replies

Badge +8
Use the stock SQL service instance to create a SmartObject to accomplish this.

http://help.k2.com/helppages/k2blackpearluserguide4.6.7/webframe.html#sic02.html
Badge +1

Care to ellaborate?  I've created a SmartObject and still can't figure it out.

 

 

Badge +8

Once you have created the SmartObject, use a SmartObject Event in your process to call the Update method (or whatever it is called in your SO).  Assign your properties as needed and off you go.

Badge +1

I've made it that far, however how do I pass in the new values?  When I try to execute the method via The Services Tester Utility I get a the following exception:

                                              Nullable object must have a value

 

It then lists the Service, Service Guid, and Severity.

  

 

When running SQL Profiler I don't even see a SQL command go against the database so I can't see what it's trying to execute.

 

I want to just execute the following simple command:  UPDATE deal SET StatusID = @statusID  WHERE id = @ID.  

I do NOT want to update the entire row

 

 

Badge +1

It turns out that K2 fails to support the following 2 data types that are in the table. We have a DateTime2 & Timestamp. 

 

According to support DateTime2 will be supported in a coming release.

 

Once I removed these columns from the table it worked.

Reply