Visibility rule does not show field as expected

Version 1

    Details

     

    There is a field on a form which has a Visible Expression. 
    The Visible Expression looks at a field through a relationship. 

    e.g.
    $(if [CI#Service.IncidentAssociatesService]TypeOfService ==
         "External Customer Facing"
      then true
      else false)

    The field is not shown/hidden as expected until after the Incident is saved.

     


    Resolution

     

    This happens because the relationship between the Incident and the Service is not established until the Incident is saved. 

    One possible solution is to copy the value to a field on Incident and use this field for the visibility rule.

    In this example we have a field on CI.Service called 'TypeOfService'.


    We want to use this to drive the visibility of a field "# of Client Cases Reported". 


    On Incident, when the Service is populated we only want the '# of Client Cases Reported' field to be visible for Services set as 'External Customer Facing'.
    We will create a field on Incident called 'ServiceType' to drive the visibility.

    Create and populate a field on Incident:
    - Log in to the tenant with the Administrator role
    - Go to Configure Application 
    - Go to Business Objects
    - Select Incident 
    - Go to Fields
    - Add a new field with the same properties of the field from which you are copying the data, e.g. copy CI.Service's TypeOfService field onto Incident as ServiceType
    - Save the Field
    - Go to Business Rules
    - Create a new Editing Rule
    - Set 'On Change' to be the field through which the relationship is established, e.g. Service
    - Set 'Set' to be the field you created above, e.g. ServiceType
    - Set the expression to set the field value: 
    $([OtherObject]TypeOfService)

    - Save the Business Rule

    When the Service is changed the 'TypeOfService' on CI.Service will be copied to the ServiceType field on Incident. 

    Set up the visible expression on the appropriate field:
    - Go to Forms 
    - Select the appropriate Form containing the field you wish to make hidden/visible
    - Select the field
    - Set the Visible Expression property, e.g.: 
    $(if ServiceType == "External Customer Facing" then true else false)


    - Save the Form

    Test: 
    - Log in to the tenant 
    - Go to the Incident workspace
    - Create a New Incident
    - Set the Service field
    - The controlled field on the form is now hidden/visible based on the value copied from the selected Service record.