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?

Parents
  • 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

Reply
  • 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

Children
No Data