Social Icons

Featured Posts

Apr 3, 2014

CRM 2013 Save Event Arguments

Using save event arguments, you can manipulate save event processing -

from Sdk -

In the save event you can use the execution context object getEventArgs method to retrieve an object that contains methods you can use to manage the save event.

Save Event Argument Methods

getSaveMode
Returns a value indicating how the save event was initiated by the user.
isDefaultPrevented
Returns a value indicating whether the save event has been canceled because the preventDefault method was used in this event hander or a previous event handler.
preventDefault
Cancels the save operation, but all remaining handlers for the event will still be executed.

Thanks,

Amol

Mar 12, 2014

Say no to blurry label

With CRM 2013, we started seeing fields with blurry label and changing of just label width doesn’t help. In order to display complete label, we also need adjust the label area’s pixel in the section of a field. This is how you can do it.

image

 

image 

image 

clip_image002

Mar 5, 2014

Build Your Demos using Demo builder 2013

 

 

Demo builder helps you build demos with data which can be used in your corporate demo. It also comes with OOB SharePoint integration, Azure Integration as well as customer portal. Very handy for setting up quick demo environment.

 clip_image003

Check this link for details -  https://www.microsoftdynamicsdemos.com/

clip_image002[6]

Aug 11, 2013

Script to check dirty fields of CRM form

 

function forceSubmitDirtyFields() {

   var message = "The following fields are dirty: \n";

    Xrm.Page.data.entity.attributes.forEach(function (attribute, index) {

        if (attribute.getIsDirty() == true) {

            attribute.setSubmitMode('always');

         message += "\u2219 " + attribute.getName() + "\n";

        }

    });

  alert(message);

}

 

 

 

 

 

Apr 11, 2013

Setting default pricelist for an entity

You can use SDK.JQuery.js file which comes with sdk. Here is the code to set the default pricelist with name start with “Default”
 
//set default price list for opportunity
function setDefaultPriceList() {
    var defaultPriceListStartsWith = "Default";
    SDK.JQuery.retrieveMultipleRecords("PriceLevel",
                                "?$filter=startswith(Name, '" + defaultPriceListStartsWith + "')",
                                function (retrievedPriceLists) {
                                    if (retrievedPriceLists.length > 0) {
                                        setPriceList(retrievedPriceLists[0]);
                                    }
 
                                },
                                errorHandler,
                                onCompleteRetrieveMultiple
                                );
}
 
//set pricelist for opportunity
function setPriceList(priceList) {
    if (priceList != null) {
        var defaultPriceListAttrib = Xrm.Page.getAttribute("pricelevelid");
        if (defaultPriceListAttrib.getAttributeType() == "lookup") {
            setSimpleLookupValue("pricelevelid", "pricelevel", priceList.PriceLevelId, priceList.Name);
        }
    }
}
// set lookup value
function setSimpleLookupValue(LookupId, Type, Id, Name) {
    var lookupReference = [];
    lookupReference[0] = {};
    lookupReference[0].id = Id;
    lookupReference[0].entityType = Type;
    lookupReference[0].name = Name;
    Xrm.Page.getAttribute(LookupId).setValue(lookupReference);
}
 
 

Mar 21, 2013

MVC and windows authentication

I was working on MVC intranet application to display CRM data for logged in user. Everything was working as expected while running from visual studio, I have deployed the app in IIS using application pool with  specific user.

Enabled windows authentication and Asp.Net Impersonation. All set to run the application. However when I tried, it was keep redirecting me to login page with error page.

 

        

 

I checked all the setting again, no clue. Everything was looking good. After reading few post, forums, I got to know “System.Web.Helpers which is a helper that you find in WebMatrix is the culprit J.

By default it calls the SimpleMembership provider and not windows authentication in my case or any other authentication resulting in the behavior I was seeing.

Make sure your turn off the default authentication by adding following keys if you are using helper. If you can avoid using it.    

<add key="autoformsauthentication" value="false" />

<add key="enableSimpleMembership" value="false" />

 

Cheers!

Amol