In an earlier article I showed how you could create a complex screen that allowed the editing multiple records in ASP. The actual example was the editing of a Company, Person and Address record all together.
You can find this discussed in the article "Example of a Complex Screen editing multiple records in ASP".
But how do you create a record of two or more different entities at once? Can we build our own version of the Company Entry screen?
The answer is yes we most certainly can! The code below is a partial rebuild only, as it doesn't cover the creation of the email and phone records. Be careful with those as actuall denormalisation back into the company and person records is required.
<!-- #include file ="sagecrm.js"-->
var recCompany = CRM.CreateRecord("company");
var recAddress = CRM.CreateRecord("address");
var recPerson = CRM.CreateRecord("person");
var companyBlock = CRM.GetBlock("companyboxlong");
companyBlock.ArgObj = recCompany;
companyBlock.Title = CRM.GetTrans("tabnames","company");
var addressBlock = CRM.GetBlock("addressboxshort");
addressBlock.Title = CRM.GetTrans("tabnames","address");
var personBlock = CRM.GetBlock("personboxshort");
personBlock.Title = CRM.GetTrans("tabnames","person");
var myBlockContainer = CRM.GetBlock("Container");
recCompany.comp_primaryaddressid = recAddress.addr_addressid;
recCompany.comp_primarypersonid = recPerson.pers_personid;
var recPersonLink = CRM.CreateRecord("person_link");
recPersonLink.peli_personid = recPerson.pers_personid;
recPersonLink.peli_companyid = recCompany.comp_companyid;
var recAddressLink = CRM.CreateRecord("address_link");
recAddressLink.adli_addressid = recAddress.addr_addressid;
recAddressLink.adli_companyid = recCompany.comp_companyid;
recAddressLink.adli_personid = recPerson.pers_personid;
An article that discusses the creation of default Address and Persons for a Company is How do default addresses and persons get created for a Company?
An article that discusses the phone and email records is Email and Phone Numbers in CRM.