Friday, February 19, 2016

Multi Org support for an Inbound Web Service

Let’s talk about a scenario today.

We have different end-users from India, USA etc logged into the web-portal for placing their orders and from the web portal they can register themselves. We have a “Create Account” Inbound Web Service which is used to create Accounts in Siebel. Whenever a new customer register himself, the web portal sends the information to AIA and then AIA invokes the Siebel’s “Create Account” WS.

The requirement is, if end-user belongs to India then the new Account created in Siebel, should be visible to Siebel users who belongs to “India” organization. If the end-user belongs to USA then the new Account created in Siebel, should be visible to Siebel users who belong to “USA” organization.

(Note: Web Portal is able to identify the Customer and able to send the Organization name to AIA and then AIA will send the Organization tag in inbound XML to Siebel)
<Organization>USA</Organization>
                                    OR
<Organization>India</Organization>

Solution:
Actually there are multiple ways to do it and with the help of Access Control mechanism which Siebel provides OOTB, this can be easily achievable.

Possible Solution 1:
Let’s take an example, there are two users. First one is assigned with the Position let’s say “Position India” and its corresponding Organization is set as “India”.
Second user is assigned with the Position let’s say “Position USA” and its corresponding Organization is set as “USA”.

Now, we all know that, as part of the OOTB solution, all the Account records created by first user on the UI will be visible in “All Contacts” view to all the application users who belong to “India”. Similarly, all the Account records created by second user will be visible in “All Contacts” view to all the application users who belong to “USA”.

The same concept can be used while invoking the Inbound WS. In Siebel, we can create two EAI user Profiles, one belongs to “India” and other one belongs to “USA” and pass-on the user credentials to the source system (AIA). While invoking the inbound WS, source system can use the appropriate login credentials according to the Organization name.

Possible Solution 2:
Siebel application user can hold multiple positions. If you are working in Siebel UI, you can navigate to Tools -> User Preferences -> Change Position view to change the position of the logged-in user. The moment you change the position, the new records that are created after that will hold the visibility according to the position’s organization.

Similarly, the same can be achieved while invoking the inbound WS. Assuming the EAI User profile, that is being used to invoke the inbound WS, will hold multiple positions let’s say 1) “Position India” and 2) “Position USA”.

Create a step in the workflow do the “Change Position”. I am not sure if there is any vanilla BS available to simulate the “Change Position” step that we can perform from UI, so here is the small script would do the task. Assuming “Organization” name is the input argument to the business service method:

function ChangePosition(Inputs, Outputs)
{
var sOrganization = Inputs.GetProperty("Organization");
 var oBO = TheApplication().GetBusObject("Change Position");
 var oBC = oBO.GetBusComp("Change Position");
 with(oBC)
 {
  ClearToQuery();
  ActivateField("Organization");
  SetViewMode(AllView);
  ExecuteQuery();
  var isRecord = FirstRecord();
  while(isRecord)
  {
   if(GetFieldValue("Organization") == sOrganization)
   {
    InvokeMethod("Change Position");
    break;
   }
   isRecord = NextRecord();
  }
 }
 oBC = null;
 oBO = null;
}

After this “Change Position” rest of the workflow execution would continue.



1 comment:

  1. One can also use TheApplication().SetPositionId https://docs.oracle.com/cd/E14004_01/books/OIRef/Interfaces_Reference9.html#wp1009825

    ReplyDelete