I am a solution architect using Microsoft Dynamics CRM, and I must be
the laziest programmer I know. I HATE to write FetchXML code embedded
in Javascript. But I am getting over it.
I started using FetchXML Builder add-on to XRM Toolbox and that was very
helpful for working with CRM Online.
But last week I needed to query the Product table in a custom form to
pull back a list price of a product, and I was dreading the thought of
having to add all the little quotes and doing string concatenation
because I knew I would be tweeking it and repeatedly making changes in
FetchXML builder, them moving the query code back to Javascript and
making it a bunch of concatenated strings (wash, rinse, repeat).
If
I were putting the FetchXML into a C# program, no problem because that
language supports having multi-line strings. And I could use
Format.string() to insert my parameters into the code so I don't have to
concatenate that either.
Not so much in Javascript.
So I did some research and found some articles on how it could be done. I
can put the FetchXML between comments and then use a regular expression
to make it into a legit string. As long as nobody turns on 'compression' on the web server, it should continue to work. The code looks like this:
The last function in this takes care of replacing the {0} in my FetchXML with the GUID I need in the query.
Line 15 of my code gets the GUID from a lookup field, and Line 16 calls the Format function to replace the {0} parameter with the GUID.
by Nelson Johnson. This blog covers lessons learned and best practices on building apps in the Dynamics Power Platform. The name is derived from my domain, Eccountable.com
Saturday, May 7, 2016
Friday, May 6, 2016
I am ready for email 2.0.
Have you ever heard someone say that your email inbox is really full of other peoples agendas?
I want to be able to say what my agendas are, and make the sender tell me why their message should be on my agenda.
In fact, when I get an email, why is it that I cannot add my own information (metadata) to it?
The best that any system seems to offer is to let me put it into a folder. Really?
Aren't we past the whole idea that everything lives in some kind of taxonomy?
What if an email relates to two different subjects?
For example, an expense receipt for a customer might be categorized under receipts, expense, and a customer name.
When I get an email, I want to add some of my own keywords to it so that I can cross reference it different ways.
Don't get me wrong, I still like the folders, but they are the _only_ metadata I can easily add to my mail.
Well...not the only metadata.
I have Outlook and I can add multiple categories, but it is limited to a small number and I bet I would have more than it supports.
Thanks for letting me get that out of my system.
I found this article on Outlook best practices that I like.
https://support.office.com/en-us/article/Best-practices-for-Outlook-2010-f90e5f69-8832-4d89-95b3-bfdf76c82ef8
Back to the inbox.
Thursday, March 19, 2015
Microsoft Dynamics CRM data import from spreadsheet
I just wanted to share a quick "best practice" when importing data into CRM.
I have a client with a bunch of spreadsheets of transactions they would like to have in CRM. They created an entity and started importing them, then discovered that some records failed, and some appear to be in the system more than once (duplicates). This turned into a huge mess because the transactions all look very similar and there is no combination of fields that make them unique.
One way they could figure out what is in the system and what is not, is if they had created a 'primary key' field in their spreadsheets and mapped that to a field in CRM. At least that way you could search and see if you had duplicate primary keys (should never happen) or even set duplicate rules to prevent them from being imported in the first place. Just my $.02
I have a client with a bunch of spreadsheets of transactions they would like to have in CRM. They created an entity and started importing them, then discovered that some records failed, and some appear to be in the system more than once (duplicates). This turned into a huge mess because the transactions all look very similar and there is no combination of fields that make them unique.
One way they could figure out what is in the system and what is not, is if they had created a 'primary key' field in their spreadsheets and mapped that to a field in CRM. At least that way you could search and see if you had duplicate primary keys (should never happen) or even set duplicate rules to prevent them from being imported in the first place. Just my $.02
Thursday, July 28, 2011
Live Writer makes this easier
A friend just showed me Live Writer (from Microsoft) and it makes posting new blog entries much easier. For example, I can drop in a picture very easily
or format some code:
private int WorkflowID
{
get
{
int workflowID;if (ViewState["WorkflowID"] == null)
I can definitely see the value in this tool.
Tuesday, March 22, 2011
OpenXML and comparing versions
I am launching into using some OpenXML and found this nifty tool called the "OpenXML SDK 2.0 Productivity Tool for Microsoft Office" that is able to navigate the XML structure of the Office 20007+ document, and if you click on a node in the tree, it can show you the C# code that you would use to create that part of the document. It also has a nice XML file comparison tool built in that is smart enough to match up nodes of the XML tree regardless of the order they are in. It is part of the OpenXML SDK 2.0 download from http://www.microsoft.com/downloads.
Wednesday, January 12, 2011
MS CRM events and custom code
We are working on a large implementation of MS CRM for a client that requires a sizable amount of custom code in the forms. Here is one that tripped us up a "bit."
When working with bit fields (yes/no), you can change the way they appear on the form, as either a checkbox, pulldown, or radio button. We had some fields setup as radio button so that when the user changes one radio button, it would update other fields on the form. We wanted to make the code easier to work with so we took it out of the form and put it into its own custom javascript file that is included into the form when it loads.
For all the rest of our forms, the way we would get a script to execute is to use the attachEvent() method, so that in our .js file, we have:
crmForm.all.new_field.attachEvent('onchange', some_custom_js_function);
but we noticed that this didn't work on the radio buttons. After a bunch of searching, we found that it is really the onlick event of a radio button that we needed to attach the event listener to, so that we get:
crmForm.all.new_field.attachEvent('onclick', some_custom_js_function);
We later discovered that using onclick worked very well for the checkbox too - it had a very distressing behavior that it was not firing onchange until after it lost focus, but it does fire onclick as soon as the user clicks on it.
Let me know if you found this helpful!
When working with bit fields (yes/no), you can change the way they appear on the form, as either a checkbox, pulldown, or radio button. We had some fields setup as radio button so that when the user changes one radio button, it would update other fields on the form. We wanted to make the code easier to work with so we took it out of the form and put it into its own custom javascript file that is included into the form when it loads.
For all the rest of our forms, the way we would get a script to execute is to use the attachEvent() method, so that in our .js file, we have:
crmForm.all.new_field.attachEvent('onchange', some_custom_js_function);
but we noticed that this didn't work on the radio buttons. After a bunch of searching, we found that it is really the onlick event of a radio button that we needed to attach the event listener to, so that we get:
crmForm.all.new_field.attachEvent('onclick', some_custom_js_function);
We later discovered that using onclick worked very well for the checkbox too - it had a very distressing behavior that it was not firing onchange until after it lost focus, but it does fire onclick as soon as the user clicks on it.
Let me know if you found this helpful!
Labels:
MSCRM javascript event onchange
Thursday, October 21, 2010
Simple frustrations and workarounds
While working on an older install of CRM and writing some reports, I had to use VS 2005 for SSRS and it was a frustrating experience. For example, when working on a report design and trying to select a textbox, it seems like you need to click up to 3 times to make it select (sometimes more) so that you can just get the properties. I think this is because the first click will select the Table control row, the second click may select the textbox, or it will select the background cell. The third click will probably select the textbox.
So I have learned some alternative strategies to use the SSRS GUI:
1. When selecting an object, it is easier to use a fence rather than click on it. the Fence does not need to surround the object, just touch it so you can make very small gestures (click-drag) to select single items.
2. Sometimes even 5 clicks will not select the object because VSS is confused. Press the Esc key and try again – that usually works for me.
3. Use the document outline (on the left pane) to select objects – this is a good reason to name them. It also makes it clear what the correct container is for each object – very important to know when your report preview is not laying out the way you expect.
4. Do all my work within a single row of the table before working on other rows or headings because clicking outside the current row will force me to click two more times to get to the objects within that row
5. Use the fence to select many objects at one time, the use one of the many toolbar object alignment features that are actually very good (well worth spending 30-60 minutes playing to figure out how they will do your work for you).
So I have learned some alternative strategies to use the SSRS GUI:
1. When selecting an object, it is easier to use a fence rather than click on it. the Fence does not need to surround the object, just touch it so you can make very small gestures (click-drag) to select single items.
2. Sometimes even 5 clicks will not select the object because VSS is confused. Press the Esc key and try again – that usually works for me.
3. Use the document outline (on the left pane) to select objects – this is a good reason to name them. It also makes it clear what the correct container is for each object – very important to know when your report preview is not laying out the way you expect.
4. Do all my work within a single row of the table before working on other rows or headings because clicking outside the current row will force me to click two more times to get to the objects within that row
5. Use the fence to select many objects at one time, the use one of the many toolbar object alignment features that are actually very good (well worth spending 30-60 minutes playing to figure out how they will do your work for you).
Subscribe to:
Comments (Atom)