Author: andrewcampey

Dynamics 365 – Extending the 10000 Record Limit when exporting to Excel

There is a restriction on exporting records to Excel in Dynamics 365. You can only export up to 10,000 records.

If you are on premise you can modify the registry to fix this, if you are using CRM Online (or don’t want to touch the registry) you can use the following code to modify the Organization attribute “maxrecordsforexporttoexcel”.

public static void Main(string[] args)
        {
            OrganizationServiceProxy _serviceProxy = null;
            IOrganizationService _service;

            Uri crmURI = new Uri("https://{ORGANIZATION}.api.{crmregion}.dynamics.com/XRMServices/2011/Organization.svc");

            ClientCredentials clientCredentials = new ClientCredentials();
            clientCredentials.UserName.UserName = "username";
            clientCredentials.UserName.Password = "password";

            using (_serviceProxy = new OrganizationServiceProxy(crmURI, null, clientCredentials, null))
            {
                QueryExpression query = new QueryExpression();
                query.EntityName = "organization";
                query.ColumnSet = new ColumnSet() { AllColumns = true };
             
                _service = (IOrganizationService)_serviceProxy;
           
                EntityCollection entities = _service.RetrieveMultiple(query);
                if (entities.Entities.Count == 1)
                {
                    if (entities.Entities[0].Attributes.Contains("maxrecordsforexporttoexcel"))
                    {
                        entities.Entities[0].Attributes["maxrecordsforexporttoexcel"] = 20000;
                        _service.Update(entities.Entities[0]);
                    }
                }
            }
        }

NOTE: This function can be used for all organization attributes that are editable (the original list can be found here – http://msdn.microsoft.com/en-us/library/gg328408(v=crm.6).aspx)

Attribute
Schema Name
Display Name Type Description
AcknowledgementTemplateId Acknowledgement Template Lookup ID of the template to be used for acknowledgement when a user
unsubscribes.
AllowAddressBookSyncs Allow Address Book Synchronization Boolean Indicates whether background address book synchronization in Microsoft
Office Outlook is allowed.
AllowAutoResponseCreation Allow Automatic Response Creation Boolean Indicates whether automatic response creation is allowed.
AllowAutoUnsubscribe Allow Automatic Unsubscribe Boolean Indicates whether automatic unsubscribe is allowed.
AllowAutoUnsubscribeAcknowledgement Allow Automatic Unsubscribe Acknowledgement Boolean Indicates whether automatic unsubscribe acknowledgement email is allowed
to send.
AllowClientMessageBarAd Allow Outlook Client Message Bar Advertisement Boolean Indicates whether the Microsoft Dynamics CRM for Outlook message bar
advertisement is allowed.
AllowEntityOnlyAudit Allow Entity Level Auditing Boolean Indicates whether auditing of changes to entity is allowed when no
attributes have changed.
AllowMarketingEmailExecution Allow Marketing Email Execution Boolean Indicates whether marketing emails execution is allowed.
AllowOfflineScheduledSyncs Allow Offline Scheduled Synchronization Boolean Indicates whether background offline synchronization in Microsoft Office
Outlook is allowed.
AllowOutlookScheduledSyncs Allow Scheduled Synchronization Boolean Indicates whether scheduled synchronizations to Outlook are allowed.
AllowUnresolvedPartiesOnEmailSend Allow Unresolved Address Email Send Boolean Indicates whether users are allowed to send email to unresolved parties
(parties must still have an email address).
AllowUserFormModePreference Allow User Form Mode Preference Boolean Indicates whether individuals can select their form mode preference in
their personal options.
AllowUsersSeeAppdownloadMessage Allow the showing tablet application notification bars in a browser. Boolean Indicates whether showing tablet application notification bars in a
browser is allowed.
AllowWebExcelExport Allow Export to Excel Boolean Indicates whether web-based export of grids to Microsoft Office Excel is
allowed.
AMDesignator AM Designator String AM designator to use throughout Microsoft Dynamics CRM.
BaseCurrencyId Currency Lookup ID of the base currency of the organization.
BaseCurrencyPrecision Base Currency Precision Integer Number of decimal places that can be used for the base currency.
BaseCurrencySymbol Base Currency Symbol String Symbol used for the base currency.
BaseISOCurrencyCode Base ISO Currency Code String Base ISO currency code.
BingMapsApiKey Bing Maps API Key String API Key to be used in requests to Bing Maps services.
BlockedAttachments Block Attachments String Prevent upload or download of certain attachment types that are
considered dangerous.
BulkOperationPrefix Bulk Operation Prefix String Prefix used for bulk operation numbering.
BusinessClosureCalendarId Business Closure Calendar Unique identifier ID of the business closure calendar of organization.
CalendarType Calendar Type Integer Calendar type for the system. Set to Gregorian US by default.
CampaignPrefix Campaign Prefix String Prefix used for campaign numbering.
CasePrefix Case Prefix String Prefix to use for all cases throughout Microsoft Dynamics CRM.
ContractPrefix Contract Prefix String Prefix to use for all contracts throughout Microsoft Dynamics CRM.
CreatedBy Created By Lookup ID of the user who created the organization.
CreatedOn Created On DateTime Date and time when the organization was created.
CreatedOnBehalfBy Created By (Delegate) Lookup ID of the delegate user who created the organization.
CurrencyDecimalPrecision Currency Decimal Precision Integer Number of decimal places that can be used for currency.
CurrencyDisplayOption Display Currencies Using Picklist Indicates whether to display money fields with currency code or currency
symbol.
CurrencyFormatCode Currency Format Code Picklist Information about how currency symbols are placed throughout Microsoft
Dynamics CRM.
CurrencySymbol Currency Symbol String Symbol used for currency throughout Microsoft Dynamics CRM.
CurrentBulkOperationNumber Current Bulk Operation Number Integer Current bulk operation number.
CurrentCampaignNumber Current Campaign Number Integer Current campaign number.
CurrentCaseNumber Current Case Number Integer First case number to use.
CurrentContractNumber Current Contract Number Integer First contract number to use.
CurrentImportSequenceNumber Current Import Sequence Number Integer Import sequence to use.
CurrentInvoiceNumber Current Invoice Number Integer First invoice number to use.
CurrentKbNumber Current Article Number Integer First article number to use.
CurrentOrderNumber Current Order Number Integer First order number to use.
CurrentParsedTableNumber Current Parsed Table Number Integer First parsed table number to use.
CurrentQuoteNumber Current Quote Number Integer First quote number to use.
DateFormatCode Date Format Code Picklist Information about how the date is displayed throughout Microsoft Dynamics
CRM.
DateFormatString Date Format String String String showing how the date is displayed throughout Microsoft Dynamics
CRM.
DateSeparator Date Separator String Character used to separate the month, the day, and the year in dates
throughout Microsoft Dynamics CRM.
DecimalSymbol Decimal Symbol String Symbol used for decimal in Microsoft Dynamics CRM.
DefaultCountryCode Default Country Code String Text area to enter default country code.
DefaultEmailServerProfileId Email Server Profile Lookup ID of the default email server profile.
DefaultEmailSettings Default Email Settings String XML string containing the default email settings that are applied when a
user or queue is created.
DefaultRecurrenceEndRangeType Default Recurrence End Range Type Picklist Type of default recurrence end range date.
DisabledReason Disabled Reason String Reason for disabling the organization.
EmailConnectionChannel Email Connection Channel Picklist Select if you want to use the Email Router or server-side synchronization
for email processing.
EmailCorrelationEnabled Use Email Correlation Boolean Flag to turn email correlation on or off.
EmailSendPollingPeriod Email Send Polling Frequency Integer Normal polling frequency used for sending email in Microsoft Office
Outlook.
EnableBingMapsIntegration Enable Integration with Bing Maps Boolean Enable Integration with Bing Maps.
EnablePricingOnCreate Enable Pricing On Create Boolean Enable pricing calculations on a Create call.
EnableSmartMatching Enable Smart Matching Boolean Use Smart Matching.
ExpireSubscriptionsInDays Days to Expire Subscriptions Integer Maximum number of days before deleting inactive subscriptions.
FeatureSet Feature Set String Features to be enabled as an XML BLOB.
FiscalCalendarStart Fiscal Calendar Start DateTime Start date for the fiscal period that is to be used throughout Microsoft
Dynamics CRM.
FiscalPeriodFormat Fiscal Period Format String Information that specifies how the name of the fiscal period is displayed
throughout Microsoft Dynamics CRM.
FiscalPeriodFormatPeriod Format for Fiscal Period Picklist Format in which the fiscal period will be displayed.
FiscalPeriodType Fiscal Period Type Integer Type of fiscal period used throughout Microsoft Dynamics CRM.
FiscalSettingsUpdated Is Fiscal Settings Updated Boolean Information that specifies whether the fiscal settings have been updated.
FiscalYearDisplayCode Fiscal Year Display Integer Information that specifies whether the fiscal year should be displayed
based on the start date or the end date of the fiscal year.
FiscalYearFormat Fiscal Year Format String Information that specifies how the name of the fiscal year is displayed
throughout Microsoft Dynamics CRM.
FiscalYearFormatPrefix Prefix for Fiscal Year Picklist Prefix for the display of the fiscal year.
FiscalYearFormatSuffix Suffix for Fiscal Year Picklist Suffix for the display of the fiscal year.
FiscalYearFormatYear Fiscal Year Format Year Picklist Format for the year.
FiscalYearPeriodConnect Fiscal Year Period Connector String Information that specifies how the names of the fiscal year and the
fiscal period should be connected when displayed together.
FullNameConventionCode Full Name Display Order Picklist Order in which names are to be displayed throughout Microsoft Dynamics
CRM.
FutureExpansionWindow Future Expansion Window Integer Specifies the maximum number of months in future for which the recurring
activities can be created.
GenerateAlertsForErrors Generate Alerts For Errors Boolean Indicates whether alerts will be generated for errors.
GenerateAlertsForInformation Generate Alerts For Information Boolean Indicates whether alerts will be generated for information.
GenerateAlertsForWarnings Generate Alerts For Warnings Boolean Indicates whether alerts will be generated for warnings.
GetStartedPaneContentEnabled Is Get Started Pane Content Enabled Boolean Indicates whether Get Started content is enabled for this organization.
GoalRollupExpiryTime Rollup Expiration Time for Goal Integer Number of days after the goal’s end date after which the rollup of the
goal stops automatically.
GoalRollupFrequency Automatic Rollup Frequency for Goal Integer Number of hours between automatic rollup jobs .
HashDeltaSubjectCount Hash Delta Subject Count Integer Maximum difference allowed between subject keywords count of the email
messaged to be correlated.
HashFilterKeywords Hash Filter Keywords String Filter subject keywords.
HashMaxCount Hash Max Count Integer Maximum number of subject keywords or recipients used for correlation.
HashMinAddressCount Hash Min Address Count Integer Minimum number of recipients required to match for email messaged to be
correlated
IgnoreInternalEmail Ignore Internal Email Boolean Indicates whether incoming email sent by internal Microsoft Dynamics CRM
users or queues should be tracked.
IncomingEmailExchangeEmailRetrievalBatchSize Exchange Email Retrieval Batch Size Integer Setting for the Async Service Mailbox Queue. Defines the retrieval batch
size of exchange server.
InitialVersion Initial Version String Initial version of the organization.
IntegrationUserId Integration User Unique identifier ID of the integration user for the organization.
InvoicePrefix Invoice Prefix String Prefix to use for all invoice numbers throughout Microsoft Dynamics CRM.
IsAppMode Is Application Mode Enabled Boolean Indicates whether loading of Microsoft Dynamics CRM in a browser window
that does not have address, tool, and menu bars is enabled.
IsAuditEnabled Is Auditing Enabled Boolean Enable or disable auditing of changes.
IsAutoSaveEnabled Auto Save Enabled Boolean Information on whether auto save is enabled.
IsDefaultCountryCodeCheckEnabled Enable or disable country code selection Boolean Enable or disable country code selection.
IsDisabled Is Organization Disabled Boolean Information that specifies whether the organization is disabled.
IsDuplicateDetectionEnabled Is Duplicate Detection Enabled Boolean Indicates whether duplicate detection of records is enabled.
IsDuplicateDetectionEnabledForImport Is Duplicate Detection Enabled For Import Boolean Indicates whether duplicate detection of records during import is
enabled.
IsDuplicateDetectionEnabledForOfflineSync Is Duplicate Detection Enabled For Offline Synchronization Boolean Indicates whether duplicate detection of records during offline
synchronization is enabled.
IsDuplicateDetectionEnabledForOnlineCreateUpdate Is Duplicate Detection Enabled for Online Create/Update Boolean Indicates whether duplicate detection during online create or update is
enabled.
IsFiscalPeriodMonthBased Is Fiscal Period Monthly Boolean Indicates whether the fiscal period is displayed as the month number.
IsPresenceEnabled Presence Enabled Boolean Information on whether IM presence is enabled.
IsSOPIntegrationEnabled Is Sales Order Integration Enabled Boolean Enable sales order processing integration.
IsUserAccessAuditEnabled Is User Access Auditing Enabled Boolean Enable or disable auditing of user access.
ISVIntegrationCode ISV Integration Mode Picklist Indicates whether loading of Microsoft Dynamics CRM in a browser window
that does not have address, tool, and menu bars is enabled.
KbPrefix Article Prefix String Prefix to use for all articles in Microsoft Dynamics CRM.
LanguageCode Language Integer Preferred language for the organization.
LocaleId Locale Integer ID of the locale of the organization.
LongDateFormatCode Long Date Format Integer Information that specifies how the Long Date format is displayed in
Microsoft Dynamics CRM.
MaxAppointmentDurationDays Max Appointment Duration Integer Maximum number of days an appointment can last.
MaximumActiveBusinessProcessFlowsAllowedPerEntity Maximum active business process flows per entity Integer Maximum number of active business process flows allowed per entity
MaximumTrackingNumber Max Tracking Number Integer Maximum tracking number before recycling takes place.
MaxRecordsForExportToExcel Max Records For Excel Export Integer Maximum number of records that will be exported to a static Microsoft
Office Excel worksheet when exporting from the grid.
MaxRecordsForLookupFilters Max Records Filter Selection Integer Maximum number of lookup and picklist records that can be selected by
user for filtering.
MaxUploadFileSize Max Upload File Size Integer Maximum allowed size of an attachment.
MetadataSyncLastTimeOfNeverExpiredDeletedObjects The last date/time for never expired metadata tracking deleted objects DateTime What is the last date/time where there are metadata tracking deleted
objects that have never been outside of the expiration period.
MetadataSyncTimestamp Metadata sync version BigInt Contains the maximum version number for attributes used by metadata
synchronization that have changed.
MinAddressBookSyncInterval Min Address Synchronization Frequency Integer Normal polling frequency used for address book synchronization in
Microsoft Office Outlook.
MinOfflineSyncInterval Min Offline Synchronization Frequency Integer Normal polling frequency used for background offline synchronization in
Microsoft Office Outlook.
MinOutlookSyncInterval Min Synchronization Frequency Integer Minimum allowed time between scheduled Outlook synchronizations.
ModifiedBy Modified By Lookup ID of the user who last modified the organization.
ModifiedOn Modified On DateTime Date and time when the organization was last modified.
ModifiedOnBehalfBy Modified By (Delegate) Lookup ID of the delegate user who last modified the organization.
Name Organization Name String Name of the organization. The name is set when Microsoft Dynamics CRM is
installed and should not be changed.
NegativeCurrencyFormatCode Negative Currency Format Integer Information that specifies how negative currency numbers are displayed
throughout Microsoft Dynamics CRM.
NegativeFormatCode Negative Format Picklist Information that specifies how negative numbers are displayed throughout
Microsoft Dynamics CRM.
NextCustomObjectTypeCode Next Entity Type Code Integer Next entity type code to use for custom entities.
NextTrackingNumber Next Tracking Number Integer Next token to be placed on the subject line of an email message.
NotifyMailboxOwnerOfEmailServerLevelAlerts Notify Mailbox Owner Of Email Server Level Alerts Boolean Indicates whether mailbox owners will be notified of email server profile
level alerts.
NumberFormat Number Format String Specification of how numbers are displayed throughout Microsoft Dynamics
CRM.
NumberGroupFormat Number Grouping Format String Specifies how numbers are grouped in Microsoft Dynamics CRM.
NumberSeparator Number Separator String Symbol used for number separation in Microsoft Dynamics CRM.
OrderPrefix Order Prefix String Prefix to use for all orders throughout Microsoft Dynamics CRM.
OrganizationId Organization Unique identifier ID of the organization.
OrgDbOrgSettings Organization Database Organization Settings String Organization settings stored in Organization Database.
ParsedTableColumnPrefix Parsed Table Column Prefix String Prefix used for parsed table columns.
ParsedTablePrefix Parsed Table Prefix String Prefix used for parsed tables.
PastExpansionWindow Past Expansion Window Integer Specifies the maximum number of months in past for which the recurring
activities can be created.
PinpointLanguageCode Pinpoint Language Code Integer Language code to use for Pinpoint.
PMDesignator PM Designator String PM designator to use throughout Microsoft Dynamics CRM.
PricingDecimalPrecision Pricing Decimal Precision Integer Number of decimal places that can be used for prices.
PrivilegeUserGroupId Privilege User Group Unique identifier ID of the default privilege for users in the organization.
QuickFindRecordLimitEnabled Quick Find Record Limit Enabled Boolean Indicates whether a quick find record limit should be enabled for this
organization (allows for faster Quick Find queries but prevents overly broad
searches).
QuotePrefix Quote Prefix String Prefix to use for all quotes throughout Microsoft Dynamics CRM.
RecurrenceDefaultNumberOfOccurrences Recurrence Default Number of Occurrences Integer Specifies the default value for number of occurrences field in the
recurrence dialog.
RecurrenceExpansionJobBatchInterval Recurrence Expansion Job Batch Interval Integer Specifies the interval (in seconds) for pausing expansion job.
RecurrenceExpansionJobBatchSize Recurrence Expansion On Demand Job Batch Size Integer Specifies the value for number of instances created in on demand job in
one shot.
RecurrenceExpansionSynchCreateMax Recurrence Expansion Synchronization Create Maximum Integer Specifies the maximum number of instances to be created synchronously
after creating a recurring appointment.
ReferenceSiteMapXml Reference SiteMap XML String XML string that defines the navigation structure for the application.
This is the site map from the previously upgraded build and is used in a
3-way merge during upgrade.
RenderSecureIFrameForEmail Render Secure Frame For Email Boolean Flag to render the body of email in the Web form in an IFRAME with the
security=’restricted’ attribute set. This is additional security but can
cause a credentials prompt.
ReportScriptErrors Report Script Errors Picklist Picklist for selecting the organization preference for reporting
scripting errors.
RequireApprovalForQueueEmail Is Approval For Queue Email Required Boolean Indicates whether Send As Other User privilege is enabled.
RequireApprovalForUserEmail Is Approval For User Email Required Boolean Indicates whether Send As Other User privilege is enabled.
SampleDataImportId Sample Data Import Unique identifier ID of the sample data import job.
SchemaNamePrefix Customization Name Prefix String Prefix used for custom entities and attributes.
ShareToPreviousOwnerOnAssign Share To Previous Owner On Assign Boolean Information that specifies whether to share to previous owner on assign.
ShowWeekNumber Show Week Number Boolean Information that specifies whether to display the week number in calendar
displays throughout Microsoft Dynamics CRM.
SignupOutlookDownloadFWLink CRMForOutlookDownloadURL String Specifies the Microsoft Dynamics CRM for Outlook download URL.
SiteMapXml SiteMap XML Memo XML string that defines the navigation structure for the application.
SQMEnabled Is SQM Enabled Boolean Setting for SQM data collection, 0 no, 1 yes enabled
SupportUserId Support User Unique identifier ID of the support user for the organization.
SystemUserId System User Unique identifier ID of the system user for the organization.
TagMaxAggressiveCycles Auto-Tag Max Cycles Integer Maximum number of aggressive polling cycles executed for email
auto-tagging when a new email is received.
TagPollingPeriod Auto-Tag Interval Integer Normal polling frequency used for email receive auto-tagging in Outlook.
TimeFormatCode Time Format Code Picklist Information that specifies how the time is displayed throughout Microsoft
Dynamics CRM.
TimeFormatString Time Format String String Text for how time is displayed in Microsoft Dynamics CRM.
TimeSeparator Time Separator String Text for how the time separator is displayed throughout Microsoft
Dynamics CRM.
TokenExpiry Token Expiration Duration Integer Duration used for token expiration.
TokenKey Token Key String Token key.
TrackingPrefix Tracking Prefix String History list of tracking token prefixes.
TrackingTokenIdBase Tracking Token Base Integer Base number used to provide separate tracking token identifiers to users
belonging to different deployments.
TrackingTokenIdDigits Tracking Token Digits Integer Number of digits used to represent a tracking token identifier.
UniqueSpecifierLength Unique String Length Integer Number of characters appended to invoice, quote, and order numbers.
UserAccessAuditingInterval User Authentication Auditing Interval Integer The interval at which user access is checked for auditing.
UseReadForm Use Read-Optimized Form Boolean Indicates whether the read-optimized form should be enabled for this
organization.
UserGroupId User Group Unique identifier ID of the default group of users in the organization.
UseSkypeProtocol User Skype Protocol Boolean Indicates default protocol selected for organization.
UTCConversionTimeZoneCode UTC Conversion Time Zone Code Integer Time zone code that was in use when the record was created.
V3CalloutConfigHash V3 Callout Hash String Hash of the Microsoft Dynamics CRM 3.0 callout configuration file.
VersionNumber Version Number BigInt Version number of the organization.
WeekStartDayCode Week Start Day Code Picklist Designated first day of the week throughout Microsoft Dynamics CRM.
YammerGroupId Yammer Group Id Integer Denotes the Yammer group ID.
YammerNetworkPermalink Yammer Network Permalink String Denotes the Yammer network permalink
YammerOAuthAccessTokenExpired Yammer OAuth Access Token Expired Boolean Denotes whether the OAuth access token for Yammer network has expired
YammerPostMethod Internal Use Only Picklist For internal use only.
YearStartWeekCode Year Start Week Code Integer Information that specifies how the first week of the year is specified in
Microsoft Dynamics CRM.

Dynamics 365 – Site Map Custom Titles

I am currently working on update of a Site Map and have Reports listed twice in an Area.

When they display Dynamics is showing a (1) at the end of the second item.

To add custom titles to Areas, Groups, or Sub Areas you use

  <Titles>
    <Title LCID="1033" Title="Cool Report Title" />
  </Titles>

LCID is the language code.

Full SubArea XML shown below

<SubArea Entity="report" Id="nav_reports" DescriptionResourceId="Reports_Description" AvailableOffline="false" PassParams="false">
  <Privilege Entity="report" Privilege="Read" />
  <Titles>
    <Title LCID="1033" Title="Report" />
  </Titles>
</SubArea>

If you’re not using XrmToolbox (http://www.xrmtoolbox.com/) then why not? Here’s how to select it in Xrm Toolbox.

2017-07-26 11_05_43-XrmToolBox for Microsoft Dynamics CRM _ 365 CE (v1.2017.6.16)

Dynamics 365 – Open entity form using Javascript (with Parameters)

I had a function in a CRM upgrade that was nice and small.

locAddRelatedTo(crmFormSubmit.crmFormSubmitObjectType.value);

It would open up a copy of the entity I was on with some lookups populated, great right? Well it was. Back in CRM 4 days but not much use now.

Instead you now need to use Xrm.Utility.openEntityForm as below:-

    var parameters = {};
    var childEntityName = Xrm.Page.data.entity.getEntityName();

    //Provide parent record guid
    parameters["_CreateFromId"] = Xrm.Page.data.entity.getId().replace("{", "").replace("}", "");

    //Provide parent record entity type code
    parameters["_CreateFromType"] = Xrm.Page.context.getQueryStringParameters().etc;


    if (Xrm.Page.getAttribute("sampleLookup").getValue() != null) {
        parameters["sampleLookupFieldName"] = Xrm.Page.getAttribute("sampleLookupFieldName").getValue()[0].id.replace("{", "").replace("}", "");

// Note the name on the end
        parameters["sampleLookupFieldNamename"] = Xrm.Page.getAttribute("sampleLookupFieldName").getValue()[0].name;

// Not the type on the end
        parameters["sampleLookupFieldNametype"] = Xrm.Page.getAttribute("sampleLookupFieldName").getValue()[0].entityType;
    }
    
    if (Xrm.Page.getAttribute("sampleFieldName").getValue() != null) {
        parameters["sampleFieldName"] = Xrm.Page.getAttribute("sampleFieldName").getValue();
    }

Xrm.Utility.openEntityForm(childEntityName, null, parameters);

This opens a new form BUT throws an error. You then need to go into your Customizations, find the form, go to Parameters and make sure that all parameters are listed like so.

Parameters

Then the form should display with fields pre-populated.

Angular – Preview Image before Saving it

I came across a few samples of how to preview an image before saving it. So he’s my version “Angularfied”!

Here’s the app.component.ts (obviously move as you wish!)

import { Component } from '@angular/core';
 
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  // This is our callback to get the URL out of the onload function
  private  urlPointer: (name: string) => void;
 
  // Our temp url value
  url: string;
 
  /*
    loadFileTest triggered by (change)='loadFileTest($event)' in the html
  */
  loadFileTest(event) {
    this.getFileForPreview(event.target, this.urlPointer = (url) => this.setLocalURL(url));
  }
 
  /*
    getFileForPreview
    fileInput - event.target from the change event
    callbackFunction - pointer to our callback function (setLocalURL)
  */
  getFileForPreview(fileInput, callbackFunction) {
    const reader = new FileReader();
    reader.onload = function(){
      // setLocalURL with reader.result (a string)
      callbackFunction(reader.result);
    };
    // This is what actually creates our URL
    reader.readAsDataURL(fileInput.files[0]);
  }
 
  setLocalURL(url: string) {
    // Our call back function which gets the url and saves it to our url variable
    this.url = url;
  }
}

Then we just need to add the following HTML

<input type='file' accept='image/*' (change)='loadFileTest($event)'><br>
<img id='output' src='{{ url }}'>

As easy as that! 🙂

Developers vs Designers

So we at SSW are looking to upgrade our Intranet using SharePoint 2016 and the brief was to use the functionality coming later in 2017 to make a really great user experience.

So I watched An overview of SharePoint communication sites and took a screenshot of some of the new features coming to SharePoint.

As the designer I was working with was on other work I decided to put something together myself using my endless talent and Paint.Net.  So in the end I came up with this:-

It has all the required information, its nice a clean and I was pretty happy with myself.  To me it covers the basics of the design brief, It uses the new functionality, and its a rich interface.  So a few days later the designer was available again and I gave her my design to touch it up a bit and here is the result: –

I’ll forgive you for suggesting the designers is better.  Its the same elements (minus a few changes from the boss!) in such a more rich and appealing format.  A designer considers the composition, the font, and lots of other things I probably don’t understand to get to a rich user experience.  My focus on the other hand is on how does it work functionally and does it meet my basic requirements.

Obviously I was put back in my box and quickly remembered why I don’t do design and at the same time remembered why Design is such an important part of modern IT.  If your project doesn’t have a designer then are you really seeing the best result you could?

Wait SharePoint isn’t terrible?

As a developer I like many of you found SharePoint to be an annoying enigma.  It wasn’t perfect as a document repository however it was much better than it was as an Intranet or home page.  It tried to be a jack of all trades and ended up struggling at most.  Web Parts were frustrating to develop and deploy, Home pages required templates that had been hacked by members of the general public, and pages required large amounts of work to get mobile responsive.  Because of these frustrations I walked away happily from SharePoint and kept my engagement with it to a minimum.

However I was recently asked to assist with our migration from SharePoint on premise to SharePoint online which made me look into how we could update our intranet page and the more I investigated the more amazed I became.  I honestly believe if they gave it a new name and didn’t call it SharePoint then developers would be singing its praises.  Expect to see SharePoint back on your radar soon and you no longer need to be disappointed.  Here’s a few reasons why SharePoint is now much better than ever.

No more public sites

SharePoint as a public website always seemed like a poor idea.  The user interface never seemed to be great and the effort involved and hacks required to setup a site always seemed to make it cost and time prohibitive.

When compared to other content management systems it just never stacked up.  Microsoft has now dropped this as a feature which is a good thing for us developers who have dealt with public sites in the past.

 

SPFx Tools

If you’ve watched the SharePoint talks from Build 2017 or read up on the upcoming changes you would have seen the Open Source tooling shown on Microsoft slides.  Even writing that sentence still feels confusing to me (Microsoft and Open Source) however you can now develop with your favourite open source tools, using your favourite JavaScript framework, and using the editor of your choice.  Expect some teething problems with this however its a wonderful step forward.

 

Page Design Interface

Remember how “easy” it was to create pages in SharePoint in the past? It was apparently designed so that end users could make changes easily and while that might have been true for minor changes (spelling updates, pictures changes etc) this was far from the truth.  The more time you spent looking at creating pages the more you found you needed hacks to do so many parts.

SharePoint 2016 provides a rich collection of parts that can be combined to create rich designs.  Some of these components won’t be available until SharePoint 2016 Feature Pack 2 due later in 2017 but when they come expect a large uptake on SharePoint by clients.   

Web Part to Web Part interaction

The release date for this functionality is still a bit unknown so it will hopefully be part of Feature Pack 2 but it might not be.  However the SharePoint team are working hard to allow for connections between Web Parts.  This will be great when implementing rich user experiences such as a detail component for a list for example.

 

Summary

As said by the SharePoint team, up to now there has been so many hacks to get SharePoint how companies want it and SharePoint 2016 has been designed so you no longer need those hacks and has been designed with Modern Web Design in mind.

You can now use your web design skills to create a rich intranet experience and clients are going to love the ease of use.

If SharePoint takes off in the next year or so you heard it here first, otherwise you get your money back on this post.

Angular – Class initializers in TypeScript

One thing that is great in C# is the ability to initialise values on create like so: –

MyObject test = new MyObject { Name="Test", Description="This is a description" };

With the release of TypeScript 2.1 you can now do something similar: –

export class MyObject{
    public Name: string;
    public Description: string;

    public constructor(
        fields?: {
            Name?: string,
            Description?: string
        }) {
        if (fields) Object.assign(this, fields);
    }
}

Then you can use is like so:-

new MyObject({ Name:"Test", Description="This is a description" });

Just make sure that in your package.json that devDependencies has typescript 2.1 or higher.

Dynamics CRM – Going, going, gone

If you or your clients have been using Dynamics CRM it’s time to embrace the future.  Microsoft has combined their Dynamics offerings into a single solution now called Dynamics 365.

If you’re using Dynamics CRM Online you would have already noticed this change and if you’re using On Premise then it’s time to start planning your upgrade.  Dynamics 365 is now setup as follows: –

1

Sales, and Customer Service leverage heavily on Dynamics CRM functionality, while Operations is based on Dynamic AX, Finance is based on Dynamics NAV/Project Madeira, marketing is a cooperation with Adobe and their marketing cloud offering (build in progress) and the others use a bit of functionality from various other Microsoft projects including some Dynamics.

The issue with the Dynamics family has always been they have been siloed products that have been hard to integrate.  With Dynamics 365 Microsoft have created an end to end solution for your whole customer lifecycle.  Long term the products will be merged together however at the moment it’s just a tightened coupling of the Dynamics suite of product. Short term there is a few awesome features in Dynamics 365 (or in the last release of Dynamics CRM 2016) which you should be using: –

Editable Grids

People have been screaming out for this for a long time.  You can select Editable grids for controls or leave them as the standard Read Only type that users are familiar with.  The ability to allow it only on Web is also a nice feature.

2

Simple one click to edit

3

Validation inbuilt.

4

 

Power BI integration

Organisation’s love Power BI and now you can imbed it directly into Dynamics 365.  Power BI is a powerful tool that is surprisingly easy to use.  Allowing for key information to be displayed on the dashboard.

Integration with all your Microsoft products

Dynamics 365 is designed to out of the box work with all Microsoft’s suite of products so you can extend it in some amazing ways.

Some of the tools 365 integrates with: –

  • Azure Machine Learning
  • Cortana
  • Microsoft Flow
  • Office 365
  • PowerApps
  • PowerBI
  • SharePoint

Updated SDK code. Upgrading the End Points

If you have old Integration points I strongly suggest you start investigating Microsoft.Xrm.Tooling.  The old OData endpoint is now deprecated and Web API is the way to go.

You can get the SDK from Microsoft’s website (however I had issues with that code) or you can get the NuGet package

https://www.nuget.org/packages/Microsoft.CrmSdk.XrmTooling.PackageDeployment/

Have a look at the following pages to get up to speed quickly on the Xrm Tooling functionality.

https://msdn.microsoft.com/en-au/library/dn689019.aspx

https://msdn.microsoft.com/en-us/library/mt608573.aspx

Copy Environment Variables between Windows Users

So I have multiple users setup on my machine and was having issues with the Environment Variables.  Whenever I did it manually I always seems to have some issues.

Then I finally stumbled over the following in the ancient archives known as Stack Overflow.

http://stackoverflow.com/questions/559816/how-to-export-and-import-environment-variables-in-windows

 

Run the following two commands and it generates two .reg files you can easily run in your other user.

regedit /e "%CD%\user_env_variables.reg" "HKEY_CURRENT_USER\Environment"
regedit /e "%CD%\global_env_variables.reg" "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"