Controlling Default Values in Search Screens

A customer had an issue. Their sales team used the Lead and Opportunity features extensively. Each day many leads were created in the system but the sales team members were getting annoyed that as they searched for the new leads through the main search page they were being distracted by those leads that had already either been converted to opportunities or had been closed as being dead ends.

One of the sales managers was adamant that they wanted the old leads deleted after they had been converted to opportunities so their people didn't waste their time on starting to investigating old and cold suspects. But marking the old lead data is a bad idea. This is because the records would be suppressed not just from the search screens but from the easy ability to report on them. If management wanted to report in the future on performance indicators such as how many leads where created each month, or how many were converted to opportunities or lost this would be made difficult. There is also a link from the opportunity back to the originating lead so all sorts of upsets might be created by deleting the old leads.

That leaves us with the question. "How can it be made easier for the sales people only to search within the leads still in progress?"

There are a number of things that can be done.

  • A set of 'saved searches' and dynamic groups based on the lead table that only return the leads that are 'In Progress'.
  • Interactive Dashboards could be created for the Sales Team members to use that surfaced only the active Leads. The integration of the workflow function within List gadgets means that a user can work directly on the leads. See the article "Using an Advanced Find as a Data source for a List Gadget" for a discussion on how Interactive Dashboard gadgets can display exactly the data you need.

But the heart of the problem is that the sales people only want to search by default on 'In Progress' Leads; this can done this very easily by changing the way that they search.

In a default system

  • Lead_status is either
    • In Progress
    • Opportunity
    • Closed
  • Lead_stage is one of the following values
    • Assigned
    • Contacted - Awaiting Reply
    • Converted
    • NewLead
    • Rated

The Lead_stage values are set by workflow and would not change when a lead is converted to an opportunity. This means it is the Lead_status field values that are key.

For example in Sage CRM the following client side code can be added to the Custom Content box of the LeadSearchBox

[code language="javascript"]


The script will make sure that the lead_status field is set default to 'In Progress' when even anyone enters the search screen. It can be changed by the user to allow them to search for leads that have that have the lead_status 'Opportunity' or 'Closed' or even to search for 'all'.


A system administrator could try and use a create script and add

DefaultValue='In Progress'

but because the DefaultValue property is really designed for screens inserting data rather than searching for data the 'default value' can be lost when a user moves backwards and forwards through the screens or clears the search box with the clear button.

See the previous article "Field Level Scripting in Search Screens" for more discussion on implementing business rules in search screens.

  • Gopal

    Try this

    The script will check is the field is set to '--All--' and if it is will change the default search value, but if it is then changes to another value it leaves that in and does not overwrite it.

    Search select advanced fields are problematic in Search screens generally. What ERP is integrated with your Cloud instance?

  • Hi Jeff,

    Thanks for the above post. I have tried the custom script exactly a year after your post. I used the exact script in cloud 2014R2 in company search screen for 'comp_status' to Active. When I open the search screen, the status field is defaulted to 'Active' which is good, but when I change the field to other option like 'Closed', I get the results but the status field goes back to 'Active' option even though the results are for status 'Closed'. I think this (mystatus.getMode()=="edit") is not working.

    Also on the same page, I have an SSA field in the same search page which has databases from ERP integration. How do I put a default to that field so the users can have the search page ready with status 'Active' and SSA database field set to a particular db?

    Many thanks Jeff