+ Start a Discussion
KazminKazmin 

custom field assignment

Hey all,

I'm developing a salesforce app, it basically provides a search interface to an external database. After the user has finished searching, he can create a new Account and fill some of its fields with data from this external database. 

I want to allow the users to customize which fields from the database map to which fields in their new Account objects. What is the best way to do that? Is there a standard component, code, snippet?

Any help from the more experienced developers would be highly appreciated.

 

Regards,

Nikolay

Best Answer chosen by Admin (Salesforce Developers) 
PaqsPaqs

Hi Kazmin,

 

I have cheked out the cookbook and a little bit around and have not found a "ready-made" component. Looks like you will have to create that one. 

Once you do, submit your code to the Cookbook of the dev community as it might be useful to others.

 

Best,

 

 

All Answers

AmitSahuAmitSahu

Hi Kazmin,

 

What is the external database you would be using in this ?

 

 

KazminKazmin

I send requests to a web service, it returns a number of organizations, each organization can become a new account.

AmitSahuAmitSahu
So you may be using rest api for tthis. In that case you can use the response object to create your records. Most probably you will get an xml response. You nees to parse the xml to be able to get data.
KazminKazmin

Thanks for the reply.

I know how to get the data and I know how to create an account. I'm asking how to allow the user to customize which field from the database maps to which account fields( e.g. I get a field called "income" from the database and the user might want to map that to the "revenue" field in the Account). It's clear that I have to build some admin interface for that, but I'm wondering do I have to build it from scratch or is there something else out there that can help me.

AmitSahuAmitSahu

This is bit clearer......

 

You can create a custom settings for the mapping..

 

you can create a customsetting which stored the account field vs response fields. So when you are creating the account you can dynamically get the field mapping from the customsettings. You can provide the custom settings to someone who would like to make the changes latter.

 

 

PaqsPaqs

I think i understand what you are looking for, something similar to the way the DataLoader is presenting you with an interface to map the fields from the source file to the target database fields...

In that case, i do not know if that piece of code is available somewhere, but it shouldn't be too hard to create a reusable component to accomplish this.  

With a framework like extJS or JQuery for instance, something to allow for a drag and drop interface that lets the user pick the fields from the target database -> local account fields.

 

 

KazminKazmin

Yes, this is basically what I want to achieve, without the drag and drop sugar for now. I was wondering if there's a standard way or a component to help me with the work, but if there isn't I'll write it myself.

Thanks for the help.

PaqsPaqs

Hi Kazmin,

 

I have cheked out the cookbook and a little bit around and have not found a "ready-made" component. Looks like you will have to create that one. 

Once you do, submit your code to the Cookbook of the dev community as it might be useful to others.

 

Best,

 

 

This was selected as the best answer