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

Question

Question

SetToken not working after migration from WF 8 to WF 9 - arguments were parameters, now literals needed?

asked on December 17, 2013

SetToken(TheTokenName, theVarVal) used to work in V8 scripts but not in V9. Does the token name now have to be hard-coded rather than a variable?

 

Also SetToken shows up as a legacy script on the mouse-over info. Is there a new function I should be using?

 

Thanks,

John Pulman

0 0

Answer

SELECTED ANSWER
replied on December 17, 2013

By used to work, do you mean at run time or at design time?

 

I think WF8 would remember what tokens were created when you test the workflow, but we found that method to create an unreliable user experience since the tokens would sometimes show up and sometimes not when working with later activities. In WF9, in the script editor, there is the Script Tokens window where you can tell workflow what tokens to advertise in the designer. If you are setting it by variable, WF 9 might not detect what tokens to advertise to other activities. If you are setting it explicitly, you can use the 'Auto detect' button in the windows toolbar to detect the tokens for you.

 

As far as script methods go, we expanded the functionality in 8.3 to include more methods for scripts and 'SetToken' was only retained for backwards compatibility reasons. 

 

SetToken is effectively the same as calling WorkflowApi.SetActivityTokenValue. 

 

Definitions

 

SetActivityTokenValue - This script API method will set an 'activity' token. What this means is that the token will have the activity's safe name prepended to it. 

 

Example: My activity is 'SDK Script' and I call SetActivityTokenValue("Test", "123"). The token 'SDKScript_Test' will be created.

 

SetTokenValue - This script API method will set a 'global' token. What this means is that the name you set for the token will be the name of the token without the activity name. 

-----------------------------------

 

While I'm talking about scripting.... One of the things you may notice is that your script inherits from 'LegacyScript'. Each version of workflow tends to update the base class of the script so that we can be backwards compatible and also support new features. 

 

WF 8.3 has ScriptClass83 and SDKScriptClass83

 

WF 9.0 has ScriptClass90 and SDKScriptClass90

 

WF 9.1 has ScriptClass90 and RAScriptClass91

 

 

 

 

 

 

Finally, you may want to see if this KB applies to you as well: https://support.laserfiche.com/KB/1013367 

0 0

Replies

replied on December 17, 2013

Thanks Ed. It did work before at both runtime and design time. I think I'll just go through my WFs and hard code the parameters - was trying to generalise a bit, but at least this way I can use the new features.

 

Thanks also for the info on legacy scripts / the replacements, and also for the KB article - I was getting that warning, so I'll see if those dlls can be put in the LF folder on our next build (we have virtual desktops so installation changes can't be done on individual computers).

 

Regards,

John

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

Sign in to reply to this post.