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

  • Jeff:

    I have an ASP page which contains multiple blocks. The code in my page is pretty much "spot on" with the code example above in regards to the layout. I am using different entities. Therefore, of course, I am referring to different entities. :-)

    Everything with the page appears to work as desired EXCEPT when I hit the change button to edit the data in the blocks, for any of the fields that contains a date, the date picker is missing. For a date/time field the datepicker for the date is missing. However, the box that allows you to select the time is there.

    I am guessing that I either need to add something to my ASP page or to the custom content of each of my blocks to get the datepicker to display when in EDIT. However, I am not sure how to go about doing that.

    I tried adding this to the custom content area of one of my Blocks and then attempted to edit the page. However, the datepicker was still not there.

    Using this post, I did some additional research. community.sagecrm.com/.../32732.aspx

    The only reference I have in my page is this

    Therefore, I don't think that I am calling the JQuery library twice. However, something could be blocking the code.

    If you can push me in the right direction, I would greatly appreciated it.

    Thanks! Michele

  • Sage CRM's workflow will only work when an entrygroup block uses record object in the execute method parameter.

    The record object can be based on a view e.g.

    myRecord = CRM.FindRecord("opportunity, vsummaryopportunity", WhereClause);

    CRM.AddContent(myBlock.Execute(myRecord));

  • Thanks for this Jeff. How would I use this in conjunction with workflow? If I wanted workflow I would have to do something like CRM.AddContent(myBlockContainer.Execute("Opportunity")); - the trouble is if I do this, all of the other blocks will stop working (in fact, the whole page will stop working).