Pass Account ID from Account TI to Custom QC in Custom Tab
Here I am going to detail the steps to pass the Account ID from the Account TI screen to the Quick Create of a Custom Business Object. The instances in the Custom Business Object can be created from a new tab in Account TI added through an Embedded Component and only the instances related to the current Account will be visible. It’s an easy thing to achieve but requires quite a number of activities to be done. So let’s start with the steps……
Step1: Create the Custom BO
Create your custom BO “ZTestBO” as required and add the Account ID as one of the elements.
Step 2: Create the screens for Custom Business Object and Embedded Component.
Step3 : Add Business Object elements to Embedded Component
Add Advanced List Pane to the Embedded Component to add the desired fields from ZTestBO.
Step 4: Configure the Inport, Query and New button in Embedded Component
In Embedded Component DataModel tab, right click on the Root and add a Structure “InportParameter” and a DataField “AccountID” inside the structure.
Create an Inport and add a Parameter named “AccountID” and bind to the newly created DataField. This DataField will hold the value of Account ID sent by the Outport of Account TI screen.
Create a Query in the Embedded Component and select the corresponding DataList and bind the QueryByElements of ZTestBO. Click on the ZAccountID field in the QueryByElements and click on Add Parameter.
Bind the ZAccountID to the DataField “AccountID”. In this way we will be able to see only those instances from the ZTestBO in the Advanced List Pane which belong to the current Account which is open.
When the Query is created, an Event Handler is automatically created which executes the DefaultSet.
Assign the same Event Handler to the Inport that was created in previous step. Also set the RequestAutoRefire and RequestFireOnInitialization properties to True.
Enable the Toolbar for the Advanced List Pane in the Embedded Component and add a New button. Go to DataModel tab, select the ZTestBOInternalID in the DataList and in the properties set the ThingType Mode as “Static”. Select the Associated Thing Type as your ZTestBO’s TT from dropdown.
Set the following properties for the New button.
Associated ThingType Container: Bind to ZTestBOInternalID from the DataList
Step 5: Configure Quick Create Inport
In the Quick Create, add a parameter named AccountID to the already existing Inport “QuickCreate”. Bind the parameter with the ZTestBO element “ZAccountID”.
This parameter will be used to get the Account ID from the Embedded Component. For that we need to add an Outport to the Embedded Component which will pass the Account ID to Quick Create.
Step 6: Configure Outport in Embedded Component
In the Embedded Component, add an Outport. Select the PortType Package as shown below which should be the same as the Inport of QC.
Select the PortType Reference as ThingNavigation which is also same as QC. Add a parameter named AccountID. The name of the Parameter should be same as QC parameter. The Key is bound to the Alternative Key i.e., ZTestBOInternalID of the ZTestBO and the AccountID is bound to the DataField “AccountID”.
Step 7: Assign Inport and Outport to New Button
The Outport of Embedded Component and Inport of QC needs to be used in the Properties of New button so that whenever the new button is clicked the Outport from EC will send the Account ID to the Inport of QC.
Step 8: Add Embedded Component to Account TI
Now open the Account TI and go to Extensibility Explorer. Click on Undefined –> Add View with Embedded Component. Select the Embedded Component from your solution and provide a title.
Click on Bind, select the PublicOutportECCCustomerRoot of Account TI and Inport of Embedded Coponent and bind the AccountID parameters.
Step 9: Test it
Assign the WCView of ZTestBO to your user to enable the New button and we are ready to see it working!!!!
Thanks & Regards,