How can I display a field from one module in a different module?

I am running SugarCRM Professional, Version 7.2.  I want to add a field to a layout in the calls module, but the field I want to add is a Studio created field from a different module.  I searched the old Sugar vt bulletin forums and found lots of people talking about editing the php files and creating all kinds of relationships, but no one clearly said whether it can be done strictly via Studio.  This site seems less techie, but I have not found an answer here either.  Can I (without editing any source files manually or installing JavaScript files) make a field created for one module available for the layout of a screen in another?  It sure seems like something lots of people would want to do.  Thanks for any help I get (even if the answer is that it cannot be done).
Parents
  • Hi reluctant data and Paul,

    The functionality you are looking to achieve can be easily achieved with Sugar Logic which is a formula-based engine akin to Excel formulas. Since Paul's example is looking for a specific use, I will highlight his use case in the steps to achieve this functionality:
    1. Go to Admin > Studio > Calls > Fields > Add Field
    2. Create a text field called lead_account_name and on that field creation screen, check the 'Calculated Value' box and then 'Edit Formula':

    3. A formula builder window will pop up and on that pop-up, click the 'Related Field' button.
    4. Once that is clicked, set the module to 'Leads' and the field to 'Account Name', and then click 'Insert'

    5. This action will automatically create the necessary formula into the builder and then you can click 'Save' to return to the field creation.
    6. Click 'Save' again to finalize creating your field
    7. Remaining in Studio, go to Calls > Layouts > List View
    8. Locate the newly created field in the far right column and drag it over to the desired location in the first column labeled 'Default'.

    9. Click the 'Save & Deploy' button to publish the new layout.
    10. Create a call associated to a lead and see that the list view displays the expected information!

    With the above steps, you are all set to begin utilizing the new functionality. A couple notes towards understanding this feature:
    • This will only display data on records created or saved after the field is created. 
    • While the example above deploys the field to the list view, you can also deploy the field to any other available view in the module.
    • If you implement a significant number of calculated fields using related formulas on a module, you can negatively impact the performance when saving or mass updating records as these formulas need to perform backend calls to the other module(s) to retrieve and update the data.
    • Using these calculated fields is best done when you are only expecting a singular relationship to exist between the two modules. For instance, if I created a call with 2 leads as an attendee on the same call, then the account name retrieved by the formula would be arbitrary. If you need to pull specific data from a related record when other related records may also exist from the module, a custom logic hook is recommended.
    I hope this helps and please let me know if you have any questions!

    Kind regards,

    Chris
Reply
  • Hi reluctant data and Paul,

    The functionality you are looking to achieve can be easily achieved with Sugar Logic which is a formula-based engine akin to Excel formulas. Since Paul's example is looking for a specific use, I will highlight his use case in the steps to achieve this functionality:
    1. Go to Admin > Studio > Calls > Fields > Add Field
    2. Create a text field called lead_account_name and on that field creation screen, check the 'Calculated Value' box and then 'Edit Formula':

    3. A formula builder window will pop up and on that pop-up, click the 'Related Field' button.
    4. Once that is clicked, set the module to 'Leads' and the field to 'Account Name', and then click 'Insert'

    5. This action will automatically create the necessary formula into the builder and then you can click 'Save' to return to the field creation.
    6. Click 'Save' again to finalize creating your field
    7. Remaining in Studio, go to Calls > Layouts > List View
    8. Locate the newly created field in the far right column and drag it over to the desired location in the first column labeled 'Default'.

    9. Click the 'Save & Deploy' button to publish the new layout.
    10. Create a call associated to a lead and see that the list view displays the expected information!

    With the above steps, you are all set to begin utilizing the new functionality. A couple notes towards understanding this feature:
    • This will only display data on records created or saved after the field is created. 
    • While the example above deploys the field to the list view, you can also deploy the field to any other available view in the module.
    • If you implement a significant number of calculated fields using related formulas on a module, you can negatively impact the performance when saving or mass updating records as these formulas need to perform backend calls to the other module(s) to retrieve and update the data.
    • Using these calculated fields is best done when you are only expecting a singular relationship to exist between the two modules. For instance, if I created a call with 2 leads as an attendee on the same call, then the account name retrieved by the formula would be arbitrary. If you need to pull specific data from a related record when other related records may also exist from the module, a custom logic hook is recommended.
    I hope this helps and please let me know if you have any questions!

    Kind regards,

    Chris
Children
  • ...can negatively impact the performance when saving or mass updating records 
    (includes importing via wizard and updating/creating via the API).
    Any other inputs on calc fields / logic hooks /  workflow impacts on performance?
  • Your solution seems so easy, BUT when I go to the formula builder, the module that has the fields I need is not listed.  I see many others, but not the one I need.  I tried to fake the formula by adding one to see the format, which turns out to be:
    related($opportunities,"date_entered")

    I changed it to the right module name and field label but when I click save, it says UNKNOWN FIELD: MEETINGS (meetings is the module that is not appearing on the list).  I know I have the actual field name correct since I compared the format to one that does work, so it must still be complaining about the module name.

    Next, I poked around looking for any screen that might show a list of modules associated with the one I am trying to edit.  The relationships do not match what I see  as available modules, nor does any other list.  It is as though the Meetings module is just hidden somehow.

    If you or anyone has any extra advice on how to make a module appear on the list, I welcome it.
  • Hi reluctant data,

    Is the module you are trying to inject this field into a custom module or a stock module? If it is custom, did you build the module through Module Builder or install it from a third party? If you created a direct relationship to Meetings or the "Activities" suite of modules via Studio or Module Builder, then the relationship should be available for selection in the formula builder.

    The modules that appear in the dropdown are based off the established relationships recognized between two modules so the absence of Meetings would likely indicate that either a direct relationship does not exist between the two modules or the relationship is not properly defined. If you go to Admin > Studio > {Module Name} > Relationships, you should see Meetings listed as a related module like the following:

    Or:


    Kind regards,

    Chris
  • Great point about the impact towards importing and API calls as well! In general, logic hooks are seen as a more scalable and better performing solution when looking to interact with a large amount of data between modules.
  • Yes, I was about to post an "OOPS, I found the relationship I needed" message.  I compared one that WAS working to the one that was not to find my mistake.  Thank you so much!
  • Hi Chris,

    As you said as part of your answer “This will only display data on records created or saved after the field is created.” Unfortunately you are correct!  Is there any way to get this to work on existing records? I am working to a 31 Dec deadline and need to create a contact list using this added feature. Maybe there is a way to do a bulk edit and save on all of my contacts? Your help and direction would be very much appreciated.
  • Hi John,

    Our public KB article on the intro to Sugar Logic covers this scenario. In short, yes, you can use the Mass Update function to update records. Depending on how many records you have to update, this may become a time intensive process and in some cases, it may exceed the server limits if you try to update too many records at once. If you have thousands of records to update, it may be better to create a checkbox field in the module that you can mass update and filter records via that checkbox field. For example, once the field is created, filter the list view by all records with that field unchecked. Select ~1000 records and mass update them to have the field checked. Once the mass update completes, those records will have their calculated field updated and they will no longer return in the filtered list view.

    Another route you could take is to update all of your records via the REST API if you have the appropriate knowledge. This would allow you to run a process behind the scenes rather than working through the UI.

    Please let me know if you have any questions.

    Kind regards,

    Chris
  • Hi Chris,

    Thanks for your post. As I was reaching out to you I also opened up a Case. SugarCRM Support was able to update all the existing fields by doing the following: "I (SugarCRM Support) went ahead and updated the calculated fields by adding the division field to the filters and sorting all the empty results. I then used the actions menu to run a 'Recalculate Fields' on the needed contact records." I do not fully understand what they did but it did work. Can you shed some light on what they did?
  • John,

    My name is Mike and I was the one you were working with to get this recent update taken care of.  I just wanted to chime in and expand on what I did a bit.  

    First I added your custom field (division) to the existing filters available.  I did this by going into the studio section of Sugar through Admin > Studio and selecting the module that contained the custom field; in this case, Contacts.  Once there I selected layouts, and then Search layout.  Adding the custom field to this layout makes it available as an option to filter by when looking at the listview of your contacts module.  This process can be found here: http://support.sugarcrm.com/02_Documentation/01_Sugar_Editions/01_Sugar_Ultimate/Sugar_Ultimate_7.2/...

    Once I had the field you wanted updated as something I could filter by, I organized the records by all blank divisions first by clicking on the header/column title.  

    I then selected all the records and clicked the action menu > Recalculate Values which of course ran into the limit problem, but addressed the first thousand records which were the records that needed a value as they were blank.  That brought the number of records needing updated down to around 500.  I repeated this same process, thus updating the remaining records appropriately.  

    I hope this helps to clear things up a bit.  Let me know if you have any additional questions.

    Thanks!

    Mike Majoris
  • Raffle,

    I see how this can be done, however, what I'd like to accomplish is to have a standard field listed in the Lead module also appear in the Companies module without using a calculated field - since it prevents me from editing that field - which I want to do in either object.  The standard field is account_description, which in the lead object is called Company Description, but in the companies object - it is simply description (which is also a standard field).  I want to be able to move information over from lead to companies object with both these fields.  so how can I insert a standard out of box field to a different object without created a custom field?