Tuesday 2 December 2014

Enable or visible any field or get dynamic data on page level based on expression view



Blackbaud CRM 

I have a scenario, for instance, we need any action on page needs to enable or set its visibility or sometime we need some dynamic data in on page level,whether there would be a condition that on any Action, we need to set a dynamic caption . So in this case, we want expression view form to be included on page level.If you see below lines which was taken from OOB Event page

<PageDefinitionSpec
    ID="9988b807-97b2-434c-8be1-bbee6b944b2c"
    Name="Event Page"
    Description="Displays information about an event."
    Author="Blackbaud Product Development"
    ExpressionDataFormID="03e8fbdc-7e2c-496d-8322-405fcff75854"
    ContextRecordType="Event"
    AutoGenerateKpiActions="true"
    xmlns="bb_appfx_pagedefinition"
    >



So if you see in above Page definition, expressiondataformid has mentioned . This is OOB expression view form. I have now copied a single action from OOB Event page and paste this one, please see below lines

 <Action ID="b16c5a1a-cb3f-404b-bfa4-2248c254f56b" Caption="Delete" ImageKey="RES:Delete" Visible="=(Fields!ID = Page.Fields!EVENTID.ToString()) AndAlso (Products.ProductIsInstalled(InstalledProducts.FriendsAskingFriends) And Not Products.ProductIsInstalled(InstalledProducts.Enterprise))" Enabled="=CBool(Fields!USERHASSITEACCESS)" CaptionResourceKey="$$delete">
            <ExecuteRecordOperation RecordOperationID="c822c9bb-a7df-4a92-a1b5-54d2dfeeb2b8" xmlns="bb_appfx_commontypes">
              <ActionContext>
                <SectionField>ID</SectionField>
              </ActionContext>
              <PostActionEvent>
                <GoToPage>
                  <FunctionalArea FunctionalAreaID="69df5ab2-b48b-4da2-8d25-c053eb6ac6f2" />
                </GoToPage>
              </PostActionEvent>
            </ExecuteRecordOperation>
            <HelpKey>EVDeleteEvents.html</HelpKey>
          </Action>



You can see above Action code yellow highlighted area, It uses viewdataform expression field to set the visibility of any action.

Now if you have a requirement that any custom action needs to be added into the Event Page and its visibility will control dynamically based on some dynamic field which was not previously included in OOB expression view form then we need to make a new viewdataform and this new viewdataform would use as an extension of OOB view dataform .This will work but the important thing is to add this expression view data form into the page level, see below screen shot


 



 If you see in above image, there are multiple expression view form added on single page. In this way we can get the dynamic data based on this we will set any field dynamic on page level .We can get the page level fields with "Page.Field!" prefix .

No comments:

Post a Comment