function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vijendharvijendhar 

hide account records in Global search whose Active__c= no

Hi,
I need to hide account records in Global search whose  Active__c= no , can any one share idea about it?
ManojjenaManojjena
Hi Vijendhar,

I don't think it is possible in global search .We don't have control over it .May be you can raise a case to salesforce to do somsthing for which you can achive this .

Let me know if you get any solution for this .

Thanks 
Manoj
Rahul SharmaRahul Sharma
If your OWD setting for Account is private, you can share active Account records with respective users, Do not share otherwise.
This could be an option!
Amit Chaudhary 8Amit Chaudhary 8
Hi Vijendhar,

You can try APEX sharing for same.
trigger Test_Share on Test__c (after insert) {

 if(trigger.isInsert){

 /**
 * Test_Share is the "Share" table that was created when the Organization Wide Default
*  sharing setting was set to "Private". Allocate storage for a list of Test_Share
* records.
 **/
 List<Test_Share> jobShares = new List<Test_Share>();

 /** For each of the Test records being inserted, do the following: **/
 for(Test__c t : trigger.new){

 /** Create a new Test_Share record to be inserted in to the Test_Share table. **/
 Test_Share studentRecord = new Test_Share();

 /** Populate the Test_Share record with the ID of the record to be shared. **/
 studentRecord.ParentId = t.Id;

 /** Then, set the ID of user or group being granted access. In this case,
 * we're setting the Id of the student__c that was specified by the Test
 * Result in the student__c lookup field on the Test record.
 **/

 studentRecord.UserOrGroupId = t.student__c;

 /** Specify that the Student should have edit access for this particular Test record. **/
 studentRecord.AccessLevel = 'edit';

 /** Specify that the reason the Student can edit the record is because its his test result
 * (Student_Access__c is the Apex Sharing Reason that we defined earlier.)
 **/
 studentRecord.RowCause = Schema.Test_Share.RowCause.Student_Access__c;

 /** Add the new Share record to the list of new Share records. **/
 jobShares.add(studentRecord);
 }

 /** Insert all of the newly created Share records and capture save result **/
 Database.SaveResult[] jobShareInsertResult = Database.insert(jobShares,false);
 }
}



https://developer.salesforce.com/page/Using_Apex_Managed_Sharing_to_Create_Custom_Record_Sharing_Logic
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_creating_with_apex.htm
http://blog.jeffdouglas.com/2009/11/25/programmatically-creating-sharing-rules-with-apex/
http://www.jitendrazaa.com/blog/salesforce/apex-based-sharing-in-salesforce/

Please let us know if this will help you