Sunday, April 7, 2024

Page Composer - Enabling Button and executing SOAP/REST API in Oracle fusion

Using Page Composer one can enable a custom Button and execute the SOAP/REST API dynamically by passing the parameters using the Bind parameters available in Oracle Fusion page. 
Follow the steps mentioned below.
 
Enable the Page Composer using Sandbox. (Configuration > Sandboxes > Create Sandbox)

Name : customButton
Publishable: Yes
Select Checkbox for Page Composer 

Navigate to the Page where the button needed. For the blog I'm creating the button On "Transactions" Page where user can click the button and submit an ESS job "Print Receivables Transactions" to print the invoice and attach the pdf to the invoice also send an copy of invoice to the customer. 

Navigate to Receivables > Billing > Manage Transaction

After opening the transaction window Click on Tools > Page Composer

Click On the "Structure" tab and pull the page towards Up from the bottom so that the technical components of the page can be visible.

Under the "Miscellaneous" Tab, just above the Generate Bill will be adding the Button so hover the cursor and select the main frame of the "Generate Bill" Section.

Click the Add "+" button on the Dock. Make sure the Frame element "panelFromLayout" is selected.

Click on "Open" next to "Component" in the Add Content window.

Click on "+ Add" next to the HTML Markup in the available components and click on "Close" button.

After adding the HTML Markup, you should see the "HTML Markup" is added on the page and two new elements added to "panelFormLAyout". 


Select the "<>outputTest: New HTML Markup" and click on gear icon (Show the properties of New HTML Markup).
In the "Component Properties" window click the Down arrow next to the "Value" and select the "Expression Builder".

In the "Expression Builder Copy paste the below code (Kindly modify the code as per your requirement" and test the code before deploying it in the Production or any of your environment. 


<html>
<body>
<button id="custCompleteAndReview" class="button" onclick="(function(p_org_id, p_trx_number){
//console.log('Parameters received are : '+p_org_id+'-'+p_trx_number);
var xmlhttp = new XMLHttpRequest();
var finalurl = 'https://' + window.location.host + '/fscmService/ErpIntegrationService';
xmlhttp.open('POST', finalurl, true);
credentials = 'Basic ' + 'c3ZjLnBOkludGVncmF0aW9zZXJAMTIzNA==';
xmlhttp.setRequestHeader('Authorization', credentials);
var sr = '<soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:typ=&quot;http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/&quot;> ' +
'<soapenv:Header/> ' +
'<soapenv:Body> ' +
'<typ:submitESSJobRequest> ' +
'<typ:jobPackageName>/oracle/apps/ess/financials/receivables/transactions/shared/</typ:jobPackageName> ' +
'<typ:jobDefinitionName>TransactionPrintProgramEss</typ:jobDefinitionName> ' +
'<typ:paramList>'+ p_org_id + '</typ:paramList> ' +
'<typ:paramList>#NULL</typ:paramList> ' +
'<typ:paramList>ANY</typ:paramList> ' +
'<typ:paramList>TRX_NUMBER</typ:paramList> ' +
'<typ:paramList>#NULL</typ:paramList> ' +
'<typ:paramList>#NULL</typ:paramList> ' +
'<typ:paramList>#NULL</typ:paramList> ' +
'<typ:paramList>#NULL</typ:paramList> ' +
'<typ:paramList>#NULL</typ:paramList> ' +
'<typ:paramList>#NULL</typ:paramList> ' +
'<typ:paramList>#NULL</typ:paramList> ' +
'<typ:paramList>#NULL</typ:paramList> ' +
'<typ:paramList>'+ p_trx_number + '</typ:paramList> ' +
'<typ:paramList>'+ p_trx_number + '</typ:paramList> ' +
'<typ:paramList>#NULL</typ:paramList> ' +
'<typ:paramList>#NULL</typ:paramList> ' +
'<typ:paramList>#NULL</typ:paramList> ' +
'<typ:paramList>N</typ:paramList> ' +
'<typ:paramList>#NULL</typ:paramList> ' +
'<typ:paramList>#NULL</typ:paramList> ' +
'<typ:paramList>#NULL</typ:paramList> ' +
'<typ:paramList>#NULL</typ:paramList> ' +
'<typ:paramList>PDF</typ:paramList> ' +
'<typ:paramList>Default Invoice Template</typ:paramList> ' +
'<typ:paramList>Default Credit Memo Template</typ:paramList> ' +
'<typ:paramList>Default Debit Memo Template</typ:paramList> ' +
'<typ:paramList>Default Chargeback Template</typ:paramList> ' +
'<typ:paramList>N</typ:paramList> ' +
'<typ:paramList>#NULL</typ:paramList> ' +
'<typ:paramList>-1</typ:paramList> ' +
'</typ:submitESSJobRequest> ' +
'</soapenv:Body> ' +
'</soapenv:Envelope> ' ;
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
let result = extractResultValue(xmlhttp.responseText);
alert ('Print Receivables Transactions ESS job Submitted successfully. Process ID : ' + result );
}
}
}
xmlhttp.setRequestHeader('Content-Type', 'text/xml');
xmlhttp.send(sr);
function extractResultValue(text) {
var xmlStartIndex = text.indexOf('<env:Envelope');
var xmlEndIndex = text.lastIndexOf('</env:Envelope>') + '</env:Envelope>'.length;
var xmlContent = text.substring(xmlStartIndex, xmlEndIndex);

var parser = new DOMParser();
var xmlDoc = parser.parseFromString(xmlContent, 'text/xml');

var resultTag = xmlDoc.querySelector('result');
if (resultTag) {
return resultTag.textContent;
} else {
return null;
}
}
String.prototype.obfs = function(key, n = 126) {
if (!(typeof(key) === 'number' && key % 1 === 0)
|| !(typeof(key) === 'number' && key % 1 === 0)) {
return this.toString();
}
var chars = this.toString().split('');
for (var i = 0; i < chars.length; i++) {
var c = chars[i].charCodeAt(0);
if (c <= n) {
chars[i] = String.fromCharCode((chars[i].charCodeAt(0) + key) % n);
}
}
return chars.join('');
};
})('', '');return false" > Reprint</button>
</body>
</html> <!-- typo -->


Click on "Test" and Ok to close the Expression Builder Window. 
Click on Apply and OK button in the Component Properties window to close the Properties window. 


Test your code.












Sunday, March 31, 2024

Party / Organization / Customer Merge in Oracle Fusion

Profile Options:
==================
Role: Data Steward Manager
Task: Manage Administrator Profile Value

Set the below Profile options

ZCA_MERGE_REQUEST Site=Yes
ZCH_AUTO_MERGE_THRESHOLD level =0
ZCH_USER_MERGE_REQUESTS to have Allow processing without approval.

Please follow the next steps:

Step1: Navigate to Customer Data Management > Duplicate Resolution 
     > Task List > Create Resolution Request > Search for Customer 
     > select it > Create Request

Step2: Duplicate Resolution (CDM) > Request is in status Pending 
> select the row > Actions > Submit

Step3: Go to Setup and Maintenance > search for Run Request Dispatch Job 
> do not modify anything, just Submit

Step4: After Request ID run successfully > Return to Duplicate Resolution 
> Status is now New

Step5: Enter on Request ID > Override

Step6: Next > Select Accounts to be merged > Merge 
> You can choose the Master Account > Next > Next > Submit

Step7: Duplicate Resolution (CDM) > Request is in status Submitted

Step8: Go to Setup and Maintenance > search for Run Request Dispatch Job 
> do not modify anything, just Submit

Step9: Duplicate Resolution (CDM) > Request is in status Completed

Step10: Check Customer in Receivables > Billing > Manage Customers

The accounts are now merged

Tuesday, March 19, 2024

SOAP API to FindPerson (Contact Details) using FirstName and LastName

 SOAP API
===============
 https://servername/crmService/FoundationPartiesPersonService

Service Name
=================
findPerson

Sample Payload 
=================

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/cdm/foundation/parties/personService/applicationModule/types/" xmlns:ns43="http://xmlns.oracle.com/adf/svc/types/">
   <soapenv:Header/>
   <soapenv:Body>
<typ:findPerson>
<typ:findCriteria>
<ns43:fetchStart>0</ns43:fetchStart>
<ns43:fetchSize>1</ns43:fetchSize>
<ns43:filter>
<ns43:group>
<ns43:item>
<ns43:attribute>PersonFirstName</ns43:attribute>
<ns43:operator>=</ns43:operator>
<ns43:value>Seth</ns43:value>
</ns43:item>
<ns43:item>
<ns43:attribute>PersonLastName</ns43:attribute>
<ns43:operator>=</ns43:operator>
<ns43:value>Laskarzewski</ns43:value>
</ns43:item>
</ns43:group>
</ns43:filter>
<ns43:sortOrder>
<ns43:sortAttribute>
<ns43:name>CreationDate</ns43:name>
<ns43:descending>true</ns43:descending>
</ns43:sortAttribute>
</ns43:sortOrder>
<ns43:childFindCriteria>
<ns43:fetchStart>0</ns43:fetchStart>
<ns43:fetchSize>1</ns43:fetchSize>
<ns43:filter>
<ns43:group>
<ns43:item>
<ns43:attribute>RoleType</ns43:attribute>
<ns43:operator>=</ns43:operator>
<ns43:value>CONTACT</ns43:value>
</ns43:item>
</ns43:group>
</ns43:filter>
</ns43:childFindCriteria>
</typ:findCriteria>
</typ:findPerson>
   </soapenv:Body>
</soapenv:Envelope>

Thursday, March 14, 2024

SOAP API to Create Receipt Reversal Transaction (Oracle Fusion Receivables Cloud)

 
SOAP API
===========


Service Name
=============

createReverseReceipt

Sample Payload
===============

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/financials/receivables/receipts/shared/standardReceiptService/commonService/types/" xmlns:com="http://xmlns.oracle.com/apps/financials/receivables/receipts/shared/standardReceiptService/commonService/">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:createReverseReceipt>
         <typ:reverseReceipt>
            <!--Optional:-->
            <!--<com:ReceiptNumber>1111115575</com:ReceiptNumber>-->
            <!--Optional:-->
            <com:ReversalCategory>CC_CHARGEBACK_REV</com:ReversalCategory>
            <!--Optional:-->
            <com:ReversalDate>2024-03-14</com:ReversalDate>
            <!--Optional:-->
            <com:ReversalReasonCode>CC_CHARGEBACK_CHANGE</com:ReversalReasonCode>
            <!--Optional:-->
            <com:ReversalComments>Testing</com:ReversalComments>
            <!--Optional:-->
            <com:BusinessUnit>Business Unit</com:BusinessUnit>
            <!--Optional:-->
            <!--<com:ReversalCategoryName>?</com:ReversalCategoryName>-->
            <!--Optional:-->
            <com:ReversalGlDate>2024-03-14</com:ReversalGlDate>
            <!--Optional:-->
            <!--<com:ReversalReasonName>?</com:ReversalReasonName>-->
            <!--Optional:-->
            <com:ReceiptId>3801247</com:ReceiptId>
            <!--Optional:-->
            <!--<com:InterfaceToBudgeting>?</com:InterfaceToBudgeting>-->
            <!--Optional:-->
            <!--<com:InterfaceFailureReason>?</com:InterfaceFailureReason>-->
         </typ:reverseReceipt>
      </typ:createReverseReceipt>
   </soapenv:Body>
</soapenv:Envelope>


Sample Response
================

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing">
   <env:Header>
      <wsa:Action>http://xmlns.oracle.com/apps/financials/receivables/receipts/shared/standardReceiptService/commonService/StandardReceiptService/createReverseReceiptResponse</wsa:Action>
      <wsa:MessageID>urn:uuid:fa70c096-d413-4153-9858-3226af253140</wsa:MessageID>
   </env:Header>
   <env:Body>
      <ns0:createReverseReceiptResponse xmlns:ns0="http://xmlns.oracle.com/apps/financials/receivables/receipts/shared/standardReceiptService/commonService/types/">
         <ns1:result xsi:type="ns3:ReverseReceiptResult" xmlns:tns="http://xmlns.oracle.com/adf/svc/errors/" xmlns:ns0="http://xmlns.oracle.com/adf/svc/types/" xmlns:ns3="http://xmlns.oracle.com/apps/financials/receivables/receipts/shared/standardReceiptService/commonService/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://xmlns.oracle.com/apps/financials/receivables/receipts/shared/standardReceiptService/commonService/types/">
            <ns3:Value>
               <ns3:ReceiptNumber xsi:nil="true"/>
               <ns3:ReversalCategory>CC_CHARGEBACK_REV</ns3:ReversalCategory>
               <ns3:ReversalDate>2024-03-14</ns3:ReversalDate>
               <ns3:ReversalReasonCode>CC_CHARGEBACK_CHANGE</ns3:ReversalReasonCode>
               <ns3:ReversalComments>Testing</ns3:ReversalComments>
               <ns3:BusinessUnit>Business Unit</ns3:BusinessUnit>
               <ns3:ReversalCategoryName xsi:nil="true"/>
               <ns3:ReversalGlDate>2024-03-14</ns3:ReversalGlDate>
               <ns3:ReversalReasonName xsi:nil="true"/>
               <ns3:ReceiptId>3801247</ns3:ReceiptId>
               <ns3:InterfaceToBudgeting>Not Enabled</ns3:InterfaceToBudgeting>
               <ns3:InterfaceFailureReason xsi:nil="true"/>
            </ns3:Value>
         </ns1:result>
      </ns0:createReverseReceiptResponse>
   </env:Body>
</env:Envelope>






SOAP to Create Debit memo (Oracle Fusion Receivables Cloud Service)

 SOAP API
===========


Service Name
=============
createDebitMemo


Sample Payload
================
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xmlns.oracle.com/apps/financials/receivables/transactions/invoices/debitMemoService/types/" xmlns:deb="http://xmlns.oracle.com/apps/financials/receivables/transactions/invoices/debitMemoService/">
   <soapenv:Header/>
   <soapenv:Body>
      <typ:createDebitMemo>
         <typ:debitMemo>
            <deb:BatchSourceSequenceId>37711366</deb:BatchSourceSequenceId>
            <!--BATCH_SOURCE_SEQ_ID :-->
            <deb:CustomerTrxSquenceId>38859442</deb:CustomerTrxSquenceId>
            <!--CUST_TRX_TYPE_SEQ_ID put Debit memo here :-->
            <deb:InvoiceCurrencyCode>USD</deb:InvoiceCurrencyCode>
            <deb:OrgId>33059258</deb:OrgId>
            <deb:BillToCustomerId>132506363</deb:BillToCustomerId>
            <!--BILL_TO_CUSTOMER_ID:-->
            <deb:BillToAddressId>316731415</deb:BillToAddressId>
            <!--BILL_TO_ADDRESS_ID:-->
            <deb:BillToSiteUseId>316731416</deb:BillToSiteUseId>
            <!--BILL_TO_SITE_USE_ID:-->
            <deb:Comments>test debit memo service</deb:Comments>
            <deb:DefaultTaxationCountry>US</deb:DefaultTaxationCountry>
            <deb:PaymentTermsId>32914118</deb:PaymentTermsId>
            <!--TERM_ID:-->
            <deb:RemitToAddressSequenceId>32914100</deb:RemitToAddressSequenceId>
            <!--REMIT_TO_ADDRESS_SEQ_ID:-->
            <deb:ShipToAddressId>132255334</deb:ShipToAddressId>
            <!--SHIP_TO_PARTY_ADDRESS_ID:-->
            <deb:ShipToCustomerId>114525837</deb:ShipToCustomerId>
            <!--SHIP_TO_PARTY_ID:-->
            <deb:ShipToSiteUseId>132298316</deb:ShipToSiteUseId>
            <!--SHIP_TO_PARTY_SITE_USE_ID:-->
            <deb:TrxDate>2024-02-12</deb:TrxDate>
            <deb:DebitMemoLine>
               <deb:LineNumber>1</deb:LineNumber>
               <deb:Description>test1 debit memo service</deb:Description>
               <deb:InvoicedQuantity unitCode="">1</deb:InvoicedQuantity>
               <deb:UnitSellingPrice currencyCode="USD">100</deb:UnitSellingPrice>
               <deb:LineType>LINE</deb:LineType>
               <deb:ExtendedAmount currencyCode="USD">100</deb:ExtendedAmount>
               <deb:RevenueAmount currencyCode="USD">100</deb:RevenueAmount>
               <deb:OrgId>33059258</deb:OrgId>
            </deb:DebitMemoLine>
            <deb:DebitMemoLine>
               <deb:LineNumber>2</deb:LineNumber>
               <deb:Description>test2 debit memo service</deb:Description>
               <deb:InvoicedQuantity unitCode="">1</deb:InvoicedQuantity>
               <deb:UnitSellingPrice currencyCode="USD">100</deb:UnitSellingPrice>
               <deb:LineType>LINE</deb:LineType>
               <deb:ExtendedAmount currencyCode="USD">500</deb:ExtendedAmount>
               <deb:RevenueAmount currencyCode="USD">500</deb:RevenueAmount>
               <deb:OrgId>33059258</deb:OrgId>
            </deb:DebitMemoLine>
         </typ:debitMemo>
      </typ:createDebitMemo>
   </soapenv:Body>
</soapenv:Envelope>