Admin adding filters to users account

Does anyone have a way to mass add/save filters to users accounts without logging into their account ?

1 Like

Check out the saved_search table on MySQL, you can do it there.

First create the Saved Search in the normal SuiteCRM app. Then go into MySQL and copy that row, with a new “assigned_user_id” for each user you want.

And here’s some SQL I just developed to “multiply” a saved_search from one user to all users.

Backup your table before you begin, handling SQL directly can sometimes be deadly to your data…

	
INSERT INTO `saved_search`       
(
`id`, `name`, `search_module`, `deleted`, `date_entered`, `date_modified`,      `assigned_user_id`, `contents`, `description`
)
SELECT 
  CAST(FLOOR(RAND()*10000000) AS char(36)) `id`, 
  `name`, `search_module`, `saved_search`.`deleted`, `saved_search`.`date_entered`,   `saved_search`.`date_modified`, `users`.`id`, `contents`, `saved_search`.`description`

FROM `saved_search`, `users`

WHERE `saved_search`.`id` = "8ac557c0-4753-9d75-dae2-595e07334efe"
      AND saved_search.assigned_user_id <> users.id

Replace that “8ac557c0-4753-9d75-dae2-595e07334efe” with whatever id your search has (or change the WHERE clause to use the saved search “name” if you prefer, as long as there is a single search with that name across all users).

This will create a new saved_search for each user found in the “users” table, by copying the saved_search you specify.

I’ll have to make a blog post with this one day… :slight_smile:

2 Likes

Have you ever came across an OData api for suite?

No, sorry, I don’t even know what it is.

1 Like

Thank a lot

Time Saver.

1 Like