Example of a Complex Screen editing multiple records in ASP

Less than one minute read time.

I have written before about the creation of a complex screen where the ASP page offers the user the ability to edit two records at the same time.

See: https://community.sagecrm.com/blogs/hints_tips_and_tricks/archive/2007/10/01/creating-complex-screens-using-the-com-based-asp-api.aspx

This code is another example that shows how a screen can be created that allows editing of the Company, Address and default Contact details all at once.

Code Starts


<%

CRM.AddContent(CRM.Mode);
var intRecordId = CRM.GetContextInfo("company","comp_companyid");
var recCompany = CRM.FindRecord("company","comp_companyid="+intRecordId);
var recAddress = CRM.FindRecord("address","addr_addressid="+recCompany.comp_primaryaddressid);
var recPerson = CRM.FindRecord("person","pers_personid="+recCompany.comp_primarypersonid);

var companyBlock = CRM.GetBlock("companyboxlong");
companyBlock.ArgObj = recCompany;
companyBlock.Title = CRM.GetTrans("tabnames","company");

var addressBlock = CRM.GetBlock("addressboxshort");
addressBlock.ArgObj=recAddress;
addressBlock.Title = CRM.GetTrans("tabnames","address");

var personBlock = CRM.GetBlock("personboxshort");
personBlock.ArgObj=recPerson;
personBlock.Title = CRM.GetTrans("tabnames","person");

var myBlockContainer = CRM.GetBlock("Container");
with (myBlockContainer)
{
AddBlock(companyBlock);
AddBlock(addressBlock);
AddBlock(personBlock);
}

CRM.AddContent(myBlockContainer.Execute());
Response.Write(CRM.GetPage());
%>

Code Ends