Access to ProcessContext instance from server code.
Can anyone please tell me how I can reference the ProcessContext instance from within server script code? The instance can be accessed from the expression builder, as shown here:
But when I try to use it in a script, it's actually referring to the ProcessContext class because it's only showing its static members:
Comments
-
You need to pass an instance of ProcessContext class to your server script method:
public class ServerScript1 { [Promote(PromotionTargets.VisualToolbox)] [Category("UserCategory")] public static string SampleProcessContext(ProcessContext context) { return context.FolderSubject; } }
In the Designer environment, the instance is called ProcessContext (same as class), so you will pass it this way:
string s1 = ServerScript1.SampleProcessContext(ProcessContext);
0 -
Except, I'm calling my server script from a visual script activity in a start action event handler. I Still don't have access to the ProcessContext instance like I do in the expression builder. Is there some way to get to the ProcessContext instance through the object model?
0 -
You can just create a new instance of it:
var pc = new ProcessContext(); var folderId = pc.FolderId;
iain
0 -
Hmmm. Odd. I would have thought something like that would be a singleton. Logically, there is only one "process context", right?
0 -
It couldn't be a singleton because there needs to be an instance per folder.
Not really sure how the engine manages this though I'm afraid.
Iain
0 -
Roryap wrote:
Hmmm. Odd. I would have thought something like that would be a singleton. Logically, there is only one "process context", right?It actually is a singleto9n for each session. Change one instance of it, and you'll find the change reflected in all instances.
It's just a slightly odd way to access it (IMO).You can do the same with a Process Business Object as well, since you can only have one process per session (or none, but that is a special case, with slightly different behaviour).
I am sure it's not documented, however, but that puts it in fairly good company.
0
Categories
- All Categories
- 108 Developer Announcements
- 53 Articles
- 106 General Questions
- 144 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 899 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 120 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management