Copying Favorites from One User to Another

Does anyone know of a shortcut to copy one user's favorites records on a module to another user? IE: if John has favorited by hitting the star on 36 accounts and his manager wants those same 36 accounts favorited without hitting the star 36 times, is there a way?

  • Hi  ,

    Sugar does not provide a native feature for copying record favorites from one user to another. The only way you would be able to achieve this currently is by copying the records for a given user in the sugarfavorites database table. The query to copy the records would look something like this to copy all favorites from one user to another for the Accounts and Contacts modules:

    INSERT INTO sugarfavorites (
        id,
        name,
        date_entered,
        date_modified,
        modified_user_id,
        created_by,
        assigned_user_id,
        description,
        deleted,
        module,
        record_id,
        sync_key
    ) SELECT 
        UUID(),
        name,
        '2024-05-23 13:44:00',
        '2024-05-23 13:44:00',
        '<user ID of the user you want to copy favorites to>',
        '<user ID of the user you want to copy favorites to>',
        '<user ID of the user you want to copy favorites to>',
        description,
        deleted,
        module,
        record_id,
        sync_key
    FROM sugarfavorites 
    WHERE
        assigned_user_id = '<user ID of the user you want to copy favorites from>' AND
        deleted = 0 AND
        module IN ('Accounts','Contacts');

    Chris

  • Hi Chris, I appreciate this information and the detailed information on the query. I now understand Sugar does not have that capability out of the box and I would run a query. I have no idea how to do that. Where would you recommend, I start to learn how to do this from start to finish?

  • Hi  ,

    If you are running Sugar in SugarCloud, then you do not have access to directly run database queries. If these are one-off requests, your most efficient means of having this type of query run is create a support ticket with the Sugar Support team and provide them the exact query you want to run. If this is going to be a frequent need, then you may want to consider having a custom feature built where you select the users and module(s) to copy favorite selections, which in turn, performs the approriate database query based on those selections. We specialize in building custom Sugar solutions, so if you would like a quote on building this feature, please contact us via our site.

    Chris

  • Perhaps there is another way to achieve the same.
    John may be asked to set a Tag with Mass Update to all of they Favorite records so that a manager could also filter them - by very that Tag

    John:

    Manager:

    Best Regards,
    Dmytro Chupylka

    integroscrm.com
    We make work in Sugar CRM system faster, more convenient and efficient