cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Pushing a Saved Search out to Users from the Admin in Windchill 12.1

ToddWoodall
11-Garnet

Pushing a Saved Search out to Users from the Admin in Windchill 12.1

Does anyone know of a way to push out a saved search to users without them having to show the search?

 

ACCEPTED SOLUTION

Accepted Solutions

Hi Todd,

We can set administratively created searches to show by default using LoadFromFile.  It just isn't documented/supported by PTC, and it is a bit convoluted and tedious.  Validate this technique in a non-production environment first.

 

Pre-requisite: Saved searches must be created by an administrator and exposed as a global search to make them visible to the appropriate users.
 
For each user, we need to know what saved searches they already have and the identity of the new saved search.  This DB query lists saved search creators, the search names, and their idA2A2 values.

 

 

select wt.fullName as 'Search Creator', sq.name as 'Search Name', sq.idA2A2 as 'csvvalue' from WTUser wt, SavedQuery sq where wt.idA2A2=sq.idA3A4;

 

 
Note: If there are a lot of users, the above query can be expanded to write the out the loadFromFile syntax below, adding the new saved search to the beginning or end of the list.
 
Exposed Saved Searches are defined by a personal preference.  Use a load file (userSavedSearches.csv) to mass update the saved searches preference.

 

 

# Load preference instance for saved search
#PreferenceInstance~create~wt.preference.LoadPreference.createPreferenceInstance~name~containerClass~containerName~organization~parentContainerPath~user~clientName~value~lock~lockOnly
#PreferenceInstance,name,containerClass,containerName,organization,parentContainerPath,user,clientName,value,lock,lockOnly
#PreferenceInstance,{preference internal name},,,,,{username},WINDCHILL,{pipe separated list of saved search idA2A2 values, see above notes},,
PreferenceInstance,/com/ptc/windchill/enterprise/search/savedSearches,,,,,mjones,WINDCHILL,1076740|67628,,

 

 

Convert to load file:
windchill wt.load.util.CSV2XML -input userSavedSearches.csv -root D:\PTC\wtSchema\SavedSearches
 
Resultant XML file (required fields)

 

 

<?xml version="1.0" ?><!DOCTYPE NmLoader SYSTEM "standardX26.dtd">
<NmLoader>
<csvPreferenceInstance handler="wt.preference.LoadPreference.createPreferenceInstance" >
    <csvname>/com/ptc/windchill/enterprise/search/savedSearches</csvname>
    <csvuser>mjones</csvuser>
    <csvclientName>WINDCHILL</csvclientName>
    <csvvalue>1076740,67628</csvvalue>
</csvPreferenceInstance>
</NmLoader>

 

 
Replace pipe with comma before loading:
windchill wt.load.LoadFromFile -d D:\PTC\wtSchema\SavedSearches\userSavedSearches.xml -u wcadmin -p wcadmin
 
Note: Must close browser and log in as use to refresh saved search display.

View solution in original post

2 REPLIES 2

Hi Todd,

We can set administratively created searches to show by default using LoadFromFile.  It just isn't documented/supported by PTC, and it is a bit convoluted and tedious.  Validate this technique in a non-production environment first.

 

Pre-requisite: Saved searches must be created by an administrator and exposed as a global search to make them visible to the appropriate users.
 
For each user, we need to know what saved searches they already have and the identity of the new saved search.  This DB query lists saved search creators, the search names, and their idA2A2 values.

 

 

select wt.fullName as 'Search Creator', sq.name as 'Search Name', sq.idA2A2 as 'csvvalue' from WTUser wt, SavedQuery sq where wt.idA2A2=sq.idA3A4;

 

 
Note: If there are a lot of users, the above query can be expanded to write the out the loadFromFile syntax below, adding the new saved search to the beginning or end of the list.
 
Exposed Saved Searches are defined by a personal preference.  Use a load file (userSavedSearches.csv) to mass update the saved searches preference.

 

 

# Load preference instance for saved search
#PreferenceInstance~create~wt.preference.LoadPreference.createPreferenceInstance~name~containerClass~containerName~organization~parentContainerPath~user~clientName~value~lock~lockOnly
#PreferenceInstance,name,containerClass,containerName,organization,parentContainerPath,user,clientName,value,lock,lockOnly
#PreferenceInstance,{preference internal name},,,,,{username},WINDCHILL,{pipe separated list of saved search idA2A2 values, see above notes},,
PreferenceInstance,/com/ptc/windchill/enterprise/search/savedSearches,,,,,mjones,WINDCHILL,1076740|67628,,

 

 

Convert to load file:
windchill wt.load.util.CSV2XML -input userSavedSearches.csv -root D:\PTC\wtSchema\SavedSearches
 
Resultant XML file (required fields)

 

 

<?xml version="1.0" ?><!DOCTYPE NmLoader SYSTEM "standardX26.dtd">
<NmLoader>
<csvPreferenceInstance handler="wt.preference.LoadPreference.createPreferenceInstance" >
    <csvname>/com/ptc/windchill/enterprise/search/savedSearches</csvname>
    <csvuser>mjones</csvuser>
    <csvclientName>WINDCHILL</csvclientName>
    <csvvalue>1076740,67628</csvvalue>
</csvPreferenceInstance>
</NmLoader>

 

 
Replace pipe with comma before loading:
windchill wt.load.LoadFromFile -d D:\PTC\wtSchema\SavedSearches\userSavedSearches.xml -u wcadmin -p wcadmin
 
Note: Must close browser and log in as use to refresh saved search display.
Announcements


Top Tags