From 6b972c3e58c623e257fa7868d5decca16143271c Mon Sep 17 00:00:00 2001 From: Daryl LaBar Date: Fri, 17 Jun 2016 09:47:41 -0400 Subject: [PATCH 1/3] Changed OptionSetValue.Value to be a Number. This is the way CRM is returning it when Turbo Forms are used which is the default now. Added Missing ProcessManager functions getSelectedStage, addOnStageSelected, removeOnStageChange Add UiFocusable Interface to Control Changed Form Notification to Use String Literal Type Changed setRequiredLevel to Use String Literal Type Changed setSubmitMode to Use String Literal Type Changed setDisplayState to Use String Literal Type Changed getClient to Use String Literal Type Changed getClientState to Use String Literal Type Changed getCurrentTheme to Use String Literal Type Changed setFormNotification to Use String Literal Type Changed getStatus to Use String Literal Type Changed savedMode to Use String Literal Type Changed CmdBar to Use String Literal Type Changed NavBar to Use String Literal Type Changed Action to Use String Literal Type --- xrm/xrm-tests.ts | 29 +++++ xrm/xrm.d.ts | 274 ++++++++++++++++++----------------------------- 2 files changed, 133 insertions(+), 170 deletions(-) diff --git a/xrm/xrm-tests.ts b/xrm/xrm-tests.ts index 4dfb8e4090..db0608d8cf 100644 --- a/xrm/xrm-tests.ts +++ b/xrm/xrm-tests.ts @@ -105,3 +105,32 @@ Xrm.Page.data.entity.addOnSave(( context ) => alert( `The current form type is: ${Xrm.Page.ui.getFormType() }` ); alert( `The current entity type is: ${Xrm.Page.data.entity.getEntityName() }` ); + +/// Demonstrate Optionset Value as int in Turbo Forms + +var optionSetAttribute = Xrm.Page.getAttribute( "statuscode" ); +const optionValue: number = optionSetAttribute.getOptions()[0].value; + +/// Demonstrate Control.setFocus(); + +optionSetAttribute.controls.get(0).setFocus(); + +/// Demonstrate setFormNotification + +var level: Xrm.Page.ui.FormNotificationLevel; +level = "ERROR"; +Xrm.Page.ui.setFormNotification("Test", level, "uniqueId"); + +/// Demonstrate + +let requirementlevel: Xrm.Page.Attribute.RequirementLevel; +requirementlevel = "none"; +let submitMode: Xrm.Page.Attribute.SubmitMode; +submitMode = "always"; + +let attribute = Xrm.Page.getAttribute("customerid"); +attribute.setSubmitMode(submitMode); +attribute.setRequiredLevel(requirementlevel); + + + diff --git a/xrm/xrm.d.ts b/xrm/xrm.d.ts index d20dfd816c..14f1cf204b 100644 --- a/xrm/xrm.d.ts +++ b/xrm/xrm.d.ts @@ -220,14 +220,19 @@ declare namespace Xrm * * @return The client, as either "Web", "Outlook", or "Mobile" */ - getClient(): string; + getClient(): ClientContext.Client; /** * Gets client's current state. * * @return The client state, as either "Online" or "Offline" */ - getClientState(): string; + getClientState(): ClientContext.ClientState; + } + + export module ClientContext { + export type Client = "Web" | "Outlook" | "Mobile"; + export type ClientState = "Online" | "Offline"; } /** @@ -257,7 +262,7 @@ declare namespace Xrm * * @remarks This function does not work with Dynamics CRM for tablets. */ - getCurrentTheme(): string; + getCurrentTheme(): Context.Theme; /** * Gets whether automatic save is enabled. @@ -344,6 +349,9 @@ declare namespace Xrm prependOrgName( sPath: string ): string; } + export module Context { + export type Theme = "default" | "Office12Blue" | "Office14Silver"; + } /** * Interface for the Xrm.Page.data object. */ @@ -437,49 +445,7 @@ declare namespace Xrm */ refreshRibbon(): void; - /** - * Sets a form-level notification. - * - * @param {string} message The message. - * @param {"ERROR"} level An error message. - * @param {string} uniqueId A unique identifier for the message. - * - * @return true if it succeeds, false if it fails. - */ - setFormNotification( message: string, level: "ERROR", uniqueId: string ): boolean; - - /** - * Sets a form-level notification. - * - * @param {string} message The message. - * @param {"WARNING"} level A warning message. - * @param {string} uniqueId A unique identifier for the message. - * - * @return true if it succeeds, false if it fails. - */ - setFormNotification( message: string, level: "WARNING", uniqueId: string ): boolean; - - /** - * Sets a form-level notification. - * - * @param {string} message The message. - * @param {"INFO"} level An informational message. - * @param {string} uniqueId A unique identifier for the message. - * - * @return true if it succeeds, false if it fails. - */ - setFormNotification( message: string, level: "INFO", uniqueId: string ): boolean; - - /** - * Sets a form-level notification. - * - * @param {string} message The message. - * @param {string} level The level, as either "ERROR", "WARNING", or "INFO". - * @param {string} uniqueId A unique identifier for the message. - * - * @return true if it succeeds, otherwise false. - */ - setFormNotification( message: string, level: string, uniqueId: string ): boolean; + setFormNotification(message: string, level: Page.ui.FormNotificationLevel, uniqueId: string ): boolean; process: Page.data.ProcessManager; @@ -725,7 +691,7 @@ declare namespace Xrm * * @remarks This method will return either "active" or "inactive". */ - getStatus(): string; + getStatus(): Stage.Status; /** * Returns a collection of steps in the stage. @@ -735,6 +701,10 @@ declare namespace Xrm getSteps(): Step[]; } + export module Stage { + export type Status = "active" | "inactive"; + } + export interface Step { /** @@ -798,7 +768,7 @@ declare namespace Xrm * * @return The event source. */ - getEventSource(): Page.Attribute | Page.Entity; + getEventSource(): Attribute | Entity; /** * Gets the shared variable with the specified key. @@ -912,12 +882,9 @@ declare namespace Xrm text: string; /** - * The value, as a string. - * - * @remarks You must use parseInt to convert this value to a number before you can use it to - * set the value of an OptionSetAttribute. + * The value, as a number */ - value: string; + value: number; } /** @@ -1024,7 +991,7 @@ declare namespace Xrm * * @return The required level, as either "none", "required", or "recommended" */ - getRequiredLevel(): string; + getRequiredLevel(): Attribute.RequirementLevel; /** * Gets current submit mode for the attribute. @@ -1033,7 +1000,7 @@ declare namespace Xrm * * @remarks The default value is "dirty" */ - getSubmitMode(): string; + getSubmitMode(): Attribute.SubmitMode; /** * Gets the current user's privileges for the attribute. @@ -1049,54 +1016,12 @@ declare namespace Xrm */ removeOnChange( handler: ContextSensitiveHandler ): void; - /** - * Sets required level. - * - * @param {"none"} requirementLevel Not required. - */ - setRequiredLevel( requirementLevel: "none" ): void; - - /** - * Sets required level. - * - * @param {"required"} requirementLevel Required. - */ - setRequiredLevel( requirementLevel: "required" ): void; - - /** - * Sets required level. - * - * @param {"recommended"} requirementLevel Recommended. - */ - setRequiredLevel( requirementLevel: "recommended" ): void; - /** * Sets the required level. * * @param {string} requirementLevel The requirement level, as either "none", "required", or "recommended" */ - setRequiredLevel( requirementLevel: string ): void; - - /** - * Sets submit mode. - * - * @param {"always"} submitMode Always submit this attribute. - */ - setSubmitMode( submitMode: "always" ): void; - - /** - * Sets submit mode. - * - * @param {"never"} submitMode Never submit this attribute. - */ - setSubmitMode( submitMode: "never" ): void; - - /** - * Sets submit mode. - * - * @param {"dirty"} submitMode Submit this attribute when changed. - */ - setSubmitMode( submitMode: "dirty" ): void; + setRequiredLevel(requirementLevel: Attribute.RequirementLevel): void; /** * Sets the submit mode. @@ -1105,7 +1030,7 @@ declare namespace Xrm * * @remarks The default value is "dirty" */ - setSubmitMode( submitMode: string ): void; + setSubmitMode(submitMode: Attribute.SubmitMode): void; /** * A collection of all the controls on the form that interface with this attribute. @@ -1113,6 +1038,11 @@ declare namespace Xrm controls: Collection.ItemCollection; } + export module Attribute { + export type RequirementLevel = "none" | "recommended" | "required" ; + export type SubmitMode = "always" | "dirty" | "never"; + } + /** * Interface for a Number attribute. * @@ -1426,27 +1356,13 @@ declare namespace Xrm */ save(): void; - /** - * Saves the record with the given save mode. - * - * @param {"saveandclose"} saveMode Saves the record, and closes the form. - */ - save( saveMode: "saveandclose" ): void; - - /** - * Saves the record with the given save mode. - * - * @param {"saveandnew"} saveMode Saves the record, and opens a blank form. - */ - save( saveMode: "saveandnew" ): void; - /** * Saves the record with the given save mode. * * @param {string} saveMode (Optional) the save mode to save, as either "saveandclose" or * "saveandnew". */ - save( saveMode: string ): void; + save( saveMode: Entity.SaveMode ): void; /** * The collection of attributes for the record. @@ -1454,6 +1370,10 @@ declare namespace Xrm attributes: Collection.ItemCollection; } + export module Entity { + export type SaveMode = "saveandclose" | "saveandnew"; + } + /** * Interface for save event arguments. */ @@ -1512,7 +1432,7 @@ declare namespace Xrm /** * Set a Process as the active process. * - * @param {string} processId the Id of the process to make the active process. + * @param {string} processId The Id of the process to make the active process. * @param {function} callbackFunction (Optional) a function to call when the operation is complete. */ setActiveProcess( processId: string, callbackFunction?: ProcessCallbackDelegate ): void; @@ -1548,30 +1468,59 @@ declare namespace Xrm * Use this method to asynchronously retrieve the enabled business process flows that the user can switch to for an * entity. * - * @param {Function} callbackFunction The callback function must accept a parameter - * that contains an object with dictionary - * properties where the name of the property is the - * Id of the business process flow and the value of - * the property is the name of the business process - * flow. - * - * The enabled processes are filtered according to - * the user’s privileges. The list of enabled - * processes is the same ones a user can see in the - * UI if they want to change the process manually. + * @param {Function} callbackFunction The callback function must accept a parameter that contains an object with + * dictionary properties where the name of the property is the Id of the + * business process flow and the value of the property is the name of the + * business process flow. + * + * The enabled processes are filtered according to the user’s privileges. The + * list of enabled processes is the same ones a user can see in the UI if they + * want to change the process manually. */ getEnabledProcesses( callbackFunction: ( enabledProcesses: ProcessDictionary ) => void ): void; + /** + * Use this method to get the currently selected stage. + * + * @return The currently selected stage. + */ + getSelectedStage(): Stage; + /** * Use this to add a function as an event handler for the OnStageChange event so that it will be called when the * business process flow stage changes. - * - * @param {ContextSensitiveHandler} handler The function will be added to the bottom of the event handler - * pipeline. The execution context is automatically set to be the first - * parameter passed to the event handler. + * @param {ContextSensitiveHandler} handler The function will be added to the bottom of the event + * handler pipeline. The execution context is automatically + * set to be the first parameter passed to the event handler. + * + * Use a reference to a named function rather than an + * anonymous function if you may later want to remove the + * event handler. */ addOnStageChange( handler: ContextSensitiveHandler ): void; + /** + * Use this to add a function as an event handler for the OnStageSelected event so that it will be called + * when a business process flow stage is selected. + * + * @param {ContextSensitiveHandler} handler The function will be added to the bottom of the event + * handler pipeline. The execution context is automatically + * set to be the first parameter passed to the event handler. + * + * Use a reference to a named function rather than an + * anonymous function if you may later want to remove the + * event handler. + */ + addOnStageSelected(handler: ContextSensitiveHandler): void; + + /** + * Use this to remove a function as an event handler for the OnStageChange event. + * + * @param {ContextSensitiveHandler} handler If an anonymous function is set using the addOnStageChange method it + * cannot be removed using this method. + */ + removeOnStageChange(handler: ContextSensitiveHandler): void; + /** * Use this to remove a function as an event handler for the OnStageChange event. * @@ -1621,7 +1570,7 @@ declare namespace Xrm * * @sa UiElement */ - export interface Control extends UiElement + export interface Control extends UiElement, UiFocusable { /** * Clears the notification identified by uniqueId. @@ -2037,7 +1986,7 @@ declare namespace Xrm * * @return The display state, as either "expanded" or "collapsed" */ - getDisplayState(): string; + getDisplayState(): ui.DisplayState; /** * Gets the name of the tab. @@ -2053,26 +2002,12 @@ declare namespace Xrm */ getParent(): Ui; - /** - * Sets display state of the tab. - * - * @param {"collapsed"} displayState Collapsed tab. - */ - setDisplayState( displayState: "collapsed" ): void; - - /** - * Sets display state of the tab. - * - * @param {"expanded"} displayState Expanded tab. - */ - setDisplayState( displayState: "expanded" ): void; - /** * Sets display state of the tab. * * @param {string} displayState Display state of the tab, as either "expanded" or "collapsed" */ - setDisplayState( displayState: string ): void; + setDisplayState(displayState: ui.DisplayState ): void; /** * A reference to the collection of form sections within this tab. @@ -2117,26 +2052,12 @@ declare namespace Xrm */ export interface ProcessManager { - /** - * Sets display state of the process flow control. - * - * @param {"collapsed"} displayState Collapsed process flow control. - */ - setDisplayState( displayState: "collapsed" ): void; - - /** - * Sets display state of the process flow control. - * - * @param {"expanded"} displayState Expanded process flow control. - */ - setDisplayState( displayState: "expanded" ): void; - /** * Sets display state of the process flow control. * * @param {string} displayState Display state of the process flow control, as either "expanded" or "collapsed" */ - setDisplayState( displayState: string ): void; + setDisplayState(displayState: ui.DisplayState ): void; /** * Sets the visibility state. @@ -2280,6 +2201,10 @@ declare namespace Xrm */ getEntityReference(): LookupValue; } + + export type FormNotificationLevel = "ERROR" | "INFO" | "WARNING"; + + export type DisplayState = "collapsed" | "expanded"; } /** @@ -2393,7 +2318,7 @@ declare namespace Xrm * Accepted values are: "true" (The command bar is displayed.) * "false" (The command bar is not displayed.) */ - cmdbar?: string; + cmdbar?: OpenParameters.CmdBarDisplay; /** * Controls whether the Navigation bar is displayed on the form. @@ -2402,7 +2327,7 @@ declare namespace Xrm * "entity" (On an entity form, only the navigation options for related * entities are available.) */ - navbar?: string; + navbar?: OpenParameters.NavBarDisplay; } /** @@ -2441,7 +2366,7 @@ declare namespace Xrm * Accepted values are: "true" (The command bar is displayed.) * "false" (The command bar is not displayed.) */ - cmdbar?: string; + cmdbar?: OpenParameters.CmdBarDisplay; /** * Controls whether the Navigation bar is displayed on the form. @@ -2450,7 +2375,7 @@ declare namespace Xrm * "entity" (On an entity form, only the navigation options for related * entities are available.) */ - navbar?: string; + navbar?: OpenParameters.NavBarDisplay; } /** @@ -2494,7 +2419,7 @@ declare namespace Xrm * @remarks "run" Executes the report with default filters. * "filter" Presents the user with the filter editor, and a "Run Report" button. */ - action: string; + action: ReportOpenParameters.Action; /** * The file name of the report. For out-of-box reports, this parameter enables context-sensitive @@ -2507,6 +2432,15 @@ declare namespace Xrm */ id: string; } + + export module ReportOpenParameters { + export type Action = "filter" | "run"; + } + } + + export module OpenParameters { + export type NavBarDisplay = "entity" | "off" | "on"; + export type CmdBarDisplay = "true" | "false"; } /** @@ -2544,14 +2478,14 @@ declare namespace Xrm * "entity" (On an entity form, only the navigation options for related * entities are available.) */ - navbar?: string; + navbar?: OpenParameters.NavBarDisplay; /** * Controls whether the command bar is displayed. * Accepted values are: "true" (The command bar is displayed.) * "false" (The command bar is not displayed.) */ - cmdbar?: string; + cmdbar?: OpenParameters.CmdBarDisplay; } /** @@ -2634,4 +2568,4 @@ declare namespace XrmEnum SystemView = 1039, UserView = 4230 } -} +} \ No newline at end of file From 1c5ce5244f36e9a03d01e5f82f9b8c3f36e41025 Mon Sep 17 00:00:00 2001 From: Daryl LaBar Date: Mon, 20 Jun 2016 11:17:21 -0400 Subject: [PATCH 2/3] Added Name to list of Authors via Dave Barry's request: https://twitter.com/crmentropy/status/744399133671206912 --- xrm/xrm.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xrm/xrm.d.ts b/xrm/xrm.d.ts index 14f1cf204b..474d232f7c 100644 --- a/xrm/xrm.d.ts +++ b/xrm/xrm.d.ts @@ -1,6 +1,6 @@ // Type definitions for Microsoft Dynamics xRM API v7.1 // Project: http://www.microsoft.com/en-us/download/details.aspx?id=44567 -// Definitions by: David Berry , Matt Ngan , Markus Mauch +// Definitions by: David Berry , Matt Ngan , Markus Mauch , Daryl LaBar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare var Xrm: Xrm.XrmStatic; From 7b465f81218a032c4abc6f4785e5697214261038 Mon Sep 17 00:00:00 2001 From: Daryl LaBar Date: Tue, 21 Jun 2016 09:06:20 -0400 Subject: [PATCH 3/3] Added String as valid types for set methods. Removed new Modules for string literal types. Moved String literal types to their parent namespaces. --- xrm/xrm-tests.ts | 15 +++--- xrm/xrm.d.ts | 123 +++++++++++++++++++++++++++-------------------- 2 files changed, 79 insertions(+), 59 deletions(-) diff --git a/xrm/xrm-tests.ts b/xrm/xrm-tests.ts index db0608d8cf..f3f4576b02 100644 --- a/xrm/xrm-tests.ts +++ b/xrm/xrm-tests.ts @@ -121,16 +121,17 @@ var level: Xrm.Page.ui.FormNotificationLevel; level = "ERROR"; Xrm.Page.ui.setFormNotification("Test", level, "uniqueId"); -/// Demonstrate +/// Demonstrate Requirement Level and Submit Mode both via string parameters and String Literal Types -let requirementlevel: Xrm.Page.Attribute.RequirementLevel; -requirementlevel = "none"; -let submitMode: Xrm.Page.Attribute.SubmitMode; -submitMode = "always"; +let requirementLevel: Xrm.Page.RequirementLevel = "none"; +let requirementLevelString = "none"; +let submitMode: Xrm.Page.SubmitMode = "always"; +let submitModeString = "always"; let attribute = Xrm.Page.getAttribute("customerid"); attribute.setSubmitMode(submitMode); -attribute.setRequiredLevel(requirementlevel); - +attribute.setSubmitMode(submitMode); +attribute.setRequiredLevel(requirementLevel); +attribute.setRequiredLevel(requirementLevelString); diff --git a/xrm/xrm.d.ts b/xrm/xrm.d.ts index 474d232f7c..cf2b4c77c3 100644 --- a/xrm/xrm.d.ts +++ b/xrm/xrm.d.ts @@ -210,6 +210,19 @@ declare namespace Xrm } } + /** + * Client Types for Xrm.Page.context.getClient(). + */ + export type Client = "Web" | "Outlook" | "Mobile"; + /** + * Client States for Xrm.Page.context.getClientState(). + */ + export type ClientState = "Online" | "Offline"; + /** + * Themes for Xrm.Page.context.getCurrentTheme(). + */ + export type Theme = "default" | "Office12Blue" | "Office14Silver"; + /** * Interface for the client context. */ @@ -220,19 +233,14 @@ declare namespace Xrm * * @return The client, as either "Web", "Outlook", or "Mobile" */ - getClient(): ClientContext.Client; + getClient(): Client; /** * Gets client's current state. * * @return The client state, as either "Online" or "Offline" */ - getClientState(): ClientContext.ClientState; - } - - export module ClientContext { - export type Client = "Web" | "Outlook" | "Mobile"; - export type ClientState = "Online" | "Offline"; + getClientState(): ClientState; } /** @@ -262,7 +270,7 @@ declare namespace Xrm * * @remarks This function does not work with Dynamics CRM for tablets. */ - getCurrentTheme(): Context.Theme; + getCurrentTheme(): Theme; /** * Gets whether automatic save is enabled. @@ -349,9 +357,6 @@ declare namespace Xrm prependOrgName( sPath: string ): string; } - export module Context { - export type Theme = "default" | "Office12Blue" | "Office14Silver"; - } /** * Interface for the Xrm.Page.data object. */ @@ -445,7 +450,7 @@ declare namespace Xrm */ refreshRibbon(): void; - setFormNotification(message: string, level: Page.ui.FormNotificationLevel, uniqueId: string ): boolean; + setFormNotification(message: string, level: Page.ui.FormNotificationLevel | string, uniqueId: string ): boolean; process: Page.data.ProcessManager; @@ -612,6 +617,23 @@ declare namespace Xrm */ export module Page { + /** + * Requirement Level for Xrm.Page.Attribute.getRequiredLevel() and Xrm.Page.Attribute.setRequiredLevel(). + */ + export type RequirementLevel = "none" | "recommended" | "required"; + /** + * Save Modes for Xrm.Page.Entity.save(). + */ + export type SaveMode = "saveandclose" | "saveandnew"; + /** + * Status for Xrm.Page.Stage.getStatus(). + */ + export type Status = "active" | "inactive"; + /** + * Submit Mode for Xrm.Page.Attribute.getSubmitMode() and Xrm.Page.Attribute.setSubmitMode(). + */ + export type SubmitMode = "always" | "dirty" | "never"; + /** * Interface for a CRM Business Process Flow instance. */ @@ -691,7 +713,7 @@ declare namespace Xrm * * @remarks This method will return either "active" or "inactive". */ - getStatus(): Stage.Status; + getStatus(): Status; /** * Returns a collection of steps in the stage. @@ -701,10 +723,6 @@ declare namespace Xrm getSteps(): Step[]; } - export module Stage { - export type Status = "active" | "inactive"; - } - export interface Step { /** @@ -991,7 +1009,7 @@ declare namespace Xrm * * @return The required level, as either "none", "required", or "recommended" */ - getRequiredLevel(): Attribute.RequirementLevel; + getRequiredLevel(): RequirementLevel; /** * Gets current submit mode for the attribute. @@ -1000,7 +1018,7 @@ declare namespace Xrm * * @remarks The default value is "dirty" */ - getSubmitMode(): Attribute.SubmitMode; + getSubmitMode(): SubmitMode; /** * Gets the current user's privileges for the attribute. @@ -1021,7 +1039,7 @@ declare namespace Xrm * * @param {string} requirementLevel The requirement level, as either "none", "required", or "recommended" */ - setRequiredLevel(requirementLevel: Attribute.RequirementLevel): void; + setRequiredLevel(requirementLevel: RequirementLevel | string): void; /** * Sets the submit mode. @@ -1030,7 +1048,7 @@ declare namespace Xrm * * @remarks The default value is "dirty" */ - setSubmitMode(submitMode: Attribute.SubmitMode): void; + setSubmitMode(submitMode: SubmitMode | string): void; /** * A collection of all the controls on the form that interface with this attribute. @@ -1038,11 +1056,6 @@ declare namespace Xrm controls: Collection.ItemCollection; } - export module Attribute { - export type RequirementLevel = "none" | "recommended" | "required" ; - export type SubmitMode = "always" | "dirty" | "never"; - } - /** * Interface for a Number attribute. * @@ -1362,7 +1375,7 @@ declare namespace Xrm * @param {string} saveMode (Optional) the save mode to save, as either "saveandclose" or * "saveandnew". */ - save( saveMode: Entity.SaveMode ): void; + save( saveMode: SaveMode | string): void; /** * The collection of attributes for the record. @@ -1370,10 +1383,6 @@ declare namespace Xrm attributes: Collection.ItemCollection; } - export module Entity { - export type SaveMode = "saveandclose" | "saveandnew"; - } - /** * Interface for save event arguments. */ @@ -2007,7 +2016,7 @@ declare namespace Xrm * * @param {string} displayState Display state of the tab, as either "expanded" or "collapsed" */ - setDisplayState(displayState: ui.DisplayState ): void; + setDisplayState(displayState: ui.DisplayState | string ): void; /** * A reference to the collection of form sections within this tab. @@ -2047,6 +2056,16 @@ declare namespace Xrm */ export module ui { + /** + * Form Notification Levels for Xrm.Ui.setFormNotification(). + */ + export type FormNotificationLevel = "ERROR" | "INFO" | "WARNING"; + + /** + * Display States for Xrm.ui.ProcessMonitor.setDisplayState(). + */ + export type DisplayState = "collapsed" | "expanded"; + /** * Interface for Xrm.Page.ui.process API */ @@ -2201,10 +2220,6 @@ declare namespace Xrm */ getEntityReference(): LookupValue; } - - export type FormNotificationLevel = "ERROR" | "INFO" | "WARNING"; - - export type DisplayState = "collapsed" | "expanded"; } /** @@ -2287,6 +2302,19 @@ declare namespace Xrm */ export module Url { + /** + * Command Bar Display options for Xrm.Url.FormOpenParameters.cmdbar, Xrm.Url.ViewOpenParameters.cmdbar, and Xrm.Utility.FormOpenParameters.cmdbar. + */ + export type CmdBarDisplay = "true" | "false"; + /** + * Navigation Bar Display options for Xrm.Url.FormOpenParameters.navbar, Xrm.Url.ViewOpenParameters.navbar, and Xrm.Utility.FormOpenParameters.navbar. + */ + export type NavBarDisplay = "entity" | "off" | "on"; + /** + * Report Open Action options for Xrm.Url.ReportOpenParameters.actions. + */ + export type ReportAction = "filter" | "run"; + /** * Interface for defining parameters on a request to open a form with main.aspx (as with * window.open). Useful for parsing the keys and values into a string of the format: @@ -2318,7 +2346,7 @@ declare namespace Xrm * Accepted values are: "true" (The command bar is displayed.) * "false" (The command bar is not displayed.) */ - cmdbar?: OpenParameters.CmdBarDisplay; + cmdbar?: CmdBarDisplay; /** * Controls whether the Navigation bar is displayed on the form. @@ -2327,7 +2355,7 @@ declare namespace Xrm * "entity" (On an entity form, only the navigation options for related * entities are available.) */ - navbar?: OpenParameters.NavBarDisplay; + navbar?: NavBarDisplay; } /** @@ -2366,7 +2394,7 @@ declare namespace Xrm * Accepted values are: "true" (The command bar is displayed.) * "false" (The command bar is not displayed.) */ - cmdbar?: OpenParameters.CmdBarDisplay; + cmdbar?: CmdBarDisplay; /** * Controls whether the Navigation bar is displayed on the form. @@ -2375,7 +2403,7 @@ declare namespace Xrm * "entity" (On an entity form, only the navigation options for related * entities are available.) */ - navbar?: OpenParameters.NavBarDisplay; + navbar?: NavBarDisplay; } /** @@ -2419,7 +2447,7 @@ declare namespace Xrm * @remarks "run" Executes the report with default filters. * "filter" Presents the user with the filter editor, and a "Run Report" button. */ - action: ReportOpenParameters.Action; + action: ReportAction; /** * The file name of the report. For out-of-box reports, this parameter enables context-sensitive @@ -2432,15 +2460,6 @@ declare namespace Xrm */ id: string; } - - export module ReportOpenParameters { - export type Action = "filter" | "run"; - } - } - - export module OpenParameters { - export type NavBarDisplay = "entity" | "off" | "on"; - export type CmdBarDisplay = "true" | "false"; } /** @@ -2478,14 +2497,14 @@ declare namespace Xrm * "entity" (On an entity form, only the navigation options for related * entities are available.) */ - navbar?: OpenParameters.NavBarDisplay; + navbar?: Url.NavBarDisplay; /** * Controls whether the command bar is displayed. * Accepted values are: "true" (The command bar is displayed.) * "false" (The command bar is not displayed.) */ - cmdbar?: OpenParameters.CmdBarDisplay; + cmdbar?: Url.CmdBarDisplay; } /**