Monday, March 21, 2011

Changing the Userid when triggering the subscription peoplecode.

You can use the following IntBroker Class method : SwitchAsyncEventUserContext to change the context of the peoplecode run inside subscription peoplecode. This is to be used by IB only (there are checks to make sure that is the case) and can only be used for IB events that are fired asynchronously (OnRoute, OnSend, OnNotification, etc..). One use case is if you are submitting a process request from a self service user id and you do not want to give access to query security to each user who is triggering the message. This method is added in PT 8.50 and not available for lower tools release.

For more info use : E-IB: User Security required on target db for async messages in 8.48.0x [ID 654592.1]

PeopleBook definition of this method is as follows.

SwitchAsyncEventUserContext


Syntax
SwitchAsyncEventUserContext(UserID, LanguageCode)
Description
Use the SwitchAsyncEventUserContext method to switch the user context within an Integration Broker asynchronous event.
Parameters
UserID
Specify the user ID, as a string, to which you want to switch the context.
LanguageCode
Specify the language code, as a string, for the user ID.
Returns
A Boolean value: true if the switch user was successful, false otherwise.
Example
&returnValue = %IntBroker.SwitchAsyncEventUserContext("VP1", "ENG");