Open a top level cases from an enterprise application
we expose an enterprise WebService that allows external systems, given an input case type, to create a Pega case. Each case type refers to a case which belongs to a different top application in our layer cake.
Example: we could have an input “Case Type A” which instantiates a case which belongs to "Application A" top application and an input “Case Type B” which instead belongs to "Application B" top application. Since the service package rule is defined at enterprise level (using the enterprise access group) when we try to create a case using "pxCreateTopCase" we do not have visibility on the top application which the case refers to.
Our first approach, in order to have the correct top application context, was to dynamically switch access group from the webservice activity using the function "SetActiveAccessGroup" but it did not work. The workaround we have finally found but we do not particularly love is to create a wrapper webservice which, according to the input case type, calls other Pega application specific webservices linked to a service package that refers to the specific top application access group.
Do you have a better approach?
***Edited by Moderator: Pallavi to update platform capability tags***
You definitely need to be in the proper application context. I think there are a number of ways to do that. While nothing is springing to mind as an easy way to do this without any effort, you have options beyond what you've come up with. You could queue the work to an agent and leverage the code that allows an agent to switch applications (look at how the SLA does this, it's been a while, but I believe there is a property on the queue item that defines the context).