If you have been working with Self Service then you know that certain field entrytypes are not rendered in the same way in Self Service screens as they are in the main application extension ASP pages.
These oddly behaving fields or entrytypes include Date, DateTime and Search Select Advanced fields. Typically the display of the information is not the problem but rather the update of the field. "The search select doesn't work or the popup calendar doesn't appear".
The features that are available in application extension ASP pages are just not there for Self Service because of the different architecture and authenication used in the pages.
Below is some example code that shows how in a Self Service Page we can workaround the limitations and force in the behaviour we want.
Note: This is a very simple example that only provides a drop down box instead of a Search Select Advanced but it does illustrate how we can change the behaviour of a field in edit mode.
Note: If you are working with Self Service pages the object that the ewaress.js include file instantiates is the "eWare" object. The code snippets and resources provided alias the object to be called "CRM". Using an object name of "CRM" rather than "eWare" is the standard for coding in the COM API in Sage CRM. But for the sake of backwards compatibility and to avoid confusion the code below still refers to "eWare" not "CRM".
if (eWare.Mode==View)
{
eWare.Mode =Edit;
}
var leadcustomscreenBlock = CRM.GetBlock("leadcustomscreen");
var leadcompanyscreenBlock = CRM.GetBlock("leadcompanyscreen");
var leadpersonscreenBlock = eWare.GetBlock("leadpersonscreen");
var LeadAddressScreenBlock = eWare.GetBlock("LeadAddressScreen");
if (eWare.Mode==Edit)
{
////////////////////Sort out WaveItem lookup //////////////////////////
var customAppDataSelectionEntryBlock = leadcustomscreenBlock.GetEntry("lead_waveitemid");
var CustomField = "<select class='EDIT' size='1' name='lead_waveitemid'>";
var WaveItemsRecords = eWare.FindRecord("waveitems","wait_deleted is null");
WaveItemsRecords.OrderBy = "wait_name";
while (!WaveItemsRecords.eof)
{
CustomField+="<option value=''>"+WaveItemsRecords.wait_name+"</option>";
WaveItemsRecords.NextRecord();
}
CustomField +="</select>";
with(customAppDataSelectionEntryBlock)
{
ReadOnly = true;
NewLine = false;
Caption = eWare.GetTrans("ColNames","wait_Name")+":
"+CustomField;
}
///////////////////////////////////////////////////////////////////////
}
var myRecord = eWare.CreateRecord("lead");
var myBlockContainer = eWare.GetBlock("Container");
with (myBlockContainer)
{
AddBlock(leadcustomscreenBlock);
AddBlock(leadcompanyscreenBlock);
AddBlock(leadpersonscreenBlock);
AddBlock(LeadAddressScreenBlock);
}
Response.Write(myBlockContainer.Execute(myRecord));
if (eWare.Mode==Save)
{
Response.Write("Record Entered");
}
The change that I have made here for a Search Select Advanced field can be carried out for a Date field. There are plenty of example scripts freely available that can be used to enhance the Date field behaviour in Self Service pages.