Friday, April 12, 2013

Oracle Fusion CRM - Import and Export Process


In Oracle Fusion CRM , two processes exist to enable the importing and exporting of object data: 
          1.File-based import 
          2.Bulk export. 

File-based import :
supports the import of data from an external text or xml file to interface tables and then from interface tables to target application tables. 

Bulk export :
Supports you extract large volumes of data from CRM objects, both as extracts of a full set of records for an object as well as incremental extracts. The system creates comma or tab-delimited files with the extracted data, which are available to users as attachments to the batch records that have been executed.

Note :The creation of import and export artifacts occurs only in the Oracle Metadata Services (MDS) mainline, and is not supported within the MDS sandbox.

How to import CSV file :
1.Prepare a delimated text(CSV) File . 

CSV file example :
ContactID,Contractor Name,Type
1010, CTS,Service

2. In the application Navigator ---> Setup and maintenance ---> All Tasks
3. Search for Manage File Import Activities task and click on "Go to Task" button. 
4. After that click on New icon to create new file mappings .
5.Give the Name , Select the object and browser the file from desktop and click next.

6. Map your source field  to the target filed and click next
7. Create Schedule to import data to application tables. default you can say immediate
8. Click next and Click on Active button , this will start importing your data .
9 . you can monitor the status of the import process in the Manage Import Activities Screen.


10 .This fist row of the table show as Completed , which means your import is successful and if you observer some of the "Completed with Errors" , which means your import is not successful , you have correct the errors and import again.

Same way you can export the application data.


Fusion CRM Web Services - Oracle Enterprise Repository(OER)


Oracle Enterprise Repository(OER):


The Oracle Enterprise Repository (OER) is a portal for all Fusion product assets including FusionCRM web services with meta data documentation.

You can access  OER   with the http://fusionappsoer.oracle.com URL by giving any Oracle.com user id  like OTN .

The following types of assets can be accessed in the repository:
      1.ADF Business Components services
       2.ADF Business Components service data objects
       3.SOA composites
       4.SOA composite services

How to access Fusion CRM Webservice:

      1. Login to http://fusionappsoer.oracle.com
      2. Select your Application Name from  Fusion Apps: Logical Business Area (in my case i am selecting "Sales" ) and then select type as "ADF Service" the click on search button. it will display avaliable ADF Webservices for that application.


 3. Now you can click on the ADF Service which you want to access want to access .(in my case i am clicking "Opportunity Assignment Rule" ADF Service  from the available list.
 4. Bottom of the screen it will display information about the Service.  

5. Click on the Detail tab , in the bottom of the page you will be seeing  two WSDL urls : 
Service Path:
http://<HostName:PortNumber>/opptyMgmtOpportunities/OpptyMgmtAsgnRuleExportService?WSDL
Abstract WSDL URL: 
rep://FUSIONAPPS_HOSTEDREP/oracle/apps/sales/opptyMgmt/opportunities/opptyMgmtAsgnRuleExportService/OpptyMgmtAsgnRuleExportService.wsdl 

6. The service WSDL can be accessed, you should change the host name to your server name . Ex:https://crmufsn4x0hnf.oracleoutsourcing.com/opptyMgmtOpportunities/OpptyMgmtAsgnRuleExportService?wsdl
        
7. You can access the above Endpoint URL to make outbound messages.

Communicate Secure FusionCRM Service From Oracle BPEL And JAVA

Communicate  Secure  FusionCRM Service From BPEL:
Oracle BPEL supports you to communicate FusionCRM Services. We have to follow same approach how we will call in the Web services in BPEL .
              
Fusion CRM Services are Secured web services and to call these services we need to do some Security configurations. 
Design time Security Settings:
        1. Configure WS-Polices to the Fusion CRM Service .
         Right Click on the Reference service ---> Configure WS-Polices--->For Request 
               
         Then select  oracle/wss_username_token_client_policy and click ok.
 2. Configure the properties for Username/password in the Compoiste.xml under the Reference Service.
 <reference name="FusionCRMOpportunityService" ui:wsdlLocation="OpportunityService.wsdl">
  <property name="oracle.webservices.auth.username" type="xs:string"
              many="false" override="may">SalesMgr</property>
    <property name="oracle.webservices.auth.password" type="xs:string"
              many="false" override="may">Welcome1</property>
  </reference>
Run time Security Settings:
Login to the SOA server and Select Weblogic domain---> SOA_domain--> Credentials
           
      

         2. Create Credentials key and give username and password. by default all the policies refer to basic.credentials to check credentials so create the key with name basic.credentials.
         3.   If we create Key with some other name then we need to mention that new key name in place of Value for csf-key under Property Set of that policy under Web logic domain->Web services->Polices as below:
    4. Now you can deploy your service and test . 

Communicate  Secure FusionCRM Service From JAVA:
  1.   Setting up the Credentials :
                1. Desgin time in the Jdeveloper we need configure the key store value
     Jdeveloper ---> Tools ---> Preferences --> Credentials ---> Client Trusted Certificate keystore
                2. Select the   DemoTrust.jks keystore from Jdeveloper phyiscal path
                    Driver://JDEVELOPER11R1V4\wlserver_10.3\server\lib\DemoTrust.jks
                3.Get the certificate for the Fusion CRM service from browser and import it into the  DemoTrust.jks keystore by using below command :
                 D:\Oracle_11.1.1.3.0\Middleware\wlserver_10.3\server\lib>keytool -v -import -file fusioncrmcoeinstance.cer -keystore cacerts
4.The security settings done now you can write Standalone Java application  to call the Secure Fusion CRM Service.

Monday, April 8, 2013

Object Work Flow

Object Work Flow:
An Object  workflow is an Orchestrated  business process that you can configure and trigger based on the condition. You can use both custom/standard objects to define an Object workflows.

Object Work Flow Configuration Steps:
                      1.Define Event Point
                      2.Define  Event Condition
                      3. Define Event Action
   
         Event Point :
         Event point is associated with an object and is an instance when an event accrue.
                                       Ex : When a record created or updated.
   
            Event Conditions:  An event condition is trigger for invoking an Object  workflows.
    
         Event Action: 
         An event  action determines  what  action  an Object workflows does when event condition is met .
         Event Action types :
                             
                                    1. Field Updation
                                    2. Email Notification 
                                    3. TaskCreation
                                    4. Outbound Message

Note :  You must have at least one type of event action  defined , and you can’t define that type more than one time in that workflow.

       Execution Schedule: Schedule process allow to say when event action has to happen.without  an Execution schedule , event action is run immediately .

Object Work Flow High level Flow:


In next section you will about EVENT ACTIONS.





Validations/Triggers/Functions


Validations/Triggers/Functions :

 Here is some examples to write Validations, Triggers and Functions on the custom fields of an object.   

Validations :

You can add validations both on Field and Object Level.

How to create Validation on Object :

   i am creating validation rule on an object where due date should not be more than 7 days.

 1. Click on new button on the Object rules section .
 2. Give the Rule name as "Due Date Validation" 
 3. Click on the Fields menu in the Rule definition area .
 4. Select Creation date field and click on  insert button,like below.

5.After insert you , you have write the due date condition and the error message to display when  
due date is more than 7 days like below.

6. Save and close . you validation rule is setup now. in the same way you can create for field level rules also.

Triggers :
Trigger fires on specific events, when a events occurs , the code in the trigger is executed.
we can create triggers by using CRM application composer.

How to create Trigger:
  Create a trigger, it should trigger when the user trying to create Ticket on the closed once. 

 1. Click on new button on the Trigger tab .
 2. Select After Create from List box of Tigger.
 3.Give the Trigger name as "Not to Open SR" 
 4. Click on the Detach button in the Trigger definition area .
 5.Click on the Fields menu and select the status and click on  insert button,like below.


6. After insert you , you have write the condition to to fire trigger and the error message like below .  

7. Save and close,your trigger is ready now.


Functions: 
      1.Object Functions  2. Global functions
Object Functions :

    1. These functions are useful for code that encapsulates business logic specific given object.  
    2.  You can call these functions by name from any other script related to the same Object.
          
How to create  Object  Functions:     
       Ex: calculate length of the Description Field.
    1. Click on new button on the Object Functions .
    2. Give the Function  name as "StrLength "
    3 .Click on the Detach button in the Function Body area .
    4.Click on the Functions  menu --> Category--> Text --length
 
5. Now you can add your field in the function like  "length(Description)"

Global Functions :

   1. These functions are useful for code that multiple objects wants to share. 
   2. To call a global function ,preface the function name with the adf.util.prefix.

  How to create  Global Functions:
   1. Move to Common Setup area and click on Global Functions.

  2. And follow the above steps which you used to create Object functions.

Server Scripts

Server Scripts 

Oracle Application Composer  allows to write the business logic (conditions to custom fields, Calculate custom formula fields etc)  to control the behavior of an object's records by writing Server Scripts. 

 You can write Business logic using two ways . 

                              1. Server Scripts  2. Global functions.
                            
   Server scripts are found in both custom and standard objects and global functions found in  common Setup area like below.

 Groovy Scripting  :

      To write the business logic CRM Application Composer allows us to write  in Groovy scripting language . Groovy is a widely used scripting language  for doing java application extensions ,UI extensions.

Why Groovy ?
        
        1. Agile and dynamic language for java virtual machine 
        2. Increase  productivity  by reducing the scaffolding code.
        3. Modern Programming features , So java developers have almost zero learning curve.
        4. very rich and user friendly and easy to use language. 

 Where can you Write Groovy in Fusion CRM applications:

  CRM Application Composer having multiple places where you can write Groovy .

         1.Fields constraints 
         2. Formula fields
         3.Object validations
         4. Triggers 
         5.Functions 
         6. Object work flows.


Groovy Builder .

    You will write groovy scripts in Groovy Builder . CRM Application composer always makes an  Expression palette available to assist you , which is part of Groovy builder. The Expression Palette helps you insert the name of the built in functions , object fields. 


    Expression Builder :


                   1. Functions : Includes custom functions Text,Number,Date etc..
                   2. Fields       : Shows fields from current object 
                   3. Keywords : Used by field validations only , for new and old values.   
                   4. Validate Script : used to validate the Groovy script   
     
     

Object Work Flows – Event Actions


Object Work Flows – Event Actions :
             
Creating Object work flow with the  Field update , Email Notification and TaskCreation Event Actions when the Status of the service request is Closed.

Select the Object Work Flow from  CRM application Composer --> Common Setup -->Object work flow


            1. you can create search for existing Object workflow configurations or  you can create new one.

Create New Object WorkFlow :

              1. Click on new icon on the Object work flow area.
              2. Select the object(ServiceRequest-Tickets) , on which object you want to configure the object workflow
              3.Give name as "Status Change"
               

          Define Event Point :
                
                     4. Select  Event Point  as " when a record updated" .

           Define Event Condition :
                     
                       5. write the condition by using expression builder like below 
                             

             Define Event Actions :
             
                        Field updates :  Configure automatic field updates by specifying which fields that you want to update and values to apply when the above Event condition trigger.

              How Configure Field Event Action :
                       
                    1. Click on New button on the 'Field updates' in 'Actions' area.

             2. Give name , and select the field has to update and give the value to apply when Event condition accrues .  


          3. Then save and close, now your event action on field is ready.

         How Configure Email Event Action :

         Configure an object workflow to send e-mail communications to the intended recipients when defined condition is met . To send e-mail template for your notification . you can either use an existing template or create one for your business need.

          Create Email Template and Event Action :

          1. Go to Object workflow ---> create Objectworkflow --> Actions--> Email --> new

        2  Give name of the Event action and click on new icon  to create E-mail Template.

        
       3. Configure Template as per your business needs. here is one example
   

     4. save and close and give the email id to whom you want to send mail in the Event action page.

     5.  Save , now your Email Event Action is ready.

Note: you can attach up 10 MB Size documents 

How Configure Task Creation  Event Action :

Send task notifications to specify Resources when a trigger condition is met.

1. Click on the new icon button on the "Task Creation " in the Actions area., then configure like below.




2. Save , now your Task Creation Action is ready.

How Configure Outbound Message  Event Action :
                 
          To send outbound messages to a web service at a specified endpoint URL.An endpoint URL is an external web service that shares the data with Oracle fusion CRM.

1.  Click on the new icon button on the "Outbound Messages " in the Actions area., then configure like below.



2. Save  , now your outbound message Event action is ready.