Skip to content

Commit

Permalink
Support for CRM2016 Autocomplete methods
Browse files Browse the repository at this point in the history
  • Loading branch information
scottdurow committed Nov 21, 2015
1 parent e936134 commit 11159f4
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 1 deletion.
1 change: 1 addition & 0 deletions SparkleXrmSource/SparkleXrm/SparkleXrm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
<Compile Include="XrmImport\Page\Client.cs" />
<Compile Include="XrmImport\Page\ClientStateType.cs" />
<Compile Include="XrmImport\Page\ClientType.cs" />
<Compile Include="XrmImport\Page\Ui\AutocompleteResultsSet.cs" />
<Compile Include="XrmImport\Page\Ui\Data\Process\Category.cs" />
<Compile Include="XrmImport\Page\Ui\Data\Process\ClientCollection.cs" />
<Compile Include="XrmImport\Page\Ui\Data\Process\DataProcess.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// AutocompleteResults.cs
//

using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

namespace Xrm.XrmImport.Page.Ui
{
[Imported]
[ScriptName("Object")]
[IgnoreNamespace]
public class AutocompleteResultSet
{
public List<AutocompleteResult> Results;
public AutocompleteAction Commands;
}

[Imported]
[ScriptName("Object")]
[IgnoreNamespace]
public class AutocompleteResult
{
public string Id;
public string Icon;
public string[] Fields;
}

[Imported]
[ScriptName("Object")]
[IgnoreNamespace]
public class AutocompleteAction
{
public string Id;
public string Icon;
public string Label;
public Action Action;
}
}
45 changes: 45 additions & 0 deletions SparkleXrmSource/SparkleXrm/XrmImport/Page/Ui/Control.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,5 +291,50 @@ public void SetSrc(string src)
public void SetVisible(bool visible)
{
}

/// <summary>
/// Use this to add a function as an event handler for the keypress event so that the function is called when you type a character in the specific text or number field.
/// </summary>
/// <param name="keyPressFunction">The function will be added to the bottom of the event handler pipeline. The execution context is automatically set to be passed as the first parameter passed to event handler set using this method.
/// You should use reference to a named function rather than an anonymous function if you may later want to remove the event handler for the field.</param>
public void AddOnKeyPress(ExecutionContextFunctionHandler keyPressFunction)
{
}

/// <summary>
/// Use this to remove an event handler for a text or number field that you added using addOnKeyPress.
/// </summary>
/// <param name="keyPressFunction">If an anonymous function is set using addOnKeyPress, it can’t be removed using this method.</param>
public void RemoveOnKeyPress(ExecutionContextFunctionHandler keyPressFunction)
{
}

/// <summary>
/// Use this to manually fire an event handler that you created for a specific text or number field to be executed on the keypress event.
/// </summary>
public void FireOnKeyPress()
{
}

/// <summary>
/// Retrieves the data value for an attribute
/// </summary>
/// <returns>Depends on type of attribute</returns>
public object GetValue()
{

return null;
}


/// <summary>
/// Retrieves the data value for an attribute
/// </summary>
/// <returns>Depends on type of attribute</returns>
public T GetValue<T>()
{
object o = new object();
return (T)o;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Runtime.CompilerServices;
using Xrm.XrmImport.Page.Ui;

namespace Xrm
{
Expand Down Expand Up @@ -382,5 +383,24 @@ public void SetValue<T>(T value)
{

}

/// <summary>
/// Use this to show up to 10 matching strings in a drop-down list as users press keys to type character
/// in a specific text field. You can also add a custom command with an icon at the bottom of the drop-down list.
/// On selecting an item in the drop-down list, the value in the text field changes to the selected item,
/// the drop-down list disappears, and the OnChange event for the text field is invoked.
/// </summary>
/// <param name="results">Object that defines the result set, which includes results and commands, to be displayed in the auto-completion drop-down list.</param>
public void ShowAutoComplete(AutocompleteResultSet results)
{

}

/// <summary>
/// Use this function to hide the auto-completion drop-down list you configured for a specific text field.
/// </summary>
public void HideAutoComplete()
{
}
}
}
23 changes: 22 additions & 1 deletion SparkleXrmSource/SparkleXrm/XrmImport/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,20 @@ public static object OpenEntityForm(string name, string id, object parameters)
{
return null;
}

/// <summary>
/// Opens an entity form
/// </summary>
/// <param name="name">The logical name of an entity</param>
/// <param name="id">The string representation of a unique identifier or the record to open in the form. If not set, a form to create a new record is opened</param>
/// <param name="parameters">A dictionary object that passes extra query string parameters to the form. Invalid query string parameters will cause an error</param>
/// <param name="windowOptions">For Microsoft Dynamics CRM Online 2015 Update 1 or later use this optional parameter in the web application to control how the form opens. You can choose to open a form in a new window by passing a dictionary object with a Boolean openInNewWindow property set to true.
/// This parameter is ignored in CRM for tablets and CRM for phones. </param>
/// <remarks>This function provides a better developer experience than the process of manipulating the URL passed to the window.open method described in Open forms, views, dialogs and reports with a URL. Using this function also helps ensure that users are not prompted to log in again under certain circumstances. </remarks>
[ScriptName("openEntityForm")]
public static object OpenEntityForm2(string name, string id, object parameters, OpenEntityFormOptions windowOptions)
{
return null;
}
/// <summary>
/// Opens an HTML web resource.
/// </summary>
Expand Down Expand Up @@ -79,4 +92,12 @@ public static string encodeURIComponent(string values)
}

}

[Imported]
[IgnoreNamespace]
[ScriptName("Object")]
public class OpenEntityFormOptions
{
public bool OpenInNewWindow;
}
}

0 comments on commit 11159f4

Please sign in to comment.