Tag Archives: Display

How to Display Image Saved Using Pen Control on Web Client In Dynamics 365.

Microsoft Dynamics 365 comes with a feature called “Pen Control”, which allows the users to directly draw and add a signature in Dynamics 365 App. But there are some limitations. The user has the ability to draw and input a signature only on mobile client, not web client. Also, on mobile client a saved signature is shown as an image but on other clients, text is shown.

However, there is a workaround to display the saved signature as an image instead of the text on web client. In this blog, I will walk through the steps to achieve this.

I created a field called “Signature” with “Pen Control” added to it. I added “Signature” on the Contact main form. Then I created a new record and saved it with an input in “Signature” field. The following images show how the information is represented differently for newly created Contact record on mobile and web client for “Signature” field.

image thumb 8 How to Display Image Saved Using Pen Control on Web Client In Dynamics 365.

image thumb 7 How to Display Image Saved Using Pen Control on Web Client In Dynamics 365.

On the web client, the text shown in the “Signature” field is the source address of the image that was created through mobile client. That means, we can use this address in an iFrame to display the signature image on the web client. Here are the steps that we have to go through to accomplish this.

1. Add JavaScript code as a web resource. I have added mag_/js/contactsignature.js and following is the code that I used.

image thumb 6 How to Display Image Saved Using Pen Control on Web Client In Dynamics 365.

2. Create a new iFrame and add it to Contact main form. This is the same form which is being used to input the signature through mobile client. I named the iFrame, “IFRAME_Signs”. Populate URL field with “about:blank”, this will display an all white image similar to the mobile client, which implies the field is empty.

image thumb 5 How to Display Image Saved Using Pen Control on Web Client In Dynamics 365.

3. Then go the “Form Properties”.

image thumb 4 How to Display Image Saved Using Pen Control on Web Client In Dynamics 365.

4. Select “Events” tab, and then click on “Add”. Then, add “mag_/js/contactsignature.js” web resource.

image thumb 3 How to Display Image Saved Using Pen Control on Web Client In Dynamics 365.

5. Then expand “Event Handlers” tab, select “OnLoad” for “Event” field, and then click on “Add”. Then click on

image thumb 2 How to Display Image Saved Using Pen Control on Web Client In Dynamics 365.

6. Set handler properties as shown in the screenshot below. Then click on “Ok”. Be sure to save changes of form properties by clicking on “Ok”. Then save, and publish all changes.

image thumb 1 How to Display Image Saved Using Pen Control on Web Client In Dynamics 365.b

Let’s see our iFrame and logic in action. I opened the same Contact record which was displaying text in “Signature” field.

image thumb How to Display Image Saved Using Pen Control on Web Client In Dynamics 365.

As we can see in the screenshot above, “Signature” field contains the address of the image being displayed in “Contact Signature” iFrame.

To make this change more user friendly, you can hide “Contact Signature” iFrame on mobile clients, and “Signature” field on web client. But that’s something that I will leave up to you.

Let’s block ads! (Why?)

Magnetism Solutions Dynamics CRM Blog

How to Display Informative Errors from ASP.NET Web API in Dynamics 365

When developing a Web API to interact with Dynamics 365, the model of interaction may be like so:

Plugin performs logic, makes call to Web API (GET, PUT, POST, etc.) -> Web API receives data, performs logic, sends response to Plugin -> Plugin receives response and performs logic with it.

However, if the Web API encounters an error while performing the internal logic, often the plugin will receive an unhelpful error message along the lines of “500 Internal Server Error”. This is due to an error occurring within the internal logic of the Web API. But this by itself is quite unhelpful, and contains no useful information that can be used to debug the issue.

This is particularly the case when used in conjunction with Sandboxed plugins in 365 Online, where you may be using a Web API to perform logic that you cannot accomplish within sandboxed plugins (SQL operations, performing logic from 3rd party libraries, etc.).

Take SQL operations for example. When performing a SQL operation that requires authenticating to a remote SQL database, you may want to know whether you’ve failed to authenticate, and whether that was because of a login error, an error with the database, or some other error. If you lose this error somewhere along the process of it being passed to the plugin, the issue will become a lot more difficult to troubleshoot. So how do you preserve the error messages until the end?

Catch Specific Exceptions in Your Web API

If you know the specific regions of code within the web service that the issues may occur, it is possible to either put try catch blocks around these sections, or check the data received for issues using conditionals before processing. For example, with an ASP.NET API, if the input for the request is not verified, it is possible for a null or incorrectly formatted object to be passed as input to the function. You could then put a check at the top to test the integrity of the data, then if the data is compromised, return an error informing the client that the input was not accepted.

Return Specific Errors From Your Web API

Now that you’re catching specific errors, it’s possible to return more specific errors. When raising errors from your Web API, it’s important to use accurate error codes, so that users who are familiar with http error codes can more easily solve the issue. A list of HTTP Status Codes can be found here:
https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

When you’ve caught the error, and determined the appropriate status code to represent it, you can raise this error using the HttpResponseException. This will return the error with the specified code to the client.

clip image002 thumb How to Display Informative Errors from ASP.NET Web API in Dynamics 365

If you want to add a little more information to your error, you can fill out the body of the response also:

 How to Display Informative Errors from ASP.NET Web API in Dynamics 365

This allows you more direct control over the information transmitted back to the client. This will also make debugging from Dynamics 365 much more efficient. The above code is from a try catch block, where the program is trying to connect to a SQL database. Any errors raised by the connection (invalid password, invalid username, invalid connection url, etc.) are directly inserted into the ReasonPhrase for the Response Message, and returned with that to the client.

Catch and Display the Error in Dynamics 365 – Plugin

Once you have the Web API throwing useful errors, you’ll need to catch and interpret these in your plugin. This is actually fairly simple. Simply place your API operation into a try/catch block, and instead of catching a generic exception, catch a WebException – this is the type of exception returned by the Web API should it encounter any issues. You can then format this exception, and raise it as a plugin exception, which will provide a nice error message for the user. An example of how to do this is given below.

 How to Display Informative Errors from ASP.NET Web API in Dynamics 365
 
This returns an error similar to the one below.

 How to Display Informative Errors from ASP.NET Web API in Dynamics 365Which when debugging, is much more useful to the user than a generic Internal Server error. Throwing an InvalidPluginExecutionException also allows you to prevent the plugin from continuing to process with an invalid return from the Web API, however, you could use another method of handling and displaying this error, like tracing it to the plugin trace log. Note that in this example, we are simply raising a Plugin Exception with our formatted error string as input, but it’s also possible to pass an exception object to the InvalidPluginExecutionException, and there are also other parameters you may find useful.

Let’s block ads! (Why?)

Magnetism Solutions Dynamics CRM Blog

How to Display Alerts and Dialog Processes with Alert.js in Dynamics 365

Dialogs are great, but it can be a hassle to show nicely in CRM, especially when activating them via a custom button. With different browsers, browser settings and configurations, opening a dialog may result in the dialog opening in a new tab, or a new window, and doesn’t allow for a consistent user experience.

A great utility for dealing with this issue is a solution called Alert.js. This solution can be found on GitHub: https://github.com/PaulNieuwelaar/alertjs. This solution contains many utilities for creating custom alerts inside Dynamics 365. I’ve experimented with a few of these, but the particular functionality I have been working with is the Alert.showDialogProcess method. Using this allows for opening a dialog in a similar fashion to CRM’s built in alerts and notifications, allowing for a consistent user experience. image thumb How to Display Alerts and Dialog Processes with Alert.js in Dynamics 365 

How do you go about using it?

The solution can be downloaded from GitHub and then imported in the solutions section of Dynamics CRM. The documentation is fairly comprehensive, so refer to that for installation guide and usage instructions.

Using Alert.js in conjunction with the Ribbon Workbench

Alert.js can be used in conjunction with Ribbon Workbench to add functionality to custom buttons, allowing for, among other things, the creation of good looking popups, alerts, and displaying dialogs in a manner consistent with CRM’s built in alerts.

For my purposes, I wanted to display a dialog process. Doing this was fairly simple.

  1. Create a simple JavaScript function that calls the Alert.js “Alert.showDialogProcess” function. Upload this to CRM as a web resource.
  2. Pass through the required parameters
    • dialogId – The Guid of the dialog you wish to display.
    • entityName – The logical/schema name of the entity for which the dialog is being run.
    • recordId – The id of the record from which the dialog is being run. With ribbon workbench, this can be passed as a CRM parameter (‘FirstPrimaryItemId’).
  3. Pass through any of the other optional parameters that you wish to configure: dialog height or width, a callback to be run on completion, or the base URL of the CRM server – which may be required in some instances.
  4. In Ribbon Workbench, create a new button, and an accompanying command.
  5. In the accompanying command, create a new JavaScript action and load in the function you created in step 1. This function usually deals with passing through all parameters but the recordId.
  6. Add a new JavaScript action, calling Alert.js with the function isNaN. Shift this above your function in Alert.js. This ensures that the Alert.js library is loaded prior to the function specified in Step 1, so that there are no dependency issues.image thumb 1 How to Display Alerts and Dialog Processes with Alert.js in Dynamics 365
  7. Publish changes to solution.

The result is a dialog that uses a style consistent with CRM’s lightbox, allowing for more consistent alerts and processes.

Let’s block ads! (Why?)

Magnetism Solutions Dynamics CRM Blog

How to display a symbol or short expression inside a circle?

 How to display a symbol or short expression inside a circle?

I need some fast way of putting insets on the graph, where some numbers or symbols are enclosed in a circle (to label curves on a plot). Is there some command to produce such pictures, equivalent to Frame["a"], only with a circular frame?

4 Answers

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange

Hide / Display Text in CRM “Word Templates”

Hide / Display text in CRM “Word Templates”

Microsoft introduced the CRM Word Templates feature, in Dynamics CRM version 2016. Using Word Templates, users can insert fields from CRM records in a Word document. The feature stops here.
With Dynamics PDF-Docs (click here to download trial version) users can, in one click, PDF the generated Word Document, attach it to Notes, Email or upload the document to SharePoint location or add documents from SharePoint as attachments to Email workflow, together with the PDF generated with Word Template.

What if you need these features, not available with CRM “Word Templates”?

  1. Keeping rich text formatted fields in CRM, after they are inserted to the document. In current version of Word Templates, formatting is lost in the document, and comes up as one long line of text.
  2. Your document requires logical operations like hide or display text based on the content of a field in CRM record. As an example, you wish to hide / Display the table header “Discount” for invoices, quotes and similar documents, generated for clients not entitled for discount.

OR you need the feature of inserting fields from CRM records into Word document, and the CRM version installed on your server is previous to 2016 release?

Well before Microsoft released version 2016, Dynamics Objects developed “Dynamics Docs” to perform these much needed functionalities, for all CRM versions. (Dynamics Docs, can be downloaded here).

Same as with Dynamics PDF-Docs, with one click you can PDF the generated documents, attach the PDF file to Notes, Email and upload the document to SharePoint or attach documents from SharePoint to Email workflow

Returning to our topic, the issue with Rich Text was explained and resolved in previous  post:

http://www.crmsoftwareblog.com/2017/06/rich-text-word-templates-issue-resolved-dynamics-docs/

In this post I will show how text can be hidden or displayed, based on selected option in the CRM record. Consider a letter, sent from the local library, which only one of the 2 below, mutually exclusive lines (in bold letters), can be displayed:
======================================================

Dear <>

Thank you for your Email received yesterday.

I wish to confirm the following:

Your current borrowing entitlements are <> books per month

Your video entitlements are <

If the above is incorrect, don’t hesitate contacting me

=======================================================

Words between << and >> symbols, are placeholders and are automatically replaced with the field content they are linked to. We wish to display one of the above lines, based on the selected option either Books or Videos of the Type field of the entity.

First step is to create the document text as variable, by making it a placeholder. As spaces are not allowed in placeholder, and still keep the variable name easily recognized, we use exact same text, but without spaces:

<> <> <>

<> <

After importing the Word document with all variables set as placeholders, click the Add Fields to Template. In this example we demonstrate the hide/ display of the first line, the second line setting is very similar to the first one.

Select the Merge Tag:  <> the related entity is Library and the condition is on the option selected in the Type attribute.

Insert Expression. If Books=Books then the Special Text = Your current borrowing entitlements are

Otherwise = blank

expression1 Hide / Display Text in CRM “Word Templates”

Similar condition applies to the placeholder <>

Select the Merge Tag:  <> the related entity is Library and the condition is on the option selected in the Type attribute.

Insert Expression. If Books=Books then the Special Text = books per month

Otherwise = blank

expression2 Hide / Display Text in CRM “Word Templates”

Don’t forget that the <> placeholder is a number and you need to add condition to hide it as well. The expression is:

If Type=books then Books (the attribute Books of the entity) Otherwise=Blank

expression3 Hide / Display Text in CRM “Word Templates”

Click to download Dynamics Docs Trial Version

Let’s block ads! (Why?)

CRM Software Blog | Dynamics 365

How to force equation display in dislayed-equation format, not inline format?

 How to force equation display in dislayed equation format, not inline format?

This has been asked in various forms before, but I have not seen a satisfactory answer to the question: In many, many cases one wants mathematical expressions represented in the form of a regular array similar to LaTeX constructs such as eqnarray or simply array, while keeping the expressions formatted the way they would be if they were stand-alone expressions in a displayed equation.

In LaTeX one can force this form simply by issuing a \displaystyle directive. Is there any way to achieve this in Mathematica, in a manageable way? I have my options set to disallow scriptlevel changes already, which helps with inline expressions, but it does nothing for expressions that are part of an array of expressions, for reasons that are mysterious to me. Thus I have found myself desperate enough to sometimes edit raw box expressions to get what I want, but Mathematica’s syntax for this is a nightmare. Half the time I end up with a severely broken expression after attempts like that, and I’m forced to start over.

So, what I am looking for is some sort of function that I could apply to an expression shown in TraditionalForm say, and possibly then invoke to be evaluated in-place. Is this possible? Or should I simply give up on the idea of doing any kind of serious mathematical typesetting within Mathematica?

P.S.: I have seen the suggestions in this post, which do help in creating equation arrays, but the issue is that the expressions in each of the array cells get displayed like inline expressions (with small operators, sub/superscripts squeezed in to the right of the operators, etc.).

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange

Display grayscale image as 3d plot

How to build 3d plot of grayscale image where x,y – pixel coordinates, z – pixel intensity?

RJs60 Display grayscale image as 3d plot

I tried ListPlot3D[ImageData[image]], but ImageData gives just intensities. I suppose a possible solution would be transorming image to (x-coord, y-coord, intensity) and passing this as an agrument to ListPlot3D.

Let’s block ads! (Why?)

Recent Questions – Mathematica Stack Exchange

Rwanda: Mobile and Digital Strategies on Display

 Rwanda: Mobile and Digital Strategies on Display
Northern Rwanda Farms
hippo roller black blue Rwanda: Mobile and Digital Strategies on Display

I left Rwanda pondering how hard it is to live as a rural farmer.  I was impressed by the skills, ingenuity and innovation I witnessed just to feed, educate and house a family on the sides of these breath-taking mountains.  Mountains, mountains everywhere!

More on Rwanda’s Development

************************************************************************

Kevin Benedict
Senior Analyst, Center for the Future of Work, Cognizant Writer, Speaker and World Traveler
View my profile on LinkedIn
Follow me on Twitter @krbenedict
Subscribe to Kevin’sYouTube Channel
Join the Linkedin Group Strategic Enterprise Mobility
Join the Google+ Community Mobile Enterprise Strategies


***Full Disclosure: These are my personal opinions. No company is silly enough to claim them. I am a mobility and digital transformation analyst, consultant and writer. I work with and have worked with many of the companies mentioned in my articles.

Rwanda: Mobile and Digital Strategies on Display

 Rwanda: Mobile and Digital Strategies on Display
Northern Rwanda Farms
hippo roller black blue Rwanda: Mobile and Digital Strategies on Display

I left Rwanda pondering how hard it is to live as a rural farmer.  I was impressed by the skills, ingenuity and innovation I witnessed just to feed, educate and house a family on the sides of these breath-taking mountains.  Mountains, mountains everywhere!

More on Rwanda’s Development

************************************************************************

Kevin Benedict
Senior Analyst, Center for the Future of Work, Cognizant Writer, Speaker and World Traveler
View my profile on LinkedIn
Follow me on Twitter @krbenedict
Subscribe to Kevin’sYouTube Channel
Join the Linkedin Group Strategic Enterprise Mobility
Join the Google+ Community Mobile Enterprise Strategies


***Full Disclosure: These are my personal opinions. No company is silly enough to claim them. I am a mobility and digital transformation analyst, consultant and writer. I work with and have worked with many of the companies mentioned in my articles.

LG V20 announced: Removable battery, microSD, and secondary display make it an enterprise contender

lg v20 LG V20 announced: Removable battery, microSD, and secondary display make it an enterprise contender(Image: LG)

After the Galaxy Note 7 recall due to battery failures, LG’s continued strategy of utilizing removable batteries looks to be a safe one for enterprise customers. The LG V20 was fully revealed tonight in San Francisco and brings a lot to the table.