0

I am developing a project which allows to sync Salesforce data with it.

Steps: 1. User select module i.e. Leads, Contacts 2. Displaying all column from my database and salesforce in dropdown

Now what I want to do in step 2 is that sort and mirror the column so user don't misplace data.

In my leads table columns are: FullName, Designation, Contact, Mail,

Salesforce's leads table columns are: Name, Title, Mobile, Email

So when user select FullName from the dropdown then select another dropdown of salesforce column with Name and vice versa and same with others columns

So the thing is that columns remain dynamic so what would be the better approach ?

Thanks

1 Answer 1

0

On the Salesforce side, you can use Schema.getGlobalDescribe to find all the SObjects (tables) in the org:

// Fully dynamic
Map<String, SObjectType> gd = Schema.getGlobalDescribe();
SObjectType type = gd.get('Lead');

or just hard code some of them:

// Hardcoded for a speficic SObject
SObjectType type = Lead.SObjectType;

and from the SObjectType token you can find the details of all the fields:

// Find the fields
SObjectField[] fields = type.getDescribe().fields.getMap().values();
for (SObjectField field : fields) {
    DescribeFieldResult dfr = f.getDescribe();
    ...
}

Whatever system you are syncing with is likely to have a similar type of API.

4
  • Sorry I forgot to mention that I am using node js for that and my project doesn't have any apis so far what I have is MySql tables... May 29, 2019 at 8:56
  • @MysteriousCoder Salesforce has web service APIs built in to provide the same metadata. So you should be able to pull that information into your node app.
    – Keith C
    May 29, 2019 at 9:48
  • I have those column but is possible to mirror it with my project ? May 29, 2019 at 11:02
  • @MysteriousCoder I don't know enough about your problem to comment further - good luck.
    – Keith C
    May 29, 2019 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.