2

Our client has accounts, and there is a ‘category’ picklist that one of the entries in this picklist is ‘sightseeing/receptive’ (Receptive Operator). The idea of this entry is that a company can do business on behalf of one or more other companies. The client would like to be able to associate one or more accounts so they can see at a glance what businesses these receptive operators do business for. This should not have any reporting needs or other advanced needs at this time. (I’ve done some research into junction objects and many-to-many relationships, but I think my solution should be simpler).

So they have ‘something’ in the meantime, I’ve added a ‘Receptive Relationships’ field on the accounts page layout that is just a text entry field so they can type in multiple company names. I’d like to be able to make it so they can click from these associations and jump to the particular account pages themselves, from this view.

One solution I'm imagining is, with the ‘Category’ (picklist) I’d like to make it so that if ‘sightseeing/receptive’ is chosen, then a field shows up underneath it with a picklist value , perhaps called ‘How many?’ with a pick list value of 1-10. Depending on which number they select, will provide that number of additional lookup fields in which they can select an existing company to associate. I’ve done a little reading on dependent picklists but wasn’t able to find a scenario that fits my needs.

Alternatively, if that is not possible, is there a way to make a multiple lookup field that shows the accounts in a single line in the field? Is this possible? Or anything similar that might come close?

I’ve come across some pages regarding dynamic field creation, which mentioned apex code and I’m on professional edition which I don’t think includes apex? Please correct me if I’m mistaken.

Thanks for any help in advance.

2 Answers 2

0

First of all, dynamic creation of fields in an object, even using apex, is not possible. On top of that, there's a limit of lookup fields that you can have per object, then I'm sure you don't want that.

Accounts can be related with other accounts via the field: Parent, which is a lookup to account. You could create a company A, and relate two companies (B and C for example) to A using this field. But if you wanted to relate B also to another company D, you won't be able to do it.

If you need to do a real many-to-many relationship you'll need to create an intermediate object (ReceptiveAccounts or something like this) with two lookup fields to Account. This way you'll be able to relate A with B, and D with B for example.

Also, If I understood well, in the detail page of A, you need to be able to see all accounts "related" in a single line or field. I think VLOOKUP function or Roll-Up Summary fields won't work here. You definitely need to create a small Visual Force component with a small Apex controller to do that.

Sorry, no easy solution for this one.

1
  • Thank you for the quick reply. The Parent field will not suffice for this as a child cannot have multiple parents, as you referenced with ABCD. - Yes, you did understand correctly that this would be needed to be seen in the account view page. They wouldn't necessarily need to be shown in a single field, but since you said even with apex dynamic creation of fields isn't possible, I guess that's out of the question.
    – Ryan T
    Mar 13, 2014 at 16:44
0

I think there could be some workaround using VF.

I once created VF page that was part of layout, this page displayed table with quasi-parent objects. In fact that was just Ids stored in one text field. VF page allows user to add another parent - by choosing in lookup and adding Id to the text field and delete by temoving from table. It is not most elegant solution but It allows me achieve simmular functionality without using junction object (there was limit for number of objects).

But in my opinion junction Object will be best solution for you

5
  • Using a junction object is there a way (using VF or otherwise) to display those associated accounts the way that I'm requesting? If so, how?
    – Ryan T
    Mar 13, 2014 at 19:10
  • quite easy - simplest version : use related list of junction object to display information from related objects. More complex: I am not able now to provide any code... But basicly - new record type (when you set this picklist value) with new layout. remove related object list, put your VF page in layout. page should have DataTable/related list of junction object, add new button which will call method that will create new junction object where user can use lookup to chose associated record. And thats all. I think it should take about 1 day to implement it Mar 13, 2014 at 19:52
  • Hi Artur, could you further outline or explain how you would go abouts displaying the information from the junction object in a single field of an account page layout? As was mentioned by the other user here, it was suggested that this wasn't possible without a VF page with apex, and apex is not an option in my version.
    – Ryan T
    Mar 19, 2014 at 20:09
  • "displaying the information from the junction object in a single field" - it is not possible without apex. the only thing you can do is display it in related list. Mar 20, 2014 at 7:33
  • Would showing it in a related list be similar in visual style to the client? Will it be viewable in the account view page of the company? will the list of accounts be clickable? and how do the clients 'assign' the specified accounts for that related list through the junction object?
    – Ryan T
    Mar 21, 2014 at 13:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .