"тнιѕ вℓσg ¢συℓ∂ ѕανє уσυя мσηєу ιƒ тιмє = мσηєу" - ∂.мαηנαℓу

Monday, 7 October 2013

Quick View Forms in CRM 2013 OR How to place Quick View Form in CRM 2013 OR Quick View Form Control in CRM 2013

Version used for this post: CRM 2013 online trial.

Its good to learn the ropes of the quick view forms available in CRM 2013. It is possible to add quick view forms for the custom entities as well.


Using Quick View Forms, we could see associated data. Quick view forms could be embedded in a Main form.

Our ball is ready. So lets get it rolling.

1. Lets consider our no-brainer, Account record. Please note the highlighted Primary contact section. Its possible to search contacts here.




2. So lets search a contact and it would bring the contact if it exists. Also note that its possible to create a new contact by clicking on the New button. Now lets select the contact.



3.  We could see a little form appeared. That's nothing but a contact quick view form.




4. Next step is to understand how the quick view form is configured in CRM 2013 and How could we place a quick view form in CRM 2013.

5. Lets navigate to Accounts form design. 

Settings --> Customizations --> Customize the System--> Default Solution ( OR your custom Solution in which Account entity exists) -->Account entity-->Forms 

Please note the following items on the form


  • Quick View Form Control button - When we need to place a quick view form on another form, we need to INSERT Quick View Form Control ( In simple words, A placeholder for Quick View Form)
  • Quick View Form control that's already on the Account form design. Lets double click on the existing Quick View Form control.





6. Here is our major component,  Quick view control.


  • The Quick View Form is based on a lookup field.
  • Related entity should be selected.
  • And then Quick View Form should be selected
  • Its also possible to edit the associated Quick View Form.




7. Lets click on the Edit button to see the selected Quick view form, account contact card. And here is the design of the Quick View Form - Account Contact Card. We could also find this Quick View form in Solution-->Contact entity-->Forms 




8. Please note that its possible to create multiple Quick View Forms for System entities as well as custom entities.









Sunday, 6 October 2013

How to Close a Form in CRM 2013 using javascript

With reference to CRM 2013 SDK, following is the code snippet to close the form.
Xrm.Page.ui.close();
Please note the following important points.
"The HTML Window.close method is suppressed. To close a form window you must use this method. If there are any unsaved changes in the form the user will be prompted whether they want to save their changes before the window closes." ( Ref: CRM 2013 SDK )

Whereas if we need to save the record using javascript, we could use the same methods whichwe were using in CRM 2011.
Xrm.Page.data.entity.save( null | "saveandclose" |"saveandnew" );
 
Arguments values:

save()
If no parameter is included the record will simply be saved. This is the equivalent of using the Save command.

save("saveandclose")
This is the equivalent of using the Save and Close command.

save("saveandnew")
This is the equivalent of the using the Save and New command.
( Ref: CRM 2013 SDK )

How to get the Base URL value in CRM 2013 using javascript OR How to get the Server URL in CRM 2013 using javascript

With reference to CRM 2013 SDK, please note that the js method context.getServerUrl() which was widely used in CRM 2011 is deprecated in CRM 2013.  So we need to use the following method instead to retrieve the base URL value. 

var baseURL = Xrm.Page.context.getClientUrl();

The values Returned:


Client
Value
Microsoft Dynamics CRM (on-premises)
http(s)://server/org
Microsoft Dynamics CRM Online
https://org.crm.dynamics.com
Microsoft Dynamics CRM for Outlook with Offline Access when offline
http://localhost:2525

Ref: ( CRM 2013 SDK )

Entity Image in CRM 2013 OR Image Attribute of Entities in CRM 2013 OR How to show Entity Image in CRM 2013

Version used for this post: CRM 2013 online trial

Entity Image is a good feature in CRM 2013. We could have an image on each record with this feature. 


For Instance, consider Account ( Customer ) entity. Its good to have the company logo with each Account ( Customer ) record.


Its possible to have image attribute for the custom entities as well. We will analyse it in the last part of this post.


With reference to CRM 2013 SDK,


"The following system entities have image attributes. Those marked with an asterisk are enabled by default to show them in the application."



Account *
KbArticle
Campaign
Incident
Competitor *
Connection
Contact *
Contract
TransactionCurrency
EmailServerProfile
Goal
Invoice
Lead *
Mailbox
OpportunityProduct
SalesOrder
Organization
Product *
Publisher *
Queue
Resource *
SalesLiterature
Territory
SystemUser *
(Ref: CRM 2013 SDK)

1. Firstly lets check Account entity record. When we click on the image icon on the left side of the header we get the option to choose an image ( Under 5 MB).


2. Lets have a look how could we enable the image attribute to show them in the application.
We need open the Account form and click on Form properties. This property enables the image on the form. We should remember this as it's useful when we create new entities.


3.  Another important points are the following

" For the initial release of Microsoft Dynamics CRM 2013 and Microsoft Dynamics CRM Online each entity can have only one image attribute and the logical name of that attribute is always entityimage. This property has been added to prepare for a future release in which entities may support multiple image attributes and there may be need to change which image is used as the primary image for the entity." ( Ref: CRM 2013 SDK)

4. Lets check it out by creating a new entity called Budget. Primary Image option set refers to the point that we just mentioned. Currently we could have only one image attribute per entity. So for now we can't choose anything from this option set. In future, if there are multiple image attributes provided in CRM then we could choose the primary image from this optionset.


5. Now lets create the image attribute for the Budget entity called Year Logo. Please note that the attribute name is 'enttityimage' and we can't change this. This also means that as of now this is the only image attribute we could have for this entity. As you all know we cant create multiple attributes with the same name.



6. Next step is to have this image on the form. Lets go to the Form design of Budget entity. Please note that the image entity is not available in the fields list.



7. As mentioned earlier, to enable the image on the form, we need to open the Form properties and tick the option Show image in the form. And say okay press okay. As per our usual practice we need to save the form and publish the form.



8.  Now lets check the budget entity record. We could select the Year logo image as shown below.



Autosave feature in CRM 2013 OR How to prevent Autosave feature in CRM 2013 using javascript OR How to identify Autosave in CRM 2013 using javascript

Version used for this post : CRM 2013 online trial.

Autosave is a cool feature in CRM 2013 which is based on a 30 seconds timer. In simple words, the form saves every 30 sec. But we should be a bit careful with this feature, just because there might be plugins running on Update OR javascript running on SAVE events.

Firstly lets see how auto save works. So on any record you could find a little save button on the right bottom corner of the form.


 If we make any changes to the existing record, we could see it turns to

And after 30 sec, we could see that CRM saves the change that we made.



1. The organizational level setting for autosave could be found in

Settings -- > Administation -- > System settings --> General


2.  We may not prefer to set as 'No' in the organization level as the autosave will be disabled for all entities. 

CRM 2013 SDK talks about a js method  "This method is essential if you want to enable auto-save for most forms in an organization but disable it for specific forms" ( Ref: CRM 2013 SDK)

execObj.getEventArgs().getSaveMode()

So this method could prevent Autosave.

The next Q is 

How do we identify whether its Autosave or user clicked on the bottom right corner  little SAVE button.

Again SDK is our guide here.

Ref: CRM 2013 SDK
"This method is essential if you want to enable auto-save for most forms in an organization but disable it for specific forms. The following code registered for the onSave event with the execution context passed to it will prevent any saves that initiate from an auto-save but allow all others. With auto-save enabled, navigating away is equivalent to Save and Close. This code will prevent any saves that are initiated by the 30 second timer or when people navigate away from a form with unsaved data."
function preventAutoSave(econtext) {
    var eventArgs = econtext.getEventArgs();
    if (eventArgs.getSaveMode() == 70 || eventArgs.getSaveMode() == 2) {
        eventArgs.preventDefault();
    }
}

Now its time for us to try this code snippet.

3. Lets see how could we apply this for the account entity. So lets navigate to solution and open the account entity form as shown below.


4. Open the account form and click on Form properties.


5. First we need to add a library. Click on Add.



6. Web resource library could be defined as follows. And then click on Text editor.



7. Lets add the code snippet from SDK.



8. And we need to SAVE and PUBLISH this webresource js library. ( Please note that its possible to add this js webresource library by directly navigating to Solution--> Webresource--> Add a new webresource. )


9. Now we need to choose the webresource library that we created and click on Add.


10.  Please note that we selected the webresource library and choose the event as OnSave. And then click on Add function which is located below the Form library.




11. Lets define the function as follows. Please note that we need to tick the Pass execution context as first parameter.Lets say okay and press okay button.



12.  Now lets SAVE the form and PUBLISH form.

13 Lets see how to test this. Just change something on the account record and we could see that the save button changes to Unsaved changes. But even after 30 sec or more time, it doesn't save anything automatically.

14. The change would get saved only when the user clicks on the save button. So we disabled the autosave feature only for Account entity with our friend CRM 2013 SDK.

15. Now consider another scenario. We do not want to disable the autosave but we would like to execute some js code when the record is not autosaved. Lets call the function as RecognizeSave.

function RecognizeSave(econtext) {
    var eventArgs = econtext.getEventArgs();
    if (eventArgs.getSaveMode() == 70 || eventArgs.getSaveMode() == 2) {
      
// The js code which should be executed during auto save goes here.
//Please note we are not preventing autsave in this case.
    }
else
{
// The  js code that should not be executed during the auto save mode goes here.
}
}

Saturday, 5 October 2013

Lync calls from CRM 2013 OR How to make a Lync call from CRM 2013 OR Click to call feature in CRM 2013 OR Lync integration in CRM 2013

Version used for this post: CRM 2013 Online Trial
"If your organization is set up to use Skype or Lync, you can click or tap a phone number to call your contacts from within Microsoft Dynamics CRM. This capability is called “click to call.” ( Ref: http://www.microsoft.com/en-us/dynamics/crm-customer-center/place-calls-with-skype-or-lync.aspx)


In CRM 2013, there is an organization level setting for Skype / Lync



1. Settings -- > Administation -- > System settings --> General

To make lync calls , make sure its been set to Lync as shown below.


2. Now lets open any account ( this could be any entity with phone number on it) and click on the number.


3. If you have already signed in the Lync you could see the following window to make the call.










Skype calls from CRM 2013 OR How to make a skype call from CRM 2013 OR Click to call feature in CRM 2013

Version used for this post: CRM 2013 Online Trial

"If your organization is set up to use Skype or Lync, you can click or tap a phone number to call your contacts from within Microsoft Dynamics CRM. This capability is called “click to call.” ( Ref: http://www.microsoft.com/en-us/dynamics/crm-customer-center/place-calls-with-skype-or-lync.aspx)


In CRM 2013, there is an organization level setting for Skype / Lync

1. Settings -- > Administation -- > System settings --> General

To make skype calls, make sure its been set to skype as shown below.



2. Format for skype calls --  "+<countrycode><areacode>"

3. Now lets open any account ( this could be any entity with phone number on it) and click on the number.


4. We could see some skype warning message. ( This warning display might be a bit different in your system). Click on Allow.


5. Skype login would appear and then we need to key in our login credentials. Also we need to buy skype credit depending on the phone calls that we make.