10,730
edits
Line 44: | Line 44: | ||
You have created the integration; you can now set it up. | You have created the integration; you can now set it up. | ||
== | == Customize integration == | ||
=== How to change default mapping? === | |||
# | Mapping allows you to match entities and fields on Business Central with entities and fields on Resco. Out of the box, three entities are mapped and ready for synchronization: account, contact, and work order. | ||
# | |||
# Double-click the integration. | |||
# Select an entity on the External Entities pane (left). | |||
# Select the matching local entity, its primary key, and version number. | |||
# In the table below, define the mapping for fields that you want to integrate: select the checkbox and choose a matching '''Local Field'''. | |||
# For all fields with the local type Lookup, enter the lookup '''Target''' in this format: <code>[localEntity].[localField]</code> (e.g., <code>account.integration_bc_pk</code>). | |||
# Save all changes. | |||
=== How to enable/disable entity for synchronization? === | |||
# Double-click the integration. | |||
# Select an entity from the '''External Entities''' pane. | |||
# Click '''Enable''' or '''Disable'''. | |||
# Save all changes. | # Save all changes. | ||
=== How to change Sync Filter? === | |||
If you want to restrict what data to sync, consider setting up a [[Sync Filter]]. | |||
# Double-click the integration. | |||
# Select an entity from the '''External Entities''' pane. | |||
# Click '''Sync Filter'''. | |||
# Enter custom conditions that serve as a filter for records. | |||
# Save all changes. | |||
=== How to add a new entity to integration? === | |||
Synchronization is effective if versionnumber of entity (Table in Business Central) is compared from the last sync. Therefore we recommend creating a table extension to access field(0) - versionnumber in Business Central. | |||
There is the example of table extension for Customer (Apply the same principle for another Table): | |||
<syntaxhighlight lang="pascal"> | |||
tableextension 50101 "Resco Customer" extends Customer | |||
{ | |||
fields | |||
{ | |||
field(50000; RowVersionNumber; BigInteger) | |||
{ | |||
Caption = 'RoW Version Number'; | |||
DataClassification = CustomerContent; | |||
} | |||
} | |||
trigger OnAfterModify() | |||
begin | |||
Rec.RowVersionNumber := GetRowVersionNumber(Rec); | |||
Rec.Modify(false); | |||
end; | |||
procedure GetRowVersionNumber(var recordCustomer: Record Customer) RowVersion: BigInteger | |||
var | |||
RecRef: RecordRef; | |||
begin | |||
RecRef.GetTable(recordCustomer); | |||
RecRef.GetBySystemId(recordCustomer.SystemId); | |||
RowVersion := RecRef.Field(0).Value(); | |||
end; | |||
} | |||
</syntaxhighlight> | |||
Second step is to add this custom field to your Page/new Page: | |||
Some fields will need some special handling, use triggers: OnModifyRecord(), OnAfterGetCurrRecord(), OnInsertRecord() to create your custom logic (e.g., mapping of status). | |||
<syntaxhighlight lang="pascal"> | |||
page 50110 "Resco Customer" | |||
{ | |||
//.... | |||
//your page definition | |||
//.... | |||
layout | |||
{ | |||
area(Content) | |||
{ | |||
repeater(Group) | |||
{ | |||
//...... | |||
//your fields | |||
//...... | |||
field(RowVersionNumber; Rec.RowVersionNumber) | |||
{ | |||
ApplicationArea = All; | |||
Caption = 'VersionNumber', Locked = true; | |||
} | |||
} | |||
} | |||
} | |||
} | |||
</syntaxhighlight> | |||
Upload the created table and page extensions to your Business Central organization. | |||
# Open Web Services in your Business Central. | |||
# Click New. | |||
# Select Page, Object ID of created Page and define Service Name (it will be displayed in Integration Editor in Woodford) and Save. | |||
Return to Resco Cloud. | |||
# Open your integration, enable external entity for integration and do mapping. | |||
# Select Local entity, Primary Key, Version Number - RowVersionNumber and do field mapping. | |||
== Synchronization == | |||
The first sync is [[full sync]]: all records of enabled local entities are cleaned up on Resco Cloud and all records of external entities are downloaded from Business Central. Every next sync is incremental - only changes are transferred. | |||
=== On Demand === | |||
# Double-click the integration in Woodford. | |||
# Click '''Sync''' to start synchronization manually. | |||
=== Scheduled === | |||
# Open Admin Console. | |||
# Select Processes Center > Processes. | |||
# Click New to create a new process. | |||
# Select workflow/job. | |||
# Schedule or define condition when sync should be executed. | |||
# From toolbar click Step > Function > pick Server > IntegrationSync > enter name of your integration. | |||
=== Web Service === | |||
Basic authorization | |||
<syntaxhighlight lang="http"> | |||
https://rescocrm.com/rest/v1/integration/{name of your integration}/$sync | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="xml"> | |||
<IntegrationRequest IsSynchronous="false" KeepStatusLog="true"> | |||
<Ticket></Ticket> | |||
</IntegrationRequest> | |||
</syntaxhighlight> | |||
== See also == | == See also == |