function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DeveloppeurDeveloppeur 

Best practice : field sync with external service

Hi everyone,

We are currently trying to sync the field of an Account from an external service.
The external service is a just an Azure database, there is also an http api in front of the database that we can use.

What we want to achieve is :

Each time a salesforce user display the account page, the data is retrieved from the external database/webservice and the Account's field is updated accordingly.

We found potential solutions but are not sure which one is the best :

- There's something called "Lightning" that looks like it could do the job.
- We can create an Apex method that will do the job.
     - How can we trigger it so that we have the behavior we want ? Could we invoke it with javascript from the account page ?
     - If we can't achieve the behavior we want, is invoking it with a 'refresh' button the best method ?


Thanks everyone

Sai KethuSai Kethu
Hi 

Im not sure of Lightening Components option, But i can help you with Apex option:

Assumption:
  • The view page of the object is overridden by VF page.
  • The VF page is displaying this feild which needs to shows the value from external system.
Steps to Implement:
  • In constructor of apex class assign the account field with the apex method which integrates with external system and returns the value from external system.
  • Show this field on the VF Page.
Regards
Sai
DeveloppeurDeveloppeur
Thanks a lot for your answer Sai.

For creating the Visual Force account page, I have followed this tutorial :
https://www.salesforce.com/docs/developer/pages/index_Left.htm#CSHID=pages_quick_start_tabs.htm|StartTopic=Content%2Fpages_quick_start_tabs.htm|SkinName=webhelp

After that, I'm not really sure what I should do to invoke my method with the callout.

Does this link is realted to what you are talking about ?
https://www.salesforce.com/docs/developer/pages/Content/pages_controller_methods.htm

Best regards,
JB
Sai KethuSai Kethu
Hmm....

I think you are using only StandardController, you may need to Extend the VF using 'Extensions' with a apex class which has logic to get the value from external system.

Example: 
<apex:page standardController="Account" extensions="myControllerExtension" showHeader="true"  tabStyle="account" >

See here for more info on Extensions: https://www.salesforce.com/docs/developer/pages/Content/pages_controller_extension.htm

Regards
Sai