Automatic display of records in Dynamics - dynamics-crm

So i am trying to retrieve records from the database when an info is typed into a field e.g Sprint is entered into "Company name" field , how can i capture the contents of that field, retrieve it's records from the database and use it to fill the remaining parts of the form.
This is my first time using dynamics CRM, would like it if someone can help me out or point me in the right direction.

Dynamics crm has provided on change event of a field here
Attribute OnChange Event (Client API reference) you can find info about it.
How to write client side scripting in Dynmaics crm
Steps I would perform:
Add onchange event for field on which you want it to fire.
Then I would add javascript for the onchange of field
In that Javascript I will use Dynamics crm Webapi to retrieve data from Account Xrm.WebApi (Client API reference)
Once I get the data I would set that in those field where needed on from setValue (Client API reference)
You will find numerous example of how to create a Javascript for Dynamics CRM

CRM also has what is known as a Quick View Card which can retrieve values from the source record (for display only).
For example, when you select "Sprint" as the Company Name, you can use a Quick View Card to display information about the "Sprint" account record.
Here's the MSDN Link
A quick view control on a custom business app form displays data from a record that is selected in a lookup on the form. The data displayed in the control is defined using a quick view form. The data displayed is not editable, but when the primary field is included in the quick view form, it becomes a link to open the related record
This is a code-free alternative to the answer described below, so the advantage is that it is easier to maintain. The data is also "live" meaning that if you update a phone number on the "Sprint" account the update will appear on all quick view forms (after a refresh)
The disadvantage is that this is not a copy of the data, so may be a problem for future reporting. If you need a point-in-time capture of the data, this can also be a problem.

Related

In the CRM Ribbon Workbench, how can I hide the Closed as Won button on the Opportunity form based on field in a related entity?

In the Ribbon Workbench, how can I hide the "Closed as Won" button on the Opportunity form based on a text field (accountnumber) in the Account entity?
Issue description
How can I hide the "Closed as Won" button on the Opportunity form based on a text field (accountnumber) in the Account entity? Each Opportunity can have one associated Account. If the accountnumber field is blank, I want the button to be hidden. I'm assuming I should use a Value Rule, but I don't know exactly how to do this for related entities.
If this is not possible to do, what would be the best workaround?
I also have a 2nd related issue. I want to be able to hide the "Collaborate" button that is used for Teams integration, but can't seem to do that in the ribbon workbench either.
You have many solutions... just two of them:
Write a custom javascript that retrieves the value of the related account using web api (here some examples: https://butenko.pro/2018/11/13/showing-ribbon-button-based-on-the-result-of-async-operation/)
Add a text calculated field on the opportunity pointing to the accountnumber of the related account (the syntax for the calculated field is "[lookup name of the account].accountnumber". Then you can use a ValueRule on the new field

Can a dynamic link be created to be used from a view in Dynamics CRM?

I would like to be able to include a link in a view on the contact entity of dynamics crm that will pop a custom window that we have built. The custom window needs the contact id and the user id in order to function. Our users have requested that such a link be on the view rather than having to go into the contact record itself.
So, is it possible to create a dynamic URL that will be utilized from the view and will be able to determine the contact id and the user id?
I would assume I need to do this with a web resource, but I've only ever used a web resource in an iframe.
I have tried to build a web resource and just use the web resource's link to put into a field and display that field on the view, but obviously that didn't work.
Essentially the link would build a url and then pop up a new window with that url. Here's my url structure: https://example.com/mscrm/ticketing/Activity/PhoneCallSave.aspx?cId=00000000-0000-0000-0000-000000000000&id=%7b00000000-0000-0000-0000-000000000000%7d&orgname=00000000-0000-0000-0000-000000000000&userid=%7b00000000-0000-0000-0000-000000000000%7d&type=contact&token=Zf7Hi3PFokqRn3RnTD6hPA
This is an interesting request that I have not encountered before...
I thought about using a URL-formatted field, and the fact that D365 by default will hyperlink lookup fields. But, with those options you'd have to write data into a field on each Contact or create an entire new record for each Contact, on the fly.
What about creating a separate web resource that contains a table with only one column to hold the dynamically generated URL's? Run the same query as the view to get the Contacts, then generate the URL's and populate them into that "mini-grid". Put the main Contacts view in one section (say two-columns wide), and the mini-grid web resource in a single-column section right next to it, with no border and the same row height.
This way you rely on the main Contact grid for the Contact info, with the mini-grid holding your dynamic URL's (with proper link names of course, rather than raw URL's).
The high-level steps would be:
Get the user's id from the form context.
OnLoad of the sub-grid, get the set of Contact Id's.
Generate the URL for each Contact.
Populate the URL's into the mini-grid in the same order as the Contacts in the sub-grid, so each row in the mini-grid lines up with its Contact row to the left.
Another idea would be to look into the custom icon functionality in V9 to see if there are any hooks in there where you can add a dynamic URL.
You could also write a RetrieveMultiple plugin to dynamically populate a URL-formatted text field. RetrieveMultiple plugins have their caveats. But, how bad is it?
An unsupported option might be to hack the DOM and put your dynamic URL into a blank URL-formatted field in the view.

Bing Maps control doesn't update on Save of Form Dynamics CRM 2016

I'm having issues with Microsoft Dynamics CRM Online 2016 and the Bing Maps control. When a user creates a new record with the Bing Maps control on the form, once they save the form with the required fields and composite address field filled with a valid address, the Bing Maps isn't refreshing. Why not?
I realised that if I navigate away from the record (to a different area of CRM) and then back again to the record before the Bing Map control will populate for the first time. But I need this is done at least when the user fills the required field and saves the record.
I also realised that if I refresh the web browser (via F5 or the refresh button) this Bing Maps control is not working on my form. (I mean, I see the map but the Bing Maps isn’t refreshing).
Do you guys know a way to refresh the Bing Maps control the first time the user enters a valid address and saves the record on Dynamics CRM?
Is there a script attached to your form? If so, add this code to the script and it should work (make sure that Form_onsave is enabled in the Form Properties). This will reload the page after the form is saved, so hopefully it will suffice. I have not come across a way to reload the map without reloading the entire page, but thankfully the reload is quick.
function Form_onsave(){
// save form data to prevent "unsaved data" warning
Xrm.Page.data.entity.save();
setTimeout(function () {
// save form data
Xrm.Page.data.entity.save();
// reopen current page
Xrm.Utility.openEntityForm(Xrm.Page.data.entity.getEntityName(), Xrm.Page.data.entity.getId());
}, 3000);
}
EDIT: Also, the reload only needs to take place the first time the address is saved. From that point on the Bing map will automatically update when the "save" button is clicked. So, I'd change the code to only reload the form if the field was null and is now populated.

Filtering Sub-grid records based on Lookup in MSCRM 2016 Online

I want to filter Subgrid based on lookup value in Microsoft Dynamics CRM 2016 Online.
What I recommend to you is, create a Quick view form on your quote. Inside this QV form insert a sub-grid to show your associated quote-details. After that, go to "groupement" entity form and from "insert" tab - add the Quick View Form you created.
There is another way is customize the grid view but you need to use un-supported javascript.

Customizing Outlook and Exchange to add new fields to meetings + querying from Exchange from custom app, is this possible?

Is it possible to customize the window used in Outlook to type in meetings (calendar tab) to add new fields to it ?
That data would be stored in Exchange, then queried by another app that would do something with it.
My problem is to see how I could affect the meeting edit dialog as it is now, to add my new fields.
Any ideas ?
If all you want to do is add some fields to the BOTTOM of the Appointment item inspector, then you can do that very easily with VSTO. It's called a custom outlook form region.
See here: http://msdn.microsoft.com/en-us/library/bb157865.aspx
However, if you want to change elements in the base inspector form itself then that's much more difficult, and involves significantly more work. I don't have a complete answer for that.
You could do this pretty easily with custom forms.
Just derive from the "ipm.appointment" appointment form and add you fields and logic to validate and save those fields as user properties on the meeting item
You can then attach to exchange using RDO or OOM to call back the properties off the meeting items.
you can then publish the form to you whole organisation if you want and over righ the default with soem reg key changes.
or
you can do as above and create yourself an addin using vsto.

Resources