Sample scenarios

Now that the setup is complete, you can start creating the Data Rules for the DRExampleUserTasks IDO. Use this collaborative tasks IDO to create the user tasks that can be seen and shared across all departments. Mongoose is a three-tier application - Database, IDO tier, and Form tier.

One of the main benefits of the Data Rules is that they allow developers in Mongoose applications to pull back or promote logic that would have been traditionally in the Form tier up to the middle or IDO tier, reducing the number of places where business logic must be implemented as IDOs may be used across many forms.

Scenario Example 1: Enabling components based on data

This functionality in the past would have been implemented in Form Script in the form or with EnableWhen logic on each component in a form. Because the same components are often in the grid side and query side of a form, this doubles the amount of places where EnableWhen attributes would be required to be implemented. In addition, form script must be compiled before it can be used on a form causing a performance hit.

Forms having this requirement can now be implemented with Filter Conditions and Action Data Rules.

Note: If in a cloud environment, your form, IDOs, and Extension Class may differ having a ue_ prefix.
  1. Open the form DRExampleUserTasks, notice that by default most of the properties, except for Seq and Department, are not enabled when the form is opened in New mode. The properties are Read-Only in the IDO.
  2. Next, open the IDOs form, and filter on IDO - DRExampleUserTasks
  3. Click Check Out to checkout the IDO.
  4. IIn this example, the properties on the form are enabled through a Data Rule after a department is specified. Click the Data Rules button to access the IDO Data Rule Wizard form.
  5. Specify these information:
    IDO Name
    Specify DRExampleUserTasks
    Rule Name
    Specify DRExampleUserTasks_InsertOrUpdate_EnableProps
    Operation Type
    Insert or Update, and leave default of checked on the checkboxes.
  6. Click OK.
    Note: Ensure that you select or are on the correct rule before adding the Activation Conditions, Filter Conditions, or Actions.
  7. Populate the Filter Conditions tab with these information, add five rows:
    Property Name
    Specify dept as the Property Name for the five entries.
    Value
    Specify the value of 100 to 500 per row.
    Value Type
    Specify Literal for all of the entries.
    And With Next Clause
    Leave this column unchecked or not selected for all of the entries.
    Scenario Example 1 - Filter Conditions tab
  8. Populate the Actions tab with these information, add five rows:
    Action Type
    Specify Set Property Enabled as the Action Type for the five entries.
    Property Name
    Specify StartDate, EndDate, Status, TaskType, and TaskDesc as the property name for each entry.
    Value Type
    Specify Literal for all of the entries.
    Scenario Example 1 - Actions tab
  9. Save the Data Rule after populating the tabs.
  10. On the IDOs form, click the Check In button.
  11. Navigate to Form > Definition > Unload Global Form Objects
    Note: This will also discard the IDO cache if View > User Preferences > Unload IDO Metadata with Forms is selected.
  12. Open the DRExampleUserTasks, and add a record for a user tasks.
    Note: Notice that the properties are disabled except for Department.
  13. Select the value of the Department from the drop-down list. Select from 100, 200, 300, 400, or 500.
    Note: Notice that once you populate the Department with a value, the other properties become available, such as Task Type and Task Status which you are required to populate as well.
    Scenario Example 1 - User Tasks form

    Although the rows are not ready to be saved, you can enable some properties on the form without form script or using the EnabledWhen attributes on each component.

Scenario Example 2 - Setting a property value

Property values are often set in the MG Applications in form script or within form event handlers using the Sets Values EH Response Type. To elevate this functionality from the form up into the middle tier, you can use Data Rule. From the previous scenario, the username was not set in the User Name field based on who you are logged in as.

To resolve this, create a Data Rule as follows:

  1. On the IDOs form, check out the DRExampleUserTasks IDO.
  2. Click the Data Rules button.
  3. Click the New Data Rule and populate the wizard form with these information:
    IDO Name
    Specify DRExampleUserTasks.
    Rule Name
    Specify DRExampleUserTasks_Insert_SetUser.
    Operation Type
    Insert or Update, and leave default of checked on the checkboxes.
  4. Click OK.
    Note: Ensure that you select or are on the correct rule before adding the Activation Conditions, Filter Conditions, or Actions.
  5. Populate the Filter Conditions tab with these information:
    Property Name
    Specify Username.
    Operator
    Specify Equals.
    Value Type
    Specify Literal.
    Value
    Leave this column blank. Do not enter any value in this column.
    Scenario Example 2 - Filter Conditions
  6. Populate the Actions tab with these information:
    Action Type
    Specify Set Property Value.
    Property Name
    Specify Username.
    Property Value
    Specify USERNAME().

    USERNAME() is a Mongoose keyword that returns the value of the user that is logged in.

    Scenario Example 2 - Actions tab
  7. Save the Data Rules after populating the tabs.
  8. Navigate to Form > Definition > Unload Global Form Objects
    Note: This will also discard the IDO cache if View > User Preferences > Unload IDO Metadata with Forms is selected.
  9. Open the User Tasks for, add a new task for Department 100 to 500 and Save.
    Note: Check if the Username is populated.

Scenario Example 3 - Setting up Domain and InLine List with validation

Many data elements on forms are sourced from database tables and validated during entry on a form or may come from a static list. In this scenario, you will set up a domain list from the DRExampleDepts IDO displaying the dept and description properties and create InCollection validation of the list to ensure that values entered do not go beyond records that exist for departments in the database. We will also create a static list for our Status property with choices of Open and Closed.

  1. On the IDOs form, checkout the DRExampleUserTasks IDO.
  2. Click the Data Rules button.
  3. Click the New Data Rule button and populate the wizard form with these values:
    IDO Name
    Specify DRExampleUserTasks.
    Rule Name
    Specify DRExampleUserTasks_InsertOrUpdate_SetLists.
    Operation Type
    Insert or Update, and leave default of checked on the checkboxes.
  4. Click OK.
    Note: Ensure that you select or are on the correct rule before adding the Activation Conditions, Filter Conditions, or Actions.
  5. On the Actions tab, in the sub-collection grid, click on the Sequence column and right-click on the top left corner of the grid to add or delete records.
  6. Select New, and add three rows.

    Scenario Example 3 - Actions tab

  7. Add these rows in the Sub-collection grid for Data Rules - Rule Actions:
    • For the Domain List for the Dept, specify these columns:
      Action Type
      Specify Set Property Domain.
      Property Name
      Specify dept.
      Domain IDO Name
      Specify DRExamplesDepts.
      Domain List Properties
      Click the Edit List Properties button and Ctrl+Click each property, or specify a comma separated list: dept,description
    • For the Inline List for the Status, specify these columns:
      Action Type
      Specify Set Property Inline List.
      Property Name
      Specify Status.
      Inline List
      Click the Edit Inline List button. Open the first row and click Add Row. Specify Closed as the value for the second row, Column for Value should be equal to 1 and the set the value for Display Columns to 1, and click OK.
      Note: Optionally, you can manually paste this code in the InLine List column:
      ENTRIES(Open,Closed) DISPLAY(1) VALUE(1)
    • For the validation of the Domain list to be InCollection, specify these columns:
      Action Type
      Specify Set Property Validator.
      Property Name
      Specify dept.
      Validators
      Click the Edit Valiudators button. Click Add and select the In IDO Collection option. Click Next and specify these information:
      • IDO: DRExampleDepts
      • Property: dept
      • Form Message String: mIsNotAValid
      Note: Optionally, you can manually paste this code in the column:
      INCOLLECTION(IDO(DRExampleDepts)PROPERTY(dept)STRINGMSG(mIsNotAValid))
  8. Save the Data Rule after populating the Actions tab. Saving the Data Rule will save the Actions in the sub-collection as well.
  9. On the IDOs form, click the Check In button.
  10. Navigate to Form > Definition > Unload Global Form Objects
    Note: This will also discard the IDO cache if View > User Preferences > Unload IDO Metadata with Forms is selected.
  11. Open the User Tasks form and add a new task. Use the combo box to choose the dept such as 100, 200, 300, 400, or 500.
  12. Populate the text for the Task Type and Description.
  13. Specify the Status. You can select between Open or Closed.
  14. Update the Department to 555 or any value that was not defined in the Departments form. You will encounter an error when you try to save.
    Note: Consider making separate rules for validation, use the Filter Condition tab and have entries for IsModified as the Operator for the properties being validated.

Scenario Example 4 - Data Rules Pre and Post-Save Methods

It may be desired to call C# methods before the save of an IDO Collection or Post Save. Data Rules can be used to accomplish this. This can be accomplished using the Application Event System. The AES would require Event Handler and Event Action metadata that must be set up and maintained. With this scenario, you will have two examples of Data Rules methods.
  • The first is a Pre-Save method that is called before the AES and other logic could be fired. It will look at the Start Date and End Date on the task. If the End Date is earlier than the Start Date it will change the End Date to be the same as the Start Date.
  • The second method is a Post-Save method which in this case is tied to a Meeting. Create a task with: Meeting for the Task Description. This will enable the Email To, Subject, and Body fields to the right that may be populated, and once filled in, when the task is saved it will send an email. There are other ways this could have been accomplished but this is an example of calling a Post-Save method.

Create the Data Rule to enable the necessary properties for Post-Save method. You will enable the ToEmailAddress, Subject and Body properties when the Task Description contains the literal value: Meeting

  1. On the IDOs form checkout the DRExampleUserTasks IDO.
  2. Click the Data Rules button.
  3. Click the New Data Rule button and populate the wizard form with the values below:
    • IDO Name: DRExampleUserTasks
    • Rule Name: DRExampleUserTasks_InsertUpdate_EnableToEmailAddressSubBody
    • Operation Type: Insert or Update, and leave default of checked on the checkboxes.
  4. Click OK.
    Note: Ensure that you select or are on the correct rule before adding the Activation Conditions, Filter Conditions, or Actions.
  5. Populate the Filter Conditions tab with these information:
    • Property Name: TaskDesc
    • Operator: Equals
    • Value Type: Literal
    • Value: Meeting
  6. Populate the Actions tab with these information:
    • Action Type: Set Property Enabled
    • Property Name: ToEmailAddress
    • Action Type: Set Property Enabled
    • Property Name: Subject
    • Action Type: Set Property Enabled
    • Property Name: Body
  7. Save the Data Rule.
  8. Next, create the Data Rule for the Pre-Save method.
  9. On the IDOs form checkout the DRExampleUserTasks IDO.
  10. Click the Data Rules button.
  11. Click the New Data Rule button and populate the wizard form with these values:
    • IDO Name: DRExampleUserTasks
    • Rule Name: DRExampleUserTasks_InsertOrUpdate_PreSaveFilterEndLessThanStart
    • Operation Type: Insert or Update, and leave default of checked on the checkboxes.
  12. Click OK.
    Note: Ensure that you select or are on the correct rule before adding the Activation Conditions, Filter Conditions, or Actions.
  13. Populate the Filter Conditions tab with these information:
    • Property Name: EndDate
    • Operator: Less Than
    • Value Type: Property Name
    • Comparison Property Name: StartDate
  14. Populate the Actions tab with these information:
    • Action Type: Call Action Method Pre Save
    • Action Method: OnEDtEarlierThanSDt
      Note: This column is located all the way to the right of the grid.
  15. Save the Data Rule.
  16. After creating the Data Rule for the Pre-Save method, next is the Data Rule for the Post-Save method.
    Note: For the Post-Save method to run and deliver an email it is required that emailing be configured on the Intranets form and working with the AES Service or host running.
  17. On the IDOs form checkout the DRExampleUserTasks IDO.
  18. Click the Data Rules button.
  19. Click the New Data Rule button and populate the wizard form with these values:
    • IDO Name: DRExampleUserTasks
    • Rule Name: DRExampleUserTasks_InsertUpdate_PostSaveSendMtgEmail
    • Operation Type: Insert or Update, and leave default of checked on the checkboxes.
  20. Click OK.
    Note: Ensure that you select or are on the correct rule before adding the Activation Conditions, Filter Conditions, or Actions.
  21. Populate the Filter Conditions tab with these information:
    • Property Name: TaskDesc
    • Operator: Equals
    • Value Type: Literal
    • Value: Meeting
    • Property Name: Body
    • Operator: Not Equals
    • Value Type: Literal
  22. Add the Subject property with these information:
    • Property Name: Subject
    • Operator: Not Equals
    • Value Type: Literal
  23. Add the ToEmailAddress property with these information:
    • Property Name: ToEmailAddress
    • Operator: Not Equals
    • Value Type: Literal
  24. Populate the Actions tab with these information:
    • Action Type: Call Action Method Post Save
    • Action Method: SendEmailOnSave
  25. Save the Data Rule after populating the Actions tab. Saving the Data Rule will save the Filter Conditions and the Actions in the sub-collection as well.
  26. On the IDOs form, click the Check In button.
  27. Navigate to Form > Definition > Unload Global Form Objects
    Note: This will also discard the IDO cache if View > User Preferences > Unload IDO Metadata with Forms is selected.

You can try to add a User Task where the EndDate is earlier than the StartDate and Save. You should notice that the EndDate gets set to the same value as that is in the StartDate. Try adding a User Task where the Task Description value is Meeting.

Notice that the ToEmailAddress, Subject, and Body properties become enabled. Populate them with a valid email address, a sample subject and body and then save the User Task. If SMTP and AES are configured and working in MG, an email will be sent.

Scenario Example 5 - Data Rules Licensed Module Status, Current User is Licensed for Module, and Current User Member of Group

There is an IDO and form for use with Cache Settings scenarios: DRExampleUserReqs similar to the User Tasks, you are required to choose a department. Therefore, a list and validator will be required on this IDO as well.

  1. Create the Data Rule for the Department list similar to the earlier IDO:
  2. On the IDOs form checkout the DRExampleUserReqs IDO.
  3. Click the Data Rules button.
  4. Click the New Data Rule button and populate the wizard form with these values:
    • IDO Name: DRExampleUserReqs
    • Rule Name: DRExampleUserReqs_InsertOrUpdate_SetLists
    • Operation Type: Insert or Update, and leave default of checked on the checkboxes.
  5. Click OK.
    Note: Ensure that you select or are on the correct rule before adding the Activation Conditions, Filter Conditions, or Actions.
  6. In the sub-collection grid, click on the Sequence column and right-click on the top left corner of the grid to add or delete records.
  7. Select New, and add two rows.

    Scenario Example 5 - Actions tab

  8. Add these rows for the sub-collection grid for Data Rules - Rule Actions:
    • For the Domain List for the Dept, specify these columns:
      • Property Name: dept
      • Domain IDO Name: DRExampleDepts
      • Domain Property: dept
    • For Validation of the Domain List to be InCollection, specify these columns:
      • Action Type: Set Property Validator
      • Property Name: dept
      • Validators:
        INCOLLECTION(IDO(DRExampleDepts)PROPERTY(dept))
  9. Save the Data Rule after populating the Actions tab. Saving the Data Rule will save the Actions in the sub-collection as well.

Enabling the User Req properties after the Department field is populated

Similar to the User Tasks IDO, we made some properties read-only at the IDO level and then will enable with a Data Rule when the Department is populated. You are required to create a new Data Rule to do this.

  1. On the IDOs form checkout the DRExampleUserReqs IDO if it is not already checked out.

    In this example you will only enable properties on the form through a Data Rule once a department has been specified.

  2. Click the Data Rules button.
  3. Click the New Data Rule button and populate the wizard form with these values:
    • IDO Name: DRExampleUserReqs
    • Rule Name: DRExampleUserReqs_InsertOrUpdate_DeptPopulatedEnableProps
    • Operation Type: Insert or Update, and leave default of checked on the checkboxes.
  4. Click OK.
    Note: Ensure that you select or are on the correct rule before adding the Activation Conditions, Filter Conditions, or Actions.
  5. Populate the Filter Conditions tab with these information:
    • Property Name: Dept
    • Operator: Greater Than
    • Value Type = 1
    • Value: No value or blank
    • With Next Clause: Checked
    Scenario Example 5 - Filter Conditions tab
  6. Populate the Actions tab with five property names, with these information:
    • Action Type: Set Property Enabled
    • Property Name (One property name per row): Item, Description, Qty, UnitCost, and ExtCost.
      Note: You can navigate from row to row using the tab key.
    Scenario Example 5 - Actions tab
  7. Save the Data Rule after populating both tabs.
  8. On the IDOs form, click the Check In button.
  9. Navigate to Form > Definition > Unload Global Form Objects
    Note: This will also discard the IDO cache if View > User Preferences > Unload IDO Metadata with Forms is selected.
  10. Log in as ITUser and open the DRExampleUserReqs form.
  11. Add a record for a User Requisition. Ensure that you specify 600 for the Department field for IT.

    There is no calculation for ExtCost, however you can specify the calculated value. Once you populate the Department field with a value the other properties will become available.

    Scenario Example 5 - User Requisitions form

  12. Save the form and notice that the value for Ext Cost is populated.

We will now create a Data Rule that limits what an IT Manager can approve by filtering requisitions for the IT Department, department code 600.

The rule checks whether the Transactional module is licensed on the License Management form, whether the user is licensed for the Developer module as displayed for the ITMgr user under the User Modules button on the Users form, and whether the user is a member of the DREX_IT_ReqAppr group as displayed in the lower grid of the Users form for the ITMgr user.

We will also have an Action to enable the Approved property for the manager based on the Activation and Filter Conditions specified earlier.

Mongoose does not come with many additional feature modules, this is why we are using Developer. Other applications will have many more.

Therefore, we will test with the user having the Developer module and then after performing the test we will log out, and back in as user: sa.

  1. Open the Users form for the ITMgr user.
  2. Click the User Modules button and delete User Module: Developer.
  3. Save the user and Log out.
  4. Log in as ITMgr user.
  5. Discard our IDO Cache, and open the User Requisitions form.
  6. Change a date or the or description of a row with a Department value of 600 is set.

    Notice that you no longer have access to the Approved checkbox.

Create the new data rule required for the test above on the DRExampleUserReqs IDO similar to the previous rules.

  1. Check out the IDO in the IDOs form.
  2. Select the IDO and click the Data Rules button.
  3. Click the New Data Rule button on the Data Rules form to access the IDO Data Rule Wizard form and specify these information:
    • IDO Name: DRExampleUserReqs
    • Rule Name: DRExampleUserReqs_Update_ChkTrnModuleLic_ChkUserLic_ChkGroupITAppr
    • Operation Type: Update and leave default of checked on the checkboxes.
  4. Click OK.
    Note: Ensure that you select or are on the correct rule before adding the Activation Conditions, Filter Conditions, or Actions.
  5. Next, populate the Activation Conditions with three rows using these information:
    Note: You can use the Tab key to navigate from row to row.
    • For the first row, specify these columns:
      • Source Type: License Module Status
      • Module Name: Transactional
      • Operator: Is Licensed
    • For the second row, specify these columns:
      • Source Type: Current User Member Of Group
      • Group Name: DREX_IT_ReqAppr
      • Operator: In Group
    • For the third row, specify these columns:
      • Source Type: Current User Licensed For Module
      • Module Name: Developer
      • Operator: Is Licensed

    Scenario Example 5 - Activation Conditions tab

  6. Save the Data Rule.
  7. Next, populate the Filter Conditions tab with these information:
    • Property Name: Dept
    • Operator: Equals
    • Value Type: Literal
    • Value: 600
    • And With Next Clause column: Checked

    Scenario Example 5 - Filter Conditions tab

  8. Next, populate the Actions tab with these information to enable the Approved property so the IT Manager user can approve he IT Requisition:
    • Action Type: Set Property Enabled
    • Property Name: Approved
    • Value Type: Literal

    Scenario Example 5 - Actions tab for the Approved property

  9. Save the Data Rule.
  10. Check In the IDO.
  11. Discard the IDO Cache.
  12. Log out and log back in as ITMgr, using the password DataRules1.
  13. Change the Requisition Date to a different date to force an update on a User Req for Dept 600 and try to access the Approved checkbox.

    It should be available because Transactional Module is licensed, the ITMgr is a member of: DREX_IT_ReqAppr, as the current user has the Developer Module and finally the Req has been updated and Dept = 600.

    You could try to log out and log back in as sa user, remove the Developer Module from ITMgr. Log out and log back in test a Dept 600 req and see that Approval access has been removed.

Scenario Example 6 - Data Rules Set - Set the Current Username and Current Date when a property changes (Approved property)

Building on the previous Data Rule, we will create a data rule to populate the Approval Date and the Approval Username based on a User Requisition being approved.

Create the new data rule required to set the name and the date on Approval on the DRExampleUserReqs IDO similar to the previous rules.

  1. Check out the IDO in the IDOs form.
  2. Select the IDO and click the Data Rules button.
  3. Click the New Data Rule button on the Data Rules form to access the IDO Data Rule Wizard form and specify these information:
    • IDO Name: DRExampleUserReqs
    • Rule Name: DRExampleUserReqs_Update_ApprovedAssignUserAndDate
    • Operation Type: Update and leave default of checked on the checkboxes.
  4. Click OK.
    Note: Ensure that you select or are on the correct rule before adding the Activation Conditions, Filter Conditions, or Actions.
  5. Next, populate the Filter Conditions tab with two rows, using these information:
    • For the first row, specify these columns:
      • Property Name: Approved
      • Operator: Is Modified
      • Value Type: Literal
      • And With Next Clause: checked
    • For the second row, specify these columns:
      • Property Name: Approved
      • Operator: Equals
      • Value Type: Literal
      • Value: 1
      • And With Next Clause: checked
  6. Next, populate the Actions tab with four rows, using these information:
    • For the first row, specify these columns:
      • Action Type: Set Property Enabled
      • Property Name: AppUsername
      • Value Type: Literal
      • Property Value: No value or blank
    • For the second row, specify these columns:
      • Action Type: Set Property Enabled
      • Property Name: AppDate
      • Value Type: Literal
      • Property Value: No value or blank
    • For the third row, specify these columns:
      • Action Type: Set Property Value
      • Property Name: AppUsername
      • Value Type: Literal
      • Property Value: USERNAME()
    • For the fourth row, specify these columns:
      • Action Type: Set Property Value
      • Property Name: AppDate
      • Value Type: Literal
      • Property Value: CURDATE()
  7. Save the Data Rule.
  8. Discard the IDO Cache.
  9. Log out, and log back in as ITMgr user, change the date on a User Req for Dept 600 and try to access the Approved checkbox.

    Notice the Approval Date and Username populate.

    Note: If you tested previously removing the Developer Module from the ITMgr user, ensure that you put it back under the Users form for the ITMgr, and the User Modules button and log back in as ITMgr to test Scenario Example 6

Scenario Example 7 - Creating a site-wide cache setting for third-party application (Vendor Controlled Maintenance Materials) to limit approval requisitions

In this scenario you are required to create a Cached Setting on the DRExampleReqParms IDO where the VendorControlledMaintMatls property exists. This is a tinyint property that will hold a value of 1 when a given site will be using Vendor Controlled Maintenance Materials or VCMM.

The premise here is that if VCMM is being used that a Kanban process is being utilized for maintenance materials and maintenance department requisitions should not be approvable by the MntMgr user. The supplies will be filled automatically by the vendor, and the company will be invoiced for maintenance materials usage.

Due to this process, we do not want to allow the MntMgr user to approve User Reqs, as they are not necessary. So, the only time that the Mnt. Dept. should be able to approve Reqs is when VCMM is not in use.

The Cached Setting: CS_VendorControlledMaintMatls will be created for this purpose.

  1. Sign in as sa user and open the IDOs form.
  2. Check out the DRExampleReqParms IDO.
  3. Click on the Cached Settings tab in the bottom center and a new Cached Setting with these information:
    • Setting Name: CS_VendorControlledMaintMatls
    • Scope Level: Site
    • Source Type: Property
    • Property Name: VendorControlledMaintMatls
    • Filter: VendorControlledMaintMatls IS NOT NULL

    Scenario Example 7 - IDOs form

  4. Save and check in the DRExampleReqParms IDO.
  5. Next, create a Data Rule on the DRExampleUserReqs to look at the cached setting.
  6. Check out the DRExampleUserReqs IDO.
  7. Click on the Data Rules button.
  8. Click the New Data Rule button to create a new Data Rule on the DRExampleUserReqs IDO with these information:
    • IDO Name: DRExampleUserReqs
    • Rule Name: DRExampleUserReqs_Update_CheckDept300AndVCMMUsage
    • Operation Type: Update and leave the defaulting checkboxes checked
  9. Click OK.
    Note: Ensure that you select or are on the correct rule before adding the Activation Conditions, Filter Conditions, or Actions.
  10. Select the Activation Conditions tab to add two conditions.
  11. Click in the Sequence column or any editable column, and right-click New to add conditions with these information:
    • For the first activation condition, specify these columns:
      • Source Type: Cached Setting
      • Cached Setting IDO: DRExampleReqParms
      • Cached Setting: CS_VendorControlledMaintMatls
      • Operator: Equals
      • Value: 0
    • For the second activation condition, specify these columns:
      • Source Type: Current User Member Of Group
      • Group Name: DREX_Mnt
      • Operator: Is In Group
    Scenario Example 7 - IDO Data Rules form
  12. Select the Actions tab and add an action with these information:
    • Action Type: Set Property Enable
    • Property Name: Approved
    • Value Type: Literal
    Scenario Example 7 - IDO Data Rules form - Actions tab
  13. Save the Data Rule.
  14. Check in the IDO.
  15. Discard the IDO Cache.
  16. Log out and log back in as MntMgr user with the password: DataRules1
  17. Open the DRExampleUserReqs form and update a requisition for Dept 300 and see if you can approve the requisition.

    You should notice that you are unable to because when we set up the Req. Parms we enabled the Vendor Controlled Maint. Mtls.

  18. Log out and log back in as sa user and open the DRExampleReqParms form.

    Scenario Example 7 - Requisition Parameters form

  19. Clear the Vendor Controlled Maint. Mtls. checkbox and save.
  20. Log out and log back in as MntMgr user with the password: DataRules1.
  21. Open the DRExampleUserReqs form and update a requisition for Dept 300 and see if you can approve the requisition. You now should be able to.

Scenario Example 8 - Create a Site-wide cache setting for third-party application (Vendor Controlled Maintenance Materials) to limit approval of requisitions using a C# method instead of a property-based Cached setting

In this example, create a Cached Setting on the DRExampleUserReqs IDO that fires a method to look at the cached setting on the DRExampleReqParms, retrieve it in code and control the same access to approve requisitions for the Maintenance Dept. (300) based upon Vendor Controlled Maintenance Materials (VCCM) not being used.

Typically, you would use the method if a more complicated logic were necessary. We are using a method to accomplish the same check from Scenario Example 7, but this time through code. The goal here is just to illustrate the how to retrieve a Cached Setting from C# code.

You no longer need the data rule that was previously created as a part of Example Scenario 7. Deactivate the Data Rule from the previous example:
  1. Sign out and sign back in as the sa user.
  2. Open the IDOs form and check out the DRExampleUserReqs IDO.
  3. Locate the DRExampleUserReqs_Update_CheckDept300AndVCMMUsage data rule.
  4. Clear the Active checkbox.
  5. Save the data rule, and discard the IDO cache.
Scenario Example 8 - IDO Data Rules form

Next, create a Cached Setting on the DRExampleUserReqs IDO that will call a method, and in C# assembly code check the cached setting on the DRExampleReqParms IDO, named: CS_VendorControlledMaintMatls.

  1. Check out the DRExampleUserReqs IDO.
  2. Click on the grid on the Cached Settings tab and click the New button.
  3. Create a Cached Setting with these information:
    • Setting Name: CS_VendorControlledMaintMatlsFromReq
    • Scope Level: Site
    • Source Type: Method
    • Method: CheckVCMMUsage
    • Method Parameters: None
    Note: If a method is used for Cache Settings, only literal values can be passed as parameters (csv list of literal values) in the Method Parameters field. The properties from the IDO cannot be passed as input parameters as no row level context is available. This work is all done at the IDO level.

    Scenario Example 8 - IDOs form

  4. Save the IDO and click the Data Rules button.

Next, we need to create a new Data Rule on the DRExampleUserReqs IDO to use a method based cached setting.

  1. Click on the Data Rules button.
  2. Click the New Data Rule button to create a new Data Rule on the DRExampleUserReqs IDO with these information:
    • IDO Name: DRExampleUserReqs
    • Rule Name: DRExampleUserReqs_Update_CheckDept300AndVCMMUsageUsingMethod
    • Operation Type: Update and leave the defaulting checkboxes checked
  3. Click OK to create the rule.
    Note: Ensure that you select or are on the correct rule before adding the Activation Conditions, Filter Conditions, or Actions.
  4. Select the Activation Conditions tab to add two conditions.
  5. Click in the Sequence column or any editable column, and right-click New to add conditions with these information:
    • For the first Activation Condition, specify these columns:
      • Source Type: Cached Setting
      • Cached Setting IDO: DRExampleUserReqs
      • Cached Setting Name: CS_VendorControlledMaintMatlsFromReq
      • Operator: Equals
      • Value: 0
    • For the second Activation Condition, specify these columns:
      • Source Type: Current User Member Of Group
      • Group Name: DREX_Mnt
      • Operator: Is In Group

    Scenario Example 8 - IDO Data Rules form - Activation Conditions tab

  6. Next, add a condition in the Filter Conditions tab with these information:
    • Property Name: Dept
    • Operator: Equals
    • Value Type: Literal
    • Value: 300

    Scenario Example 8 - IDO Data Rules form - Filter Conditions tab

  7. Next, add an action in the Actions tab with these information:
    • Action Type: Set Property Enabled
    • Property Name: Approved
    • Value Type: Literal

    Scenario Example 8 - IDO Data Rules form - Actions tab.png

  8. Save the Data Rule.
  9. Check In the IDO.
  10. Discard the IDO Cache.
  11. Log back in as MntMgr user.
  12. Open the DRExampleUserReqs form and update a requisition for Dept 300 and see if you can approve the requisition.

    You should notice that you are able to, since we had already updated Requisition Parameters and disabled the VCMM.