Building a Screen not bound to Metadata using the ASP COM API

1 minute read time.
Partial Rebuild of My Preferences Screen
The code below demonstrates how a page like the Preferences screen can be rebuilt in Sage CRM. This particular screen may be needed to be replaced if the business wishes to offer users only a limited set of preferences that maybe controlled. In the default system the system administrator can either let the user control all their preferences or non of them.

You can learn more about building screens without reference to meta data here:

var intRecordId = CRM.GetContextInfo("user","user_userid");
var myRecord = CRM.FindRecord("usersettings","uset_key='NSet_LoginTo' and uset_userid="+intRecordId);
var myBlock = CRM.GetBlock("entrygroup");
myBlock.Title = CRM.GetTrans("Tabnames","UserPrefsSession");

var customSelectionEntryBlock = CRM.GetBlock("entry");
with(customSelectionEntryBlock)
{
DefaultValue = myRecord.uset_value;
EntryType = 21;
AllowBlank = false;

if (CRM.Mode==View)
{
Caption = CRM.GetTrans("ColNames","NSet_LoginTo")+":
;"+CRM.GetTrans("DefaultToDo",myRecord.uset_value)+"";
}
else
{
Caption = CRM.GetTrans("ColNames","NSet_LoginTo")+":";
}

CaptionPos = CapTop;
FieldName = "Set_LoginTo";
LookUpFamily = "DefaultToDo"
Size = 1;
NewLine = false;
}

myBlock.AddBlock(customSelectionEntryBlock);

CRM.AddContent(myBlock.Execute());
Response.Write(CRM.GetPage());

if(CRM.Mode==Save)
{
//Retrieve Record
myRecord.uset_value = Request.Form("Set_LoginTo");
myRecord.SaveChanges();
Response.Redirect(CRM.URL("myprefs.asp"));
}


The main thing to point out here is the creation of the field when the screen is in VIEW mode.
Parents
  • Mike

    You are spot on. The property EntryType is readonly. The .NET SDK assumes that you are working with system screens. The EntryGroup() class also assumes you are working with existing metadata screens.

    Have a look at the classes in Sage.CRM.HTML namespace. These allow you to create forms and inputs within a .NET screen.

Comment
  • Mike

    You are spot on. The property EntryType is readonly. The .NET SDK assumes that you are working with system screens. The EntryGroup() class also assumes you are working with existing metadata screens.

    Have a look at the classes in Sage.CRM.HTML namespace. These allow you to create forms and inputs within a .NET screen.

Children
No Data