Saturday, March 16, 2024

Contract methods

Difference between PrePromptModifyContract and PreRunModifyContract

Now to understand difference between PrePromptModifyContract and PreRunModifyContract in Dynamics 365, we will provide different points for both as shown below


1. Purpose: This method is used to modify the contract class before the report dialog (prompt) is shown to the user. It allows for altering the parameters or setup of the report before the user interacts with the prompt.

2. Timing: It is invoked after the contract class has been initialized but before the report parameter dialog is rendered.

3. Customization: Enables customization of the report's parameters, such as setting default values, hiding certain parameters, or modifying parameter options based on specific logic.

4. Use Case: Particularly useful for dynamically adjusting the report parameters based on the context of the report's execution, such as pre-filtering options or changing visibility of parameters.

5. Scope: Affects only the presentation and options of the parameter dialog; it does not directly influence the report's execution logic.


1. Purpose: This method is used to modify the contract class after the user has filled in the parameters but before the report is run. It allows for last-minute adjustments to the contract based on user input.

2. Timing: It is executed right before the report is generated after the user has submitted the parameter dialog.

3. Customization: Provides a chance to adjust or validate the report parameters or to change the report's behavior based on the final user input.

4. Use Case: Ideal for applying business logic that needs to consider user inputs, such as validating parameter combinations or modifying the data query based on the selected parameters.

5. Scope: Directly impacts how the report runs and processes data, allowing for dynamic adjustments to the reporting logic based on user-selected parameters.