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"));
Parents Comment Children
No Data