Action buttons on Custom Entity Find Screens

1 minute read time.
Below is a picture of the Company Find screen.. This is the standard system screen. But can this screen be duplicated for new entities such as "Project". The answer is very nearly yes.


In the code for a Project Find screen that I have presented here you should be able to see some of the items that I have added. The difficult behaviour to add are the Action buttons on the right hand side of the screen.

I have used a mode check to ensure that they only display when the search results are shown.

But will the actions work? Although the action buttons that are added in the code below call the same behaviour as the inbuilt system actions, these actions do not make sense in a custom entity and the buttons would probably be better off calling ASP pages which then offer a full scope of custom behaviour. You should be able to adapt the code below to call custom ASP pages.
var projectsearchbox = CRM.GetBlock("projectsearchbox");
with(projectsearchbox)
{
Title = CRM.GetTrans("tabnames","search");
showSavedSearch = true|false;
}
var projectgrid = CRM.GetBlock("projectgrid");
//create buttons
var strURL = "";
strURL = "javascript:document.EntryForm.em.value='6';";
strURL += "document.EntryForm.submit();";
var strSearchFormClearButton = CRM.Button("Clear", "clear.gif", strURL);
var helpFile = "SalesOppos.html";
strURL = "../help/main%20menu/wwhelp/wwhimpl/js/html/wwhelp.htm?href=";
var strCustomHelpButton =CRM.Button("Help", "help.gif", strURL+helpFile, "", "","eware_help");
strURL = "javascript:document.EntryForm.TargetAction.value = 'NewDocument';document.EntryForm.submit();"
var strMergeButton = CRM.Button("NewDocument", "new.gif", strURL);
strURL = "javascript:document.EntryForm.TargetAction.value = 'NewDocument';document.EntryForm.submit();"
var strTaskButton = CRM.Button("NewTask", "newtask.gif", strURL);
strURL = "javascript:document.EntryForm.TargetAction.value = 'NewDocument';document.EntryForm.submit();"
var strEmailButton = CRM.Button("SendEmail", "sendemail.gif", strURL);
strURL = "javascript:document.EntryForm.TargetAction.value = 'NewDocument';document.EntryForm.submit();"
var strExportButton = CRM.Button("Export", "list.gif", strURL);
var myBlockContainer = CRM.GetBlock("Container");
with (myBlockContainer)
{
AddBlock(projectsearchbox);
AddBlock(projectgrid);
AddButton(strSearchFormClearButton);
AddButton(strCustomHelpButton);
if (CRM.Mode==Save)
{
AddButton("");
"+CRM.GetTrans("GenCaptions","Actions")+":

AddButton(strMergeButton);
AddButton(strTaskButton);
AddButton(strEmailButton);
AddButton(strExportButton);
AddButton("");
}
}
projectgrid.ArgObj = projectsearchbox;
CRM.AddContent(myBlockContainer.Execute());
Response.Write(CRM.GetPage("find"));
  • Jeff, are there system parms or global variables for the find screens order and critera that is saved somewhere when a user clicks on the Find button for the Company.

    I noticed that when the user comes back to the Find screen, their sort order, and search criteria are saved. I'd like to investigate the custom action based on this "sort and search criteria". If I can get to the "what were they looking for and what order", then I can create a custom action that will know what the list results were when they clicked find. Thanks in advance!!

  • Jeff, you code is missing a some detail. Your TargetAction for all the buttons is the same. If I use TargetAction.value = 'ExportToFile' with a custom entity, it exports be the counter that shows the number of record says contacts and not the entity I'm using. Then it goes to a Export Group - Temporary Saved Search screen that I have to cancel. Then it gets lost.

    Any more info on this would be greatly appreciated. Ken