Passing parameter values with newlines to a VBScript function (Metastorm v7.6)
Using Metastorm BPM 7.6.
I have written a VBScript function that saves a comment in a table in another system's database. This comment includes the value of the %Action.Notes variable, which was populated from user input during the action the VBScript function is called from. The value can be multiple lines, i.e., the user can enter newlines (CR+LF) in the note.
When I have tried to call the function like so:
%Script(VBScript,,%Procedure.Name,%MapName,"InsertComment %"%ItemNumber%", %"%MapName%", %"%StageName%", %"%Action.Name%", %"%User.Name%", %"%Action.Notes%"")
the call fails and following message appears in the eLog table:
Unable to execute specified script. Reason 'Error(-2146827255) : Unterminated string constant, at line x, character x. Source: InsertComment "1001", "MapName", "StageName", "Add Comment", "abc", "a.' Procedure Script call failed. Position: x
where the newline appears right after the "a" in the 6th parameter. The rest of the call is cut off.
What is the way the pass parameter values with newlines to a VBScript function? Or is this not even possible?
Thanks.
Comments
-
I'm somewhat out of practice when it comes to VBScript, but... the problem appears to be that VBScript isn't all that happy with the %Action.Notes having CRLF escape characters embedded as literal text in one of the arguments. It would be rather happier with something like:
InsertComment “1001”, “MapName“, “StageName“, “Add Comment”, “abc“, “Line1" + Chr(13) + Chr(10) + "Line2"
or some such. Which is rather a pain.
My suggestion would be to work around this problem by not trying to pass in the %Action.Notes as an argument to InsertComment. Rather, try accessing %Action.Notes from within the VBScript routine itself.
For example, write a new procedure like this:
Sub InsertCommentWithActionDotNotes (ItemNumber, MapName, StageName, ActionName, UserName) InsertComment ItemNumber, MapName, StageName, ActionName, UserName, ework.Action.Notes End Sub
Or some variation along those lines.
Hope this helps.Ed Barrett
0
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 151 General Questions
- 148 Thrust Services
- 57 OpenText Hackathon
- 37 Developer Tools
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 32 eDOCS
- 186 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 8 XM Fax
- Follow Categories