How to get data out of entity in script in CRM 2011 - dynamics-crm

I have 2 entities (for this example) in CRM 2011 - Account and Case. The Account holds all of our clients, the case holds individual work actions for an account. When a case is created one of the input fields is the Account.
What I would like to do is upon the user selecting the Account, execute some javascript to look up the account entity to display some additional information.
So far I have got the javascript working that triggers the onchange event of the Account field, and it correctly gets the selected Account, but I don't know what the next step is.
I'm new to CRM so don't really know if what I'm asking is actually sensible, if there is a better way then please let me know.
Thanks!

For the record, the way you were thinking about doing things would be completely supported, and TechHike's method is supported in CRM 4, not CRM 2011. Steps you would take:
Use CRM 2011's web resources to upload a script file that does what you want.
Use the form editor to make your javascript method from step one fire when the Account field changes on the form
Make a request to CRM's REST endpoint (http://msdn.microsoft.com/en-us/library/gg334767.aspx) to retrieve the details of the account selected
Use the results to populate fields on the form, show a popup with details, etc.
There are plenty of examples of caling the REST endpoint from JavaScript in the SDK (http://msdn.microsoft.com/en-us/library/gg309408.aspx). Good luck!

Matt's post above contains everything you need to know, but you might also find the blog post below useful. It basically describes the same scenario where you have a 1:n relationship (such as Case and Account) and details how you can pull information from a specified lookup (e.g. account), using the REST endpoint (as Matt has already mentioned) and display it on the form.
http://community.dynamics.com/product/crm/crmtechnical/b/crminthefield/archive/2011/02/07/showing-related-information-in-a-crm-2011-form.aspx
The blog post includes a link to download a CRM2011 solution already built to give you something to look at how they've achieved this (useful if you're new to CRM2011).

There are two ways to do this, and you may be best to do them both in parallel:
on the Account > Case relationship edit the Mappings. When a user goes to an Account and uses the left navigation to look at Cases (or a grid of Cases on the form) then hits "Add New Case" they are creating a Case from inside the "context" of the Account. You can copy any fields you want to from the Account to the Case record at this point - the Mappings define what field from the Account are copied to which target field on the Case. This will always be the most robust, easiest way to do it but relies on the user starting in the right place.
on the Case for you could also add an onChange script to the Parent Customer lookup to fetch the data from the parent record. I think Stephen's link is probably the best way to do this as it does not copy the fields but allows the user to see them anyway, which is better database design (from a purist standpoint) and means the user always sees current info about the Account rather than possibly out of date stuff. Alternatively if you actually need to copy some fields (maybe the customer's normal SLA say) so that you can use these in other such as scripts or workflows on the Case then have a look at this article: Disabling the selection of contacts for opportunities all the way
Although this is about a slightly different topic, the script there fetches the Account details of the parent Contact - you want to fetch values from a parent (llokup) field so the approach is the same, just different in the detail

There are various ways to do this but I would recommend doing it the supported way, without javascript. This may not be as pretty but it is likely much easier. The scenario would be to add a left navigation link to the case entity that when clicked will update the content area to show the details of the account.
To add a link to the left navigation you will need to configure the isv.config file to have an extra link for the case entity.
Here's an example:
http://support.sfusion.com/kb/hosted-microsoft-crm-4/how-do-i-modify-the-isv-config-file-in-microsoft-crm-4/
You can also lookup isv.config customizations in the SDK, found here:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=82e632a7-faf9-41e0-8ec1-a2662aae9dfb&displaylang=en
Next you will need to create a custom aspx page in the ISV folder of the web server. This page will display all the information about the account that you want to show the user when the left navigation link is clicked. The ISV.config as an xml property that allows you to pass all the context params to your page on the querystring. Make sure when you create the link to turn on this attribute.
Now the only tricky part is that in the page you will need to use the CRM web service to display all the account details that you interested in showing the user. I won't do into details on this. You can find great tutorials on the web or in the SDK if you haven't done this before.

Related

How do I create a custom global element/app within CRM Dynamics such that it shows on all pages and can control user navigation?

I need to add a custom element/mini-app/extension to CRM Dynamics sales such that it shows globally on all pages that the user navigates to and also can navigate the users urls when certain events happen.
What options exactly do I have to satisfy the above criteria?
The screenshot below shows a sample area that I need to build the app within as an example.
Id imagine there are many use cases where customizing a global element is worthwhile, especially since custom applications may need to be built.
I understand I can use the Resources to create a SPA such as angular which is running so long as the URL stays at the SPA url. But for our use case, we are looking to allow end users to be able to navigate the CRM using the custom controls. but when something happens in a another subsystem, we need end users who are logged into the CRM to instantly view data that is important to them.
Is this technically possible?
Unfortunately this is not feasible. There are some concepts to show learning path like that. It won’t satisfy your need.
I understand what you need, like a news feed or ad rotator for rolling content but context specific flyout area which is always pinned. There is no OOB option or customization/configuration available for achieving this. You can initiate this concept in Dynamics Ideas.
Like you said there can be a HTML web resource developed & embedded in a dashboard, this is very limited for your requirement.
Edit:
I think you are looking for Channel Integration Framework which will help you to configure third party CTI apps.
In CRM V9, they have introduced a new API call for 'Panel'. This panel loads to the side of the screen, and can display content regardless of where the user moves throughout the entire application. I've played around with it a bit for my own person reasons at work, but it looks to be exactly what you're looking for.
The call is 'Xrm.Panel.loadPanel(URL/WebResource)'
https://learn.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-panel
However, the feature is currently in development, and should only be used in production at your own risk.

Bug on the javascript to retrieve data from a Quick View CRM 2015 Rollup 1

I have trouble retrieving a value from a Quick View (as per quick view i mean show the related entity details in a parent entity, eg. primary contact email address on the account).
The usual way to retrieve those is by the sdk syntax:
Xrm.Page.getControl("contactQuickForm_contactQuickForm_contact_mobilephone");
I tried this approach but now the result is an empty control. Anyone had a chance to see this defect in the new rollup? I troubleshoot a little around it, including removing all the controls from the page and scroll through the list to confirm that the control wasn't actually there and i wasn't making any syntax errors.

How to set field values in a 'create form' by using dialog?

Is there any way to update an activity entity's create form's fields by using a dialog without saving the entity first?
Let me explain.
The customer calls us and our represent opens a phone call activity. At this point it's on a 'create new' state.
Now, since we have freaking many contact informations and other things related to it in the system I have created a dialog to help user to find out the caller's informations. The dialog first asks the name who is calling. Then it asks about which building / apartment he is calling (it's part of our business model). Then it keeps asking things for a while.
Finally, the dialog has gathered all necessary information and is about the put the values into the form.
But here's the thing. I'm using an Update process within the dialog, but of course I can't update something that doesn't exists. So at the moment it works like we always have to save and give a title for the entity first. Then run the dialog.
It's a minor fault but it may be a problem if, for some reason, in the middle of a dialog, the process is cancelled. Then we would have an empty phone call there with some title. Besides one extra click is always one extra click.
I hope you understood my question.
Please feel free to asks.
Bye!
Like Greg, it seems to me that you are trying to capture information about the contact and the phone call at the same time, so starting by opening a new record may not be the most structured way to go about this. A couple of possibilities:
use a dialog but don't run it against a Contact necessarily. Maybe run it against a user. Use the first few pages to establish if this is an existing Contact and if not, create one from data captured, then create the phone call record against the selected or created Contact. You can run a dialog like this from a link on a dashboard for example, you don't need to navigate to users screen to do it.
Gareth Tucker has written several articles on his blog at http://gtcrm.wordpress.com about contact centre automation, including some interesting ideas (with free downloadable examples) about using JScript on the phone call form to capture contact details and create a linked Contact record on the fly
It sounds to me like the business process could be improved. Ideally your solution would be to change your dialog process so that it runs against the customer (contact?) entity, i.e. when your customer calls up, users find that record and run your dialog instead of creating a phone call activity then running the dialog.
That said, if I understand your question correctly, you are using the dialog perhaps to assist the user in finding the customer's details. Is this true? I don't understand how this would work so you may need to provide us with some extra information here.
If the underlying issue is that the user can't find the customer, it sounds like you need to provide more search fields for the user in the customer view...

Dynamics CRM Managed Solution Add Customer Set Parameters

I'm creating a solution which will be released as a managed solution for Dynamics CRM Online.
However, the customer will need to put information in when installing the managed solution to allow interaction with outside services.
For example, when you install the LinkedIn solution, you need to add your log in information to allow the CRM to access your LinkedIn account.
How do I add these parameters to the a solution, and then allow the customer to update them if they change?
Cheers
Edit:
To add to my query and following the answer below.
To make sure the process is correct in my head.
Option 1.
I will create a custom entity for storing key/value, or username/password combination.
I would then create a customisation page for the solution using html web resource, which when submitted, javascript would create a single record to hold those values.
I then need to link every record that needs the values stored in the custom record - I'm not sure how this would be done without editing a workflow after the storage record has been created, to link each normal record to the storage one.
Option 2.
Create an xml web resource that stores the values. Create the html/javascript resources to update this using the configuration page.
I can then use a javascript function to obtain that data when the custom entity is created, perhaps to populate hidden fields for storage and use behind the scenes.
I can't find any tutorials on getting started with using xml in this way - can you point me in the right direction?
I typically create a "Configuration" entity that has Name/Value attributes. This is also useful when you have Dev/Test/Prod environments that require different configs (e.g. URLs, credentials, etc).
Another approach is to using Plug-in configurations or Web Resources to store that type of information. The Plug-in configuration is pretty straightforward if you can have the customer use the Plug-in Registration tool to modify the value.

Access and display web sourced data as 'messages' in Outlook

I have data I provide on an http connection that's essentially message information.
I'd like to create an AddOn for Outlook that will consume/interface with that http service as if it were a mail source and display sender, recipient, subject, date etc and then be able to download the actual message and display it.
I envision this service being accessed either via a folder in the left-hand panel. (Uber feature would be if I could drag a message out of this service into the inbox!)
Unfortunately, I don't normally write code on the MS Stack -- I'm a linux guy. So I'm looking for either a follow-the-dots tutorial or an example of something similar. Failing that, I'll hire someone to write this so would love to know the specific skillsets I should be looking for when I contract someone to write it.
EDIT / Additional Thoughts
I have considered changing the web service (or at least creating a middle-man) that spoke IMAP, but only implemented a sub-set of commands (eg, there's no delete or create-folder or move)
One problem with that is that retrieving the actual message needs to be a different opperation (one that has a quota cost to the end user) so I can't just show the message. An option would be to show a "retrieve" button rather than the actual message (I found a great resource here: http://msdn.microsoft.com/en-us/library/dd542625.aspx for doing something like that) and then having that button do the retrieve and then reload itself. Maybe.
As Pekka says this could turn into a big project .. your description is pretty general and as you know the devil is in the detail ! but there are a number of options ..
you may be able to use Folder.WebViewURL Property of a folder that you have created in outlook and show your app via a web app (you can build that on any tech stack you like)
ok drag and drop may become a little tricky to do.
Outlook forms could also be used. A form can call out to your web service and display what you want. There is some info about form on SO but http://www.outlookcode.com/article.aspx?ID=35 is the best place.
Subclassing .. you can then create your own tree under the outlook tree and display whatever you want in the right hand pane such as grids forms etc. these can interact with the normal outlook folders and you can do your drag and drop though you woudl have to create Outlook Items to display them in the inbox. There is a tutorial on the technique http://www.codeproject.com/KB/office/additional_panel_Outlook.aspx though not doing exactly what you want but the technique is sound.
Next up build your own MAPI Message Store Provider which is probally the hardest thing to do on the list.http://msdn.microsoft.com/en-us/library/cc842153.aspx
As I said your question is no functional spec and there are always many ways to skin the cat but 2 or 3 are probaly where you shoudl look at unless it simple enough just a display a web app.
Marcus
Maybe our product could help you in order to avoid writing your own MAPI Message Store Provider.
Kayxo Insight : .Net Custom Framework for MAPI Message Store Provider

Resources