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

Question

Question

How do i reference tokens in a workflow SDK Script?

asked on October 21, 2014

I have created a workflow that in one step retrieves values from Laserfiche forms contained in a folder. Then in another step, it runs a script to append the values to a .csv file on the server.

The problem I'm having is that i cannot reference any of the tokens in the "retrieve field values" workflow step in my script. When i click on a token in the Token browser, it wraps the name of the token in quote marks" ". This does not work because all i get is the name of the token and not the value, in the .csv file.

So i tried referencing the token by using %(ActivityName_TokenName) or %(TokenName). However, i get an error in my script stating that % is not a valid character.

I'm at a loss of what to do next. Any help would be appreciated. Thanks.

Script.txt (1.74 KB)
0 0

Answers

APPROVED ANSWER
replied on October 21, 2014 Show version history

Hi Evan,

When referencing tokens inside of a script, you will need to resolve the token's value using "TokenReplace". You can do this in your script as follows:

dataRow = TokenReplace("%(RetrieveFieldValuesfromExpenseClaimForms_Vendor ID)")

 

Give that a try for all your tokens and see if it works for you.

 

Cheers

Sheldon

1 0
replied on October 22, 2014

Hi Sheldon,

 

Thanks for the response. Unfortunately, i am getting the same error when i use the code you gave me. The drop down for commands, only has Token_Format and Token_Source.

0 0
replied on October 22, 2014

What version of Workflow are you running?

0 0
replied on October 22, 2014

If I'm reading this right:

The Workflow Server is 8.3.0.0

Workflow Designer is 9.0.2.240
 

0 0
replied on October 22, 2014

That's not going to work for creating workflows. Your Designer needs to be on the same version as the server. You can use a newer Designer to look at workflows, but not for designing them.

0 0
replied on October 22, 2014

Can you tell me where to look to get the versions I'm running? Im just clicking on Help > About Workflow Designer.

0 0
replied on October 22, 2014 Show version history

You can see the version of the server in the Workflow Admin Console under Advanced Diagnostics\Workflow Assemblies. You will need to turn on the File Version column.

The other way would be to restart the Designer. If it pops up a message about mismatched versions, it will tell you which version the server is running. If not, then the WF Server is the same version as the Designer.

Now that you mention you only looked in the About dialog in the Designer, it sounds like you're more likely to be running 9.0.2 for the server as well but are running into the issue described in this Knowledge Base article.

0 0
replied on December 1, 2016 Show version history

If I knew the type (such as string), couldn't I just do a cast like this (C#)? --

string tokenValue = GetTokenValue("TokenName").ToString();

 

0 0
replied on December 1, 2016

You can. TokenReplace gives you a string, GetTokenValue gives you an object.

0 0
SELECTED ANSWER
replied on October 22, 2014

Oh, sorry, missed that part. It needs to be in double-quotes.

dataRow = TokenReplace("%(RetrieveFieldValuesfromExpenseClaimForms_Vendor ID)")

 

0 0

Replies

replied on October 22, 2014

Thank you very much.

The Knowledge Base article got rid of the warning in my script, and i also now have a TokenReplace function. However, i am still getting an invalid character when i use the following line:

dataRow = TokenReplace(%(RetrieveFieldValuesfromExpenseClaimForms_Vendor ID))

Any ideas?

 

Thanks again for all your help.

0 0
SELECTED ANSWER
replied on October 22, 2014

Oh, sorry, missed that part. It needs to be in double-quotes.

dataRow = TokenReplace("%(RetrieveFieldValuesfromExpenseClaimForms_Vendor ID)")

 

0 0
replied on October 22, 2014

Thanks, that worked. Thanks for all your help.

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

Sign in to reply to this post.