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

Question

Question

Customed tokens created within workflow script using vb.net

asked on January 2, 2014

I have an integer variable, NumRecords. I want to create a global token in script using SetTokenValue() method.

How can I do so?

When I'm using SetValueToken("NumVouchRecUpd",NumRecords.ToString), it is throwing error

 

" Object reference not set to an instance of an object."
0 0

Answer

APPROVED ANSWER SELECTED ANSWER
replied on January 2, 2014 Show version history

Ritu,

 

Without seeing your entire script it is a little difficult to diagnose.  A couple of thoughts; first, your variable 'NumRecords' is an integer but the value you are passing to the global token 'NumVouchRecUpd' is a string.  Secondly, are you sure you are properly instantiating the 'NumRecords' variable as an integer and assigning a good value to it? 

 

Here is a quick code snippet that works on my system (Workflow 9.02);

 

       Protected Overrides Sub Execute()
            Dim numRecords As Integer

            numRecords = 256

            SetTokenValue("NumVouchRecUpd", numRecords)

        End Sub

Notice that the value I am assigning to the 'NumVouchRecUpd' token is the integer value not a string. 

 

When I use the code above in a script activity I have a token available from the 'SDK Script' activity named 'NumVouchRecUpd' which can be referenced by other activities.

 

Let me know if that helps.

3 0

Replies

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

Sign in to reply to this post.