1. Install & Prepare SyncQ in Salesforce

1.1 Install/upgrade SyncQ app: Install the latest release of SyncQ from www.syncq.net GetSyncQ section.

1.2  Prepare: Required only if Salesforce My Domain is not enabled in your org.

Log in to Salesforce as Admin. Go to 
Setup->Company Settings->My Domain

Enabled My Domain and deployed to all users.

For IE11 (+) users: Please check the following link:
https://help.salesforce.com/articleView?id=000233325&type=1&language=en_US

2. Create a Connected App

Log in as Salesforce administrator, go to Setup:

2.1 Lightning: Apps | App Manager, on the right top, click on New Connected App

(*In this setup help, we are following Salesforce Lightning mode only)
Classic: Create new Setup | Build | Create | Apps | Connected Apps

2.2 Fill up as follows:

Name : SyncQSFLogin
API Name : SyncQSFLogin
Contact Email : Put your email id
Enable OAuth Settings : Check
Callback URL: will be available in next step, till then, enter https://www.salesforce.com
Selected OAuth Scopes : Select "Access and Manage your data (api),
Full Access (full),
Perform requests on your behalf at any time (refresh_token, offline_access)

2.3 click "Save", then click "Continue", it will generate "Consumer Key" and "Consumer Secret"
** Don't close this window or browser tab and move forward or backward, we will come back to update some field

3. Create Auth Provider

3. 3.1 Lightning : Open a new tab and goto Setup -> Identity -> Auth. Providers
Classic : Create new Setup | Administer | Security Controls | Auth. Providers | Create New

3.2 Click on "New"

3.3 Select Provider Type : Salesforce

3.4 Fill as follows:

Name : SyncQSFAuthorization
URL Suffix : SyncQSFAuthorization
Consumer Key : Copy from 2.3
Consumer Secret : Copy from 2.3
Default Scopes : refresh_token full
Registration Handler : Click on "Automatically create a registration handler template"
Execute Registration As : Select Salesforce (admin), this user will login to authorize the connected app

3.5 Click "Save"
3.6 This will create few Salesforce Configuration URLs
3.7 Copy "Callback URL", go to Connected App tab (2.3), click Edit, and replace the Callback URL field with the new value from 3.6
3.8 Click Save on Connected App

4. Setup Salesforce for authentication (Optional)

4.1 Go to Setup | Administer | Domain Management | My Domain | Authentication Configuration |
4.2 Click Edit
4.3 It will open up the Authentication Configuration
4.4 In Authentication Service, check SyncQSFAuthorization
4.5 Click Save
4.6 Logout from Salesforce

5. Create Named Credential

5.1 Setup | Administer | Security Controls | Named Credentials | New Named Credential
5.2 Label LQ_SFDC
Name : LQ_SFDC (this is fixed )

URL: (copy url from my domain)
Identity Type : Named Principal

Authentication Protocol : OAuth 2.0

Authentication Provider : SyncQSFAuthorization
Scope : refresh_token full

Start Authentication Flow on Save : checked

Generate Authorization Header checked
Allow Merge Fields in HTTP Header checked
Allow Merge Fields in HTTP Body checked

Click Save

After clicking on "Save", a new page will open to authenticate Salesforce Org using OAuth2 connected App.
If authentication is a success, you will see a message:

Authentication Status: Authenticated as ...

If you get an error like ..error=redirect_uri_mismatch
&error_description=
redirect_uri%20must%20match%20configuration
click on the Edit link of Named credential after 30 mins and then click Save.


6. Configure SyncQ lightning component

You are now all set to start using SyncQ.
Login to Salesforce in Lightning mode
Go to the home page, and click Setting wheel on top right, then click "Edit Page"
On left, in "Lightning Components", look for SyncQ in "Custom-Managed section"
Place the component in a suitable place in the home page, (should be wide enough for easy viewing of multiple columns)
(You may place this in any page, not necessarily to be in Home page only)
Click Save and Activate

The component should be visible as

"SyncQ - QuickBooks Salesforce Automation"

SyncQ button in Salesforce classic:

Create a detail page button in Account object with behavior Execute JavaScript and copy the following button code :

{!REQUIRESCRIPT("/soap/ajax/40.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/40.0/apex.js")}

var res = sforce.apex.execute("syncq/SyncQ","SynchWithQB",{RecordId:"{!Account.Id}"} );

if(res=='INVALID_LICENSE'){
alert('Invalid license, please contact support@syncq.net');
}

setTimeout(function () {
location.reload();
}, 3000);




7. Authorize QuickBooks to Allow Salesforce to Connect

91. In Salesforce lightning component page, click on the green button "Connect to QuickBooks"
9.2 This will open up a new tab, redirecting to QuickBooks app login page (https://appcenter.intuit.com/)
9.3 Login and authorize the intended company 
9.4 Click Authorize
9.5 Click on the Salesforce Home tab
9.6 The new company will be automatically added in the drop down. Now, select QuickBooks database in the component dropdown. If everything working correctly, you will get
QuickBooks company name in green color next right to the company drop down. (If not authorized or incorrect company selected, a message will appear as "Require QuickBooks Authorization")
9.7 If you see your company name, and the green button will be replaced by a red button "Disconnect QuickBooks".   

Congrats! We are good to start linking your QuickBooks from Salesforce.



Sample Configuration

SyncQ  Sample Configuration:

1. Select your QuickBooks database in the SyncQ component
2. You will get two columns, one Salesforce, another QuickBooks, followed by a Green Link Button
3. Select the desired Salesforce object that you want to sync with QuickBooks
In this example, we will map Salesforce Account object with QuickBooks Customer resource
4. Select Account in the Salesforce drop down, Select Customer in QuickBooks dropdown, and then click the Link button on right
5. A new row will add up starting with ID as LQ-xxx.
6. This has created a mapping at Salesforce object to QuickBooks resource level, next we will define field mappings
7. Click on the Field Mappings icon (two circled arrow icon), it will add up a new row,
showing Salesforce object fields and QuickBooks resource fields
8. Map the desired fields as required (for proper synching, correct field mapping required, ask SyncQ for any help)
In this example, we will map, Account Name from Salesforce Account object to DisplayName
from QuickBooks Customer resource
On success, it will add a new row starting with ID LQM-xxxx
9. We are now ready to Synch records from Salesforce to QuickBooks
10. Goto a record page of Salesforce Account
11. Click on the Settings wheel on the top right, then click on Edit Page
12. From Lightning Components -> Custom Managed, drop SyncQ Buttons and drop in an appropriate position in page layout
13. Click Save and Activate
14. A "Sync" button will appear in the layout
15. Click on this button and then check in QuickBooks customer if the account record appears as a customer.
If the same customer name already exists in QuickBooks, SyncQ will just map with the existing record.
To verify if sync successfully, does the following steps:

a. Goto Salesforce setup, goto the profile of the Salesforce user that you have logged in as (in this example it is System Administrator)
b. Goto "Field-Level Security" -> "Standard Field-Level Security" -> Account, click on View
15. To view, QuickBooks related sync details, goto the user profile and give the edit permission to the following fields
in the mapped object. For example, if you are mapping Salesforce Account object with QuickBooks Customer,
go to Salesforce user profile, then go to Field-Level Security for Account and give Edit permission to the following
fields:
QuickBooks Callback Log : Lookup
QuickBooks Company : Picklist
QuickBooks Error : Long Text Area
QuickBooks Id : Text
QuickBooks No : Text

FOR MULTI-COMPANY CONFIGURATION, QuickBooks COMPANY SELECTION IS MUST, OTHERWISE SYNC WILL FAIL, IN A SINGLE COMPANY SETUP, IT IS NOT MANDATORY

You may now place these fields in Account layout for easy reviewing of sync data or error message.