About Me

I am Microsoft CRM MVP based in India. I have Experience in various Microsoft Technologies including(Dynamics CRM Beta 2011,2011,MS CRM 3.0,4.0,C#,ASP.net,VB 6.0,Sql Server, sharepoint,WCF,WWF,Silverlight). I have extensive experience in CRM Customization and Development.I have used Dynamics CRM as XRM platform in many applications. Most of the time you can catch me at CRM Forum and CRM Development Forum.

you can contact me at mahender80[at]hotmail[dot]com if you need any CRM customization or Development help.

15 Comments (+add yours?)

  1. Nishant Rana
    Aug 21, 2010 @ 05:18:44

    Hi Mahendar,
    Nice blog !
    How are you?

    Regards,
    Nishant Rana

    Reply

  2. Naresh
    Nov 10, 2010 @ 05:44:10

    Hai Mahenderpal,
    This blog is very helpful.one request from my side
    How we will get MVP.is there any certification needed for This MVP.give me reply.

    Thanks & regards
    Naresh.D

    Reply

  3. Vivek Gupta
    Jul 04, 2011 @ 11:14:20

    Hello sir,
    This is very useful blog. I have a problem, Give me a solution.
    How to find out the the user wise lookup in an entity in which look up is mapped with that entity in ms crm 2011
    I have a lookup in an entity and i want to show the value in that lookup which is assigned that user. For e.g: I have a entity Ultimate and i have a lookup Agency in the entity “ultimate”. I want when a user login and create a new ultimate then onload, Agency will show, in which that ageny mappened with that user. Also when system admin or any other user create ultimate Entity, then agency will show according to that user in MS CRM 2011

    Reply

    • mahenderpal
      Jul 05, 2011 @ 05:42:19

      Thanks for the compliment Vivek,

      I hope, you have relationship between user and agency entity ?? you can write a javascript to populate agency based on user id.

      Hope it will help you

      Reply

  4. Vivek Gupta
    Jul 06, 2011 @ 13:00:05

    Thanx for the reply.
    Ya , I have relationship beween user and agency. I have write a javascript for identify the agency look up id in a user. From this when i open ultimate entity , the agency will show according to that user but now the problem is, it only shows a agency icon, not the name. It will show agency name after saving it. I want agency name will show onload of ultimate entity.
    plz suggest me.

    Regards
    Vivek Gupta

    Reply

    • mahenderpal
      Jul 07, 2011 @ 10:45:00

      make sure you are having some value in primary field in agency entity, it seens name field is blank in agency entity, otherwise share your code.

      Reply

  5. Vivek Gupta
    Jul 11, 2011 @ 10:54:26

    Thanks for replying………
    function onload()
    {
    if(crmForm.FormType == 1)
    {
    var userid = Xrm.Page.context.getUserId();
    //alert(userid);

    //var lookupid = Xrm.Page.getAttribute(“nadrs_agencyid”).getValue();
    //Xrm.Page.getAttribute(“nadrs_submittoagencyid”).setValue(lookupid);

    function GetAttributeValueFromID( sEntityName, sGUID, sAttributeName, sID, sAgencyName)
    {
    var xml = “” +
    “” +
    “”+GenerateAuthenticationHeader() +
    ” ” +
    ” ” +
    ” ” +
    ” “+sEntityName+”" +
    ” ” +
    ” ” +
    ” “+sAttributeName+”" +
    ” ” +
    ” ” +
    ” false” +
    ” ” +
    ” 1″ +
    ” 1″ +
    ” ” +
    ” ” +
    ” And” +
    ” ” +
    ” ” +
    ” “+sID+”" +
    ” Equal” +
    ” ” +
    ” “+sGUID+”" +
    ” ” +
    ” ” +
    ” ” +
    ” ” +
    ” ” +
    ” ” +
    ” ” +
    “” +
    “”;

    var xmlHttpRequest = new ActiveXObject(“Msxml2.XMLHTTP”);

    xmlHttpRequest.Open(“POST”, “/mscrmservices/2007/CrmService.asmx”, false);
    xmlHttpRequest.setRequestHeader(“SOAPAction”,”http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple”);
    xmlHttpRequest.setRequestHeader(“Content-Type”, “text/xml; charset=utf-8″);
    xmlHttpRequest.setRequestHeader(“Content-Length”, xml.length);
    xmlHttpRequest.send(xml);

    // retrieve response and find attribute value
    var result = xmlHttpRequest.responseXML.selectSingleNode(“//q1:” +sAttributeName);

    if (result == null)
    return “”;
    else
    return result.text;
    }

    var num = (GetAttributeValueFromID(“systemuser”, userid, “nadrs_userid”, “systemuserid”));

    var value = new Array();
    var agency = new Object();
    agency.typename= “nadrs_agency”;
    agency.id =num;
    //agency.name=num.name;

    value[0] =agency;

    Xrm.Page.getAttribute(“nadrs_agencyid”).setValue(value);

    //Xrm.Page.getAttribut(“nadrs_agencyid”).setValue([{id: num, name: "nadrs_userid", entityType: "systemuser"}]);
    //Xrm.Page.getAttribute(“nadrs_agencyid”).setValue( [{id: "idValue", name: "textValue", entityType: "typeValue"}]);
    }
    }
    it will give me user id and agency id in user entity. I want to found agency name . How it will display on load in the ultimate entity in agency lookup..

    Reply

    • mahenderpal
      Jul 11, 2011 @ 11:01:31

      Vivek, this script is not correct you should get error in this script if you are using it in ms crm 2011, are you sure you are using the same script ???

      Reply

  6. Vivek Gupta
    Jul 12, 2011 @ 05:04:05

    Sorry, This was not the right script. Follow is the right script. I have pasted it correct, i don’t know how it will seem like above. Anyone Following is the right script.
    function onload()
    {
    if(crmForm.FormType == 1)
    {
    var userid = Xrm.Page.context.getUserId();
    //alert(userid);

    //var lookupid = Xrm.Page.getAttribute(“nadrs_agencyid”).getValue();
    //Xrm.Page.getAttribute(“nadrs_submittoagencyid”).setValue(lookupid);

    function GetAttributeValueFromID( sEntityName, sGUID, sAttributeName, sID, sAgencyName)
    {
    var xml = “” +
    “” +
    “”+GenerateAuthenticationHeader() +
    ” ” +
    ” ” +
    ” ” +
    ” “+sEntityName+”" +
    ” ” +
    ” ” +
    ” “+sAttributeName+”" +
    ” ” +
    ” ” +
    ” false” +
    ” ” +
    ” 1″ +
    ” 1″ +
    ” ” +
    ” ” +
    ” And” +
    ” ” +
    ” ” +
    ” “+sID+”" +
    ” Equal” +
    ” ” +
    ” “+sGUID+”" +
    ” ” +
    ” ” +
    ” ” +
    ” ” +
    ” ” +
    ” ” +
    ” ” +
    “” +
    “”;

    var xmlHttpRequest = new ActiveXObject(“Msxml2.XMLHTTP”);

    xmlHttpRequest.Open(“POST”, “/mscrmservices/2007/CrmService.asmx”, false);
    xmlHttpRequest.setRequestHeader(“SOAPAction”,”http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple”);
    xmlHttpRequest.setRequestHeader(“Content-Type”, “text/xml; charset=utf-8″);
    xmlHttpRequest.setRequestHeader(“Content-Length”, xml.length);
    xmlHttpRequest.send(xml);

    // retrieve response and find attribute value
    var result = xmlHttpRequest.responseXML.selectSingleNode(“//q1:” +sAttributeName);

    if (result == null)
    return “”;
    else
    return result.text;
    }

    var num = (GetAttributeValueFromID(“systemuser”, userid, “nadrs_userid”, “systemuserid”));

    var value = new Array();
    var agency = new Object();
    agency.typename= “nadrs_agency”;
    agency.id =num;
    //agency.name=num.name;

    value[0] =agency;

    Xrm.Page.getAttribute(“nadrs_agencyid”).setValue(value);

    //Xrm.Page.getAttribut(“nadrs_agencyid”).setValue([{id: num, name: "nadrs_userid", entityType: "systemuser"}]);
    //Xrm.Page.getAttribute(“nadrs_agencyid”).setValue( [{id: "idValue", name: "textValue", entityType: "typeValue"}]);
    }
    }

    Reply

  7. Vivek Gupta
    Jul 12, 2011 @ 05:06:21

    Hey in your blog, the code is not correctly published here. I don’t know why. But i have only copy and paste my code here. But in this page , it will not display.

    Reply

  8. sameer
    Dec 04, 2011 @ 23:27:34

    Can you help me with few lines of code using CRM 2011 SDK to retrieve all the Active directory groups that a user in context belongs to?

    To give you some background, i have requirement to implement user profile role based access funtionality in my project. The project is coded using .net csharp. But some parts of this project are hosted on CRM as hosted and webhosted applications.

    Groups like payments, frontoffice ..etc have been created in Active Directory and users are assinged to one of these groups when they join and removed if they leave. Hence it is essential for us to use active directory to retrieve any information. I am not sure how to go about this implementation. If you can help with some idea and also few lines of code to get user groups from AD, that would be much appreciated.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 58 other followers