You are viewing limited content. For full access, please sign in.

Question

Question

Custom Query - Not providing output token

asked on March 30, 2017

I'm currently working on a workflow to get file attachments to be inserted into an invoked form and I'm following the example set by the following topic: https://answers.laserfiche.com/questions/100588/How-to-insert-repository-documents-into-Form-upload-fields-solution-inside 

But I've encountered a problem.

Even though the SQL Statement in (#1) is set correctly as per the example:

But I cannot for the life of me get 'inserted_identity' out as a token to use on the next step (#2). The token just doesn't exist for #1 (per below)

I've run the workflow and it fails on the #2 step (as this step needs the Foreign Key that is being retrieved as the inserted_id) but the data that is inserted in the byte array into forms database is correct.

Am I doing something wrong?

 

UPDATE: I do try to manually run the query with assumed correct data and I'm getting the below error but if I run it by running the workflow, it works fine (from what I can see)

 

0 0

Replies

replied on March 30, 2017

I've done a little more work on this, and here's something to make it more interesting....

 

If I put a "for each row" under the (#1) and have the (#2) use a token from the 'for each row', the token I need exists!!!

 

I have Quadruple Billion checked to make sure the custom query is returning first row only...

 

Is this maybe a bug?

0 0
replied on March 31, 2017

I can't reproduce this issue in 10.2 (there was a bug fixed for 9.0, but you seem to be running a higher version than that). The token appears for me in all subsequent activities.

A couple of things to note:

  • The token list is filtered to the data type of the field you're using it in, so it might be worth opening the Token Dialog from the menu and looking at the full list
  • Insert Data has an option to provide the identity value as of WF 10, so you don't need a custom query to get it anymore.

 

0 0
replied on April 2, 2017 Show version history

Hi Miruna,

Thank you very much for your reply.

I've tried it on two separate systems. One being 10.1 and the other being 10.2 and the result was the same for both.

 

I've taken a look at the token dialog as well, and cannot locate the token at all. I'm thinking that it may have something to do with the "Rows to return" not working correctly as I can only see the token if I use a 'for each row' action under it.

As you can see, the SQL statement being used isn't to simple as it's using a CAST and a CONVERT function in it. How would I go about using this with an 'Insert Data' action?

 

The SQL Statement is: 

DECLARE @temp varbinary(max)
SET @temp = CONVERT(VARBINARY(MAX), CAST(? AS NVARCHAR(MAX)), 1)
INSERT INTO dbo.cf_bp_attachment_data (attachment, [length], [file_name])
OUTPUT INSERTED.attachment_id AS inserted_identity
VALUES (@temp, ?, ?)

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.