Articles

Affichage des articles du décembre, 2018

Quick Create, open created record

The idea is , when you create a record with quick create, to redirect directly on created record. sometime you have a yellow button on the top right but in my case the yeallow button with the link to the new created record did not appear.
then I decide to redirect with JS

then yes we have function in a function

function MyBaseFunction()

 Xrm.Utility.openQuickCreate("incident", recordId, parameters).then

function (lookup)
{
successCallback(lookup);
},
function (error)
{
errorCallback(error);
}
 );


    function successCallback(lookup) {
        setTimeout(function () { Xrm.Page.data.entity.refresh(); }, 1000);
        Xrm.Utility.openEntityForm("incident", lookup.savedEntityReference.id, null, null);
        setTimeout(function () { Xrm.Page.data.entity.refresh(); }, 1000);
    }

    // **** Function called on error.
    function errorCallback(e) {  // *** No new contact created, which is an error we can ignore!
        alert("Error: " + e.errorCode + "…

Make CRM Faster

it s quite the same logic as here

https://www.linkedin.com/pulse/recently-viewed-items-performance-issuebug-ziv-ben-or/

the idea is too clean the historic of recently viewed item

  static void Main(string[] args)
        {

            ConnectToCRM();
            var fetchXml = $@"
<fetch>
  <entity name='userentityuisettings'>
    <attribute name='userentityuisettingsid' />
    <attribute name='recentlyviewedxml' />
    <attribute name = 'lastviewedformxml' />
    <filter type='and'>
      <condition attribute='recentlyviewedxml' operator='not-null' />
    </filter>
  </entity>
</fetch>";
                            string max;

            Console.WriteLine("How Manny history do you want to keep Minimum is 1: ");
            max = Console.ReadLine();

            if (Convert.ToInt32(max)<=0)
            {
                Console.WriteLine("You …

How to connect to Crm Dynamics On Premis 2016 with Consol App

private static void ConnectToCRM()
{
try
{
string OrganizationURL = ConfigurationManager.AppSettings["OrganizationURL"];
OrganizationURL += "/XRMServices/2011/Organization.svc";
_orgServiceManagement = ServiceConfigurationFactory.CreateManagement<IOrganizationService>(new Uri(OrganizationURL));
ClientCredentials Credentials = new ClientCredentials();
Credentials.Windows.ClientCredential = (NetworkCredential)CredentialCache.DefaultCredentials;
_service = new OrganizationServiceProxy(_orgServiceManagement, Credentials);
//LogHelper.Info("\r\nConnected to {0}\r\n ", OrganizationURL);
WhoAmIRequest req = new WhoAmIRequest();
WhoAmIResponse resp = (WhoAmIResponse)_service.Execute(req);
// LogHelper.Info("User ID: " + resp.UserId);
//Guid currentUserId = resp.UserId;
}
catch (Exception ex)
{
Console.WriteLine();
Console.WriteLine("An error occured trying to connect to the MS CRM Server.\nPlease verify your login data.");
Console.Wri…