2022

Page tree
Skip to end of metadata
Go to start of metadata

USE CASE

The ‘OpportunityToQBOE’ button will not be supported if the DBSync installed package version is above 1.5. A new action has to be created in the Salesforce instance inorder to make it work.

SOLUTION

Below are the steps to be followed in order to create the custom visual force page: 

  • Search VisualForce Page in quickfind

  • Create a new visual force page (say:NewButtonVFP)

  • Check the box : Available for Lightning Experience, Lightning Communities, and the mobile app

  • Copy the below mentioned code (make sure the sfURL is the endpoint url under the sf connectors tab):

  • <apex:page standardcontroller="Opportunity">

<apex:form style="align:center;text-align:center">

<apex:sectionHeader title="Salesforce QuickBooksOnline Integration" />

<script>

<!-- Creation of Transaction(Invoice, Estimate, SalesReceipt) from Opportunity -->


function createTransaction() {

var URL = "{!$User.AVSFQB__QBOE_DBSync_Server__c}/qboe.m?sfUrl=https://rsps.my.salesforce.com/services/Soap/u/14.0/00D300000000l40={!$User.AVSFQB__QBOE_Connection_Ticket__c}&pdl=processdefinition_SFQB_OpportunityTo{!Opportunity.AVSFQB__Generate_Object__c}.xml&recordId={!Opportunity.Id}&dbsyncId={!$User.AVSFQB__DBSync_Id__c}&profileName={!$User.AVSFQB__DBSync_Profile__c}&sessionId={!$Api.Session_ID}&dbsyncPasswd={!$User.AVSFQB__DBSync_Passwd__c}";

window.open(URL, "DBSync",

"menubar=0,resizable=0,width=650,height=300");

}


<!-- Update Invoice Details from QuickBooks Online -->


function updateInvoice() {

var URL="{!$User.AVSFQB__QBOE_DBSync_Server__c}/qboe.m?sfUrl={!$Api.Partner_Server_URL_320}&qboeCT={!$User.AVSFQB__QBOE_Connection_Ticket__c}&pdl=processdefinition_QBSF_InvoiceToInvoice.xml&recordId={!Opportunity.Id}&dbsyncId={!$User.AVSFQB__DBSync_Id__c}&profileName={!$User.AVSFQB__DBSync_Profile__c}&sessionId={!$Api.Session_ID}&dbsyncPasswd={!$User.AVSFQB__DBSync_Passwd__c}";

window.open(URL,"DBSync","menubar=0,resizable=0,width=650,height=300");

}

</script>

<apex:commandButton value="Create Invoice in QBO" id="theButton1"

onclick="createTransaction()"

style="margin:10px;font-size:15px;padding:10px;" />

<!-- <apex:outputPanel>Creates Transaction in QuickBooks Online from SF Opportunity</apex:outputPanel> -->

<apex:commandButton value="Update Invoice from QBO" id="theButton2"

onclick="updateInvoice()"

style="margin:10px;font-size:15px;padding:10px;" />

<!-- <apex:outputPanel>Updates Invoice Details in Salesforce from QuickBooks Online</apex:outputPanel> -->

</apex:form>

</apex:page>

  • Save

  • Go To Object Manager, Scroll to Opportunity

  • Click on Buttons, Links, and Actions

  • Click on new action, make sure to give action type- Custom visual Force

  • Select the created visual force page ( here : NewButtonVFP)

  • Give a label and a name (say: OppToInv) (name of the button)

  •  Add to all the page layouts (drag oppToInv button from the quick action and mobile and lightening action)

  • No labels