How can I build a multiblock edit screen?

1 minute read time.
I was recently asked about how to handle the problem of having multiple screen blocks on the same page than when you attempt to move the page to edit mode you get a nasty locks message.

The problem occurs because both blocks are attempting to place an entry in the locks table to reserve editing rights on the record when only one of them needs to create the lock.
You can see in the example code below I have used the CheckLocks property to control this:
/////////////////////////////////////////////////////
;

//This is used in pages which are linked to from list custom jump.
var strKeyID= "oppo_opportunityid";
var Id = new String(Request.Querystring(strKeyID));
var intRecordId = 0;
if (Id.indexOf(",") > 0)
{
var Idarr = Id.split(",");
intRecordId = Idarr[0];
}
else if (Id != "")
{
intRecordId = Id;
}

var myRecord = CRM.FindRecord("opportunity","oppo_opportunityid="+intRecordId);
var WebPickerBlock = CRM.GetBlock("OpportunityWebPicker");
WebPickerBlock.Title = eWare.GetTrans("WebPicker","for");

var DetailBlock = CRM.GetBlock("OpportunityDetailBox");
DetailBlock.Title = CRM.GetTrans("Tabnames","details");
DetailBlock.CheckLocks = false;

var myBlockContainer = CRM.GetBlock("Container");
with (myBlockContainer)
{
AddBlock(WebPickerBlock);
AddBlock(DetailBlock);
}

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