Execution of container blocks in COM API

By | October 19, 2010

We all developers are aware of a method Container.Execute(), We use this standard command to execute the container containing our blocks populated from Metadata. Talking on this subject may not be much wise thing to done as The container execution is the basic development practice. So much has been discussed and blogged on this topic till date; still I would like to quickly summarize the concept.

The Container.Execute uses a method inherited from the eWareBlockObject. Execute performs the block action and returns the displayed screen, which is passed as
a parameter to eWare’s AddContent function. Execution of container doesn’t necessarily need to be at the end of the page, it can be kept anywhere as per the requirement.

If we have single screen block or list block, the most common way we follow to display the same is to get the recordset, Add list block to container and then execute the container at the end like.

eWare.AddContent(Container.Execute())

Can I use ArgObj property here? The answer is Yes. You can attach recordset to list or screen block as given below and then you can also execute container without passing parameters as given below.

BlockList.ArgObj=
eWare.AddContent(Container.Execute())

Now why do I need to use ArgObj and play with standard features? Because, it makes our life easy when we have more than 2 blocks inside page and all of them coming from different tables. Consider the scenario where we want to show Person summary, Person’s communication list as well as Person’s cases list on the same page. We can simply have our 3 recordset and attach them with blocks as given above. Now as all these blocks are added to container as soon as we perform container execution at the end the blocks are executed with no problem at all. It saves us lots of time in handling navigation and URL crashing issues.

One more thing to be noted is, when container is executed with recordset, no save action can be performed at the database level afterwards using same recordset used in container. If we want to do the same we may need to use SaveChanges() method or either you can assign field values before executing container in the end.

For queries regarding the functionality, please feel free to drop us an email at crm@greytrix.com.