Thursday, December 27, 2012

#207 BPM Process Accelerators update...

Now is the quiet time between Christmas and New Year - just the right time to check out http://www.oracle.com/technetwork/middleware/bpm/overview/processaccelerators-1609559.html

Happy New Year to everyone out there!

Tuesday, November 6, 2012

#206 Installing Oracle Enterprise Repository 11.1.1.6

For SOA governance -
be it governance with a large G or a small g,-

OER is the optimal solution.
Installation is quick and easy - see my MyInstallDoc

Software available Here

Friday, November 2, 2012

#205 Fusion CRM - Accessing child objects via Groovy

Thanks to my colleague MireilleD. for this.

Scenario: An Opportunity can have many contacts.




I need to pass on the email address of the primary contact to a 3rd party system. I have defined a link on the page with the following Groovy script to retrieve the email of the primary contact.

Here it is -

// get primary contact Email
def primaryEmail=""
def contacts=OpportunityContact
if (contacts != null){
contacts.reset()
while (contacts.hasNext()) {
  def curRecord = contacts.next()
   if (curRecord.PartyId == PrimaryContactPartyId){
     primaryEmail=curRecord.EmailAddress
   }
}


Thursday, October 25, 2012

#204 Calling a REST service from Fusion CRM

Building on the REST enabled Facebook service from the previous posts...

Now I want to call this from FCRM.
I apologise for the scenario, it may seem somewhat unrealistic, however it does illustrate the concepts.

In this scenario, I want to post comments regarding an opportunity to my Facebook page.
Please expand the picture to see the fields on the right.


I click on the link to call the REST service.

The link is defined as follows -


I constuct the url and include the Comments.

def myUrl = "http://myWLSHost/FacebookClient-RESTfulService-context-root/jersey/post2FB/postMsg2Page?msg=" + Comments
return (myUrl)

I then include the link in the Opportunities page.

The result -



Wednesday, October 24, 2012

#203 REST enabled my Facebook service running on WLS.

I am referring to the web service I created 2 posts back.
Now I would like the same functionality, albeit via REST.


So I created a new project in JDeveloper.

The implementation is as follows -




I deployed to the embedded WLS by simply running the above -





Test it out -






Tuesday, October 23, 2012

#201 Calling Facebook (restFB) from Weblogic

Scenario: I have a web service running on WLS that posts messages to a Facebook page.  
Part 1 - The Facebook Client

I use restFB here --> restFB  

The client code -

package fb;
import com.restfb.Connection;
import com.restfb.DefaultFacebookClient;
import com.restfb.FacebookClient;
import com.restfb.Parameter;
import com.restfb.types.Account;
import com.restfb.types.FacebookType;
import com.restfb.types.Page;
import com.restfb.types.Post;
import com.restfb.types.User;
import com.sun.org.apache.bcel.internal.generic.Select;
import java.util.Arrays;
import java.util.List;

public class PostMsg2Page {
public PostMsg2Page() {
super();
}

 public String post(String msg) {
try{
String MY_ACCESS_TOKEN = "GetYourAccessToken as described in the restFB docs"; System.out.println("PostMsg2Page()");
FacebookClient facebookClient = new DefaultFacebookClient(MY_ACCESS_TOKEN);
System.out.println("PostMsg2Page() FB client got!");
User user = facebookClient.fetchObject("me", User.class);
System.out.println("User name: " + user.getName());

 // Add posts to a Page
DefaultFacebookClient fbClient;
Connection myAccounts; fbClient = new DefaultFacebookClient(MY_ACCESS_TOKEN);
myAccounts = fbClient.fetchConnection("me/accounts", Account.class);
System.out.println("MyAccounts size = " +myAccounts.getData().size());

Account myAccount = new Account();
   for (int i =0; i < myAccounts.getData().size(); i++){
       myAccount = (Account)myAccounts.getData().get(i);
       String accountName = myAccount.getName();
       System.out.println("Account name = " + accountName);

if (accountName.equalsIgnoreCase("NiallsTestPage")){
// get the page access token
String pageAccessToken = myAccount.getAccessToken();
fbClient = new DefaultFacebookClient(pageAccessToken);
System.out.println("About to post...");
fbClient.publish("me/feed", FacebookType.class, Parameter.with("message", msg));
}
 }
 }
 catch (Exception e){
    e.printStackTrace();
}
return "success";
}
}

Here I essentially connect to my Facebook account.
I then browse thru my pages (accounts) until I find the one I want to post to.
This is, in my case, NiallsTestPage. I then do the necessary...


 Regarding the OAuth token -
Login to https://developers.facebook.com/tools/explorer to get your own.
I test and see that all is working.
I then jar up this project and add it to my web service project.  

The Java web service is as follows -

WebService(endpointInterface = "fbws.ClientPortType")
@WLHttpTransport(serviceUri = "/ClientPort", portName = "ClientPort")
public class Client {
 public Client() {
 super();
}
 public String post2FB(String msg) {
     PostMsg2Page pm = new PostMsg2Page();
     pm.post(msg);
     return "success";
}
 }
 I deploy to WLS.

I now login to https://developers.facebook.com/tools/explorer again,
this time just to save the Facebook cert locally. I then add this cert to my cacerts store

Note the location -
I re-start WLS and then test the web service -
I check the Facebook page -

Monday, October 15, 2012

#200 Fusion Apps: Getting user data via Groovy

Scenario: Accessing user data such as email via a Groovy script - Thanks to my colleague ChrisV for this - Here is the Groovy function to get the user data
Here I call it from an action (button)
Here I test
Now I go to em to check the logs -
Right click on Fram_CRMDomain --> logs then search for Notifications.

Tuesday, September 11, 2012

Sunday, August 26, 2012

#197 Oracle Fusion CRM - Web Services part 1

Here is a short intro to FCRM web services, one of the main integrations points for Fusion Apps.
A previous post covered the Fusion Apps Repository which details which services are available.
Please see http://niallcblogs.blogspot.de/2012/07/fusion-apps-enterprise-repository.html

Let's take it from there...
The post covers basic get and create functionality and also details how to leverage FSM to find lookup values for web services call. A big thank you to my colleagues AngeloS and ChrisV for the latter! 

In the following scenarios I am using the CustomerInteraction Service.


Notice the Keyword External - If you are doing 3rd party integrations with Fusion Apps, make sure you leverage services with the Keyword: External. A good explanation for this keyword etc. can be found at http://rraheja.wordpress.com/2012/08/13/five-qs-fa-ext-webservices/

Import the WSDL into your tool of choice - this could be, for example, Oracle JDeveloper - HTTP Analyzer or some other tool such as SOAP UI.


Here you see 2 sections - callbacks and requests.

We will concentrate on the request operations.




The 2 GET operations are get and find

findInteraction - will return all interactions, if no search criteria is specified.
getInteraction - will return 1 particular CustomerInteraction object. The key – InteractionId, is the required input.


This is the general modus operandi for all Fusion Apps web services.
Here is a sample test of findInteraction with no search parameters specified.



















Request -


















Response -


































Ok, so let's do a find - using one of the InteractionIds returned.




Request payload -









Very intuitive!
Deja vu for those used to working with ADF BC Service Interfaces!

How about the createInteraction operation?

Let's begin by looking at the customer in the FCRM app.



Here are the current interactions -












I get the following dialogue when I click the create button on the UI -
















So the web service call will have to include essentially the same information.

But let's take Type - how do I know which types are available?
We could extrapolate from the create UI above, however you should do the following -

Go to FSM (Functional Setup Manager)


























Click on Go to Task
(please expand image, if you do not see it!)











Click on ZMM_INTERACTION_TYPE
















So Meaning is what we see in the UI.
Lookup Code is what we must enter in the web service call.

createInteraction request payload

















More later...


Tuesday, August 21, 2012

#196 Oracle Fusion CRM Application Composer - Creating Links

I've started doing some extensibility work with Fusion CRM Application Composer.
Great tool - wizard/meta-data driven.

To quote the official guide -

The Oracle Fusion CRM Application Composer is a browser-based configuration
tool that enables business analysts and administrators, not just application
developers, to customize and extend an Oracle Fusion CRM application. Make
the type of data model changes which, for non-CRM applications, can only be
made by application developers. For example, easily create a new object and
related fields, then create new Enterprise pages where that object and its fields
are exposed to users. The Application Composer is a design time at runtime tool,
which means that you can navigate to the Application Composer directly from
a CRM application, make your changes, and see most changes take immediate
effect in real time, without having to sign back in to the application.


So what does it look like?


Now in this simple scenario, I want to add a link to Google on the Customer/Sales Account Details page. Customer is naturally an important business object within Fusion CRM. There are a standard set of UI Pages that can be used to interface with it.


 So here we see links to configure Overview/Creation/Details pages. Very intuitive!

There is also a menu option - Action and Links. Here I create my link.



  The Groovy expression used is very simple -

PartyUniqueName is a field on the Details page that I want to pass to Google.

Now that my link is created, I just need to add it to the Details page







Then call up the Customers app to test



Select a Customer and open the details page


Click on the Google link - Google the Customer






Tuesday, August 14, 2012

BPM 11g - aggregating orders example

Scenario: Customer places an order, it is processed within 2 hours.
If in the meantime the customer orders more goods these will be added to the original order.

So I considered the following approach -

2 processes - OrderEntry and OrderShipping.

In this post I look at the OrderEntry process

I decided to use a simple DB table TEMP_ORDERS to flag orders in process. So the first step in my OrderEntry process is to check if there is already an open order for this customer.

I use the DB adapter (OrderListSelect) here.


Now the first challenge is how to process the output from the DB adapter.
The first time we call this for, let us say, Order123, the order does not exist.

So the DataOutput mapping I chose was -


I created a process Data Object v_orderExists (type boolean)

The From above:
boolean(bpmn:getDataOutput('tempShippingCollection')/ns:TempShipping[1]/ns:customer)

v_orderExists is then used in the Exclusive Gateway condition.

More soon...