How to pass CRM 2011/2013 Custom Lookup attribute extraqs Parameters in openEntityForm utility method from java script

While trying to pass a custom lookup field value as an extraqs parameter,, using the Xrm.Utility.openEntityForm method from my java script, I came across this rule that their is a difference in the way we should set value of a custom lookup and the traditional simple lookup.
with code sample explained below.

var parameters = {};
parameters[“title”] = “Fill in the title here”;
parameters[“customerid”] = custGuid;
parameters[“customeridname”] = custFullName;
parameters[“customeridtype”] = “contact”;
Xrm.Utility.openEntityForm(“incident”, null, parameters);

if you observe above customerid is the actual CRM field schema name of the incident entity. but in the parameters we have passed 2 more additional fields, by suffixing the “customerid” field with “name” for setting the “Name” field of the lookup record and “type” for setting the lookup entity logical name.

while trying the same funda for my custom entity lookup field named “new_customerhometown” , of type “new_hometown” on my incident form open using

parameters[“new_customerhometown”] = homeTownGuid;
parameters[“new_customerhometownname”] = “Hyderbad”;
parameters[“new_customerhometowntype”] = “new_hometown”;

the above code keeps failing with errors. All the web search was taking me to the example of traditional setting of Lookup to Customer or Owner, who use all the below 3 step assignments to perform the task. for example to set the owner field one has to set ownerid, ownername,ownertype=”sustemuser”/”team”

I was going crazy to find the difference between existing lookups like Customer / Owner etc and a custom lookup.
but luckily I found this msdn post, http://msdn.microsoft.com/en-us/library/gg334375.aspx

Capture

so by following the 1st guideline for simple lookup i.e
• For simple lookups you must set the value and the text to display in the lookup. Use the suffix “name” with the name of the attribute to set the value for the text.Do not use any other arguments.

I set the parameters like below and it worked perfect for me.

parameters[“new_customerhometown”] = homeTownGuid;
parameters[“new_customerhometownname”] = “Hyderbad”;

all I have to do was remove the type assignment. Please note the name parameter is just optional and for setting the Guid field you have to use the attribute schema name as it is. not required to suffix it with any “id” string.

the reason behind such rule to my observation is the traditional look ups like “Owner” / “Customer” / “PartyList” etc can have multiple data types, hence mentioning the type is mandatory else not.

but what I can not understand is, why they need to fail the call, while every other places we use a lookup field we are setting its type why its not allowed here, may be not to increase the url length or whatever, definitely annoyed me a lot 😀

Hope this post helps more !!!

Posted in CRM 2011, CRM 2011 Online, CRM2013, java script, OData | Tagged , , , , | 2 Comments

How to get the team members details from a team ID in Dynamics CRM 2011/2013 Using OData Call

Recently I had the requirement to display the list of team member details like User Name, Full Name etc. in java script.
I was using the Odata designer tool found at http://crm2011odatatool.codeplex.com/
but since team members is a many to many relationship between User and Team I knew that I have to use the $expand tag in the Odata on the teammembership_association , which is the name of the many to many relationship here.

But my confusion started because I was trying to retrieve it using the entity name “TeamMembershipSet” which was causing the Odata query to fail when I try running it in the Browser.
But finally I found that I need to use TeamSet instead of TeamMembershipSet or SystemUserSet.
so the below query worked flawlessly for me.

https://servername/xrmservices/2011/OrganizationData.svc/TeamSet?$select=teammembership_association/DomainName,teammembership_association/FullName,teammembership_association/SystemUserId,teammembership_association/IsDisabled&$expand=teammembership_association&$filter=TeamId eq guid’8e033b49-6e7f-e311-9359-d89d6765b238′

though I struggled a bit due to the confusion with the presence of teammembership entity name in the list, I am glad I could finally figure it out. posting it for others who might have similar difficulty.

Posted in CRM 2011, CRM 2011 Online, CRM 2011 SDK, CRM2013, java script, OData | Tagged , , , , | Leave a comment

CRM 2013 New Features on Form Customization – QUICK VIEW FORM

Just found this pleasantly surprised but not so talked about feature that has added to CRM 2011 form Customization.

Years have struggled with adding a lot of java scripts to display related lookup attributes fields on a form, but no more, with the new Quick View Form, one can define a set of fields that are required to be displayed in a related record as an embedded section on the form.

One can create multiple such Quick View Forms for an entity and can use them to embed specific fields values from a related lookup field and display them in parent record form, without writing a single line of script to the form.

one can multiple such Quick view forms on an entities main firm, and the best part is one can never differentiate in the look and feel department that these fields are actually not stored as an attribute in the main entity rather, pulled from the related lookup field on demand.

an example is: if you are customizing a Contact Main form, and you would like to have the Parent Account Address fields to be reflected on the contact form, all you need to do is just create a quick view form on the Account entity , which the desired address fields added to it and insert this Account Quick View form to the Contact Main form.

Like any regular sections, one can give a Label to the group, display or Hide the label etc., all through few simple clicks.

Another Awesome fact about it is, user can not edit these fields on the Parent entity form, by default they are read only, hence forcing the user directly on the actual lookup entity form.

here is a picture of how it looks on the Contact form…. in the sample picture I have added two Quick Views to the Contact form 1- Account Quick View and Owner Quick View side by side, under a single tab.

1- Form Customization View

P2

2- Quick View Data Actually rendered on the Contact Form

P1

Posted in CRM2013 | Tagged | Leave a comment

Dynamics CRM Linq Query error “The method ‘Count’ is not supported”

As I was trying to Bind a Dynamics CRM Linq Query result to a DataGrid, I was in need to check the total result returned from the query.

My initial sample looked as below, gave me the exception saying “The method ‘Count’ is not supported”

var xrm = newXrmServiceContext(“Xrm”);

var exampleContacts = xrm.ContactSet.Where(c => c.EMailAddress1.EndsWith(“.com”)).ToList();

var count = exampleContacts.Count<Contact>();

if (count > 0)

{

ContactsGridView.DataSource = exampleContacts;

ContactsGridView.DataBind();

}

It is due to the reason that by using var, .Net implicitly takes the type of the result and in this case it is

Microsoft.Xrm.Sdk.Linq.Query<Contact> exampleContacts;

All I had to do was implicitly cast it to a list by using “ToList()” which helped me in getting the desired result back.

IEnumerable<Contact> exampleContacts = xrm.ContactSet.Where(c => c.EMailAddress1.EndsWith(“.com”)).ToList();

var count = exampleContacts.Count<Contact>();

if (count > 0)

{

string alert = String.Format(“<SCRIPT LANGUAGE=\”\”JavaScript\”\”>alert(\”Hello this is an Alert {0}\”)</SCRIPT>”, count);

System.Web.HttpContext.Current.Response.Write(alert); 

ContactsGridView.DataSource = exampleContacts;

ContactsGridView.DataBind();

}

 

Hope you get benefit from this post.

Do like and comment on the post.

HAPPY CODING!!!!

Posted in CRM 2011, CRM 2011 Online, CRM 2011 SDK, CRM2013, Linq | Tagged , , , | Leave a comment

Dyamics CRM 2013 SDK Portal Sample “WebAppWalkthrough” connectionstring issue for CRM 2013 O365 Login

When trying to test the Microsoft Dynamics CRM 2013 web portal sample that is available in the path of …\SDK\Walkthroughs\Portal\WebAppWalkthrough ,

I see that the web.config contains a connection string entry as below

<connectionStrings>

<addname=XrmconnectionString=Server=http://crm/contoso; Domain=CONTOSO; Username=Administrator; Password=pass@word1 />

</connectionStrings>

There were so sample Connection string provided for the O365 login, so even if I replaced the server url and provided the Username and Password, It was still not working.

It is not able to perform successful login.

The username is not provided. Specify username in ClientCredentials.             

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The username is not provided. Specify username in ClientCredentials.
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

 

on further search over Net I found the below link from AdxStudio

http://community.adxstudio.com/products/adxstudio-portals/developers-guide/knowledge-base/crm-connection-string-format/

following which I changed my connection string as below in the portal web.config and there you go..the sample works just awesome.

<connectionStrings>

<addname=XrmconnectionString=Server=https://samsorgname.crm5.dynamics.com;Username=yyyyy@samsorgname.onmicrosoft.com; Password=zzzzzzzz />

</connectionStrings>

P2

Hope this is helpful for you, do comment or like my post !!!!!

Happy CODING…

Posted in CRM 2011 | Tagged , , | Leave a comment

How to remove QVO6 virus successfully from Windows 8 all browsers like IE, firefox, Chrome

I suffered for this Virus called QVO6 which get open in all of my browsers every time I open.

it was so annoying that I tried all possible ways, removed any such Add in, changed the Home page setting, deleted any registry entry that has the name QVO6 to it, deleted the browser cookies or temp data etc, even removed any software that I may not recognize or does not belongs to “Microsoft” still I was not able to remove, I was going crazy for months.\

but finally I found from where it was loading for all of my browser, though all those registry entry deletion helped but this setting I am going to talk is the last string 🙂

steps:

1. right click on the browser short cut you might have pinned into the task bar, from that menu again right click against the corresponding browser.exe , then select “Properties” ->shortcut -> target.

remove anything after the corresponding exe path..and booommm that did it. I am the happiest one now, after so many months struggle I found the peace with my browser.

the below URL help me with this last solution for sure..

http://www.techsupportall.com/how-to-remove-qvo6-com-search-homepage-from-ie-firefox-chrome/

Posted in Virus | Tagged | Leave a comment

Network Discovery Getting Auto Turned off – SERVER 2012

While setting up my Server 2012 instance using windows hyper-v, I saw that whenever I set the Network discovery service to On from

(Control Panel\All Control Panel Items\Network and Sharing Center\Advanced sharing settings) and save the changes, it resets back to off.

after searching some I found that by enabling and starting the below services “Network Discovery” was set to On.

–      DNS Client

–      Function Discovery Resource Publication

–      SSDP Discovery

–      UPnP Device Host

Posted in Windows Server 2012 | Tagged , | Leave a comment

How to Generate Comma Separated Double Quote Qualified Unicode CSV from SQL Server

Recently for Data migration task using SQL server SSIS packages I needed a way to create Unicode encoded Comma separated Quote delimited CSV file directly from SQL server which can consume data from SQL stored procedure or complex SQL statement . for me by default it was generating ANSI encoded csv. when I searched in net I was getting methods of achieving so using SQL command line. But luckily later found the way to do so using UI from SQL management studio.

here is the step by step process on how to do so

Step 1: Select Export task on the database

CSV1

Step 2: Click Next in the Import wizard

Pic2

Step 3: Choose the Data source as the Data base from which you want to get the data from

Pic3

Step 4: Select the destination as given below.

Make sure to giving the Text qualifier as “

Choose the other parameters as shown in the below snapshot.

Make sure to check the Unicode check box as shown below.

Click Next

Pic4

Step 5: Select “Write a query to specify the data to transfer” if you have any custom select statements that need to be exported to the csv and click “next”

Pic5

Step 6: Write the SQL query in the below box and click “Next”

Pic6

Step 7: verify the mapping and delimiters, click “next”

Pic7

Step 8: Click Next to get the CSV immediately

Pic8

Step 9: Click “Next” and Finish

Pic9

Step 10: wait for the process to complete successfully

Pic10

Step 11: Check the generated CSV at the Specified location

And verify the Unicode format

pic11

Posted in Data Migration, SQL 2008, SQL 2012, SQL Server | Tagged , , , | Leave a comment

Windows 8 VirtualBox Vt-x not available

Recently when I moved my Oracle VM into a new laptop with Windows 8 OS, while trying to open my VM I keep getting the below error

Posted in CRM 2011 | Tagged , | Leave a comment

Debugging a biztalk 2010 mapping file with custom xml input

While trying to debug and test my BizTalk mapping file, I face this issue that the auto generated xml keeps giving me validation error, this is because the auto generated xml input file generated the data without obeying the type expected for the corresponding element.
for example , I had some guid fields in my input schema and the auto generated field will just insert a text value into that node, which was causing the validate map as well as the test map and debug map to fail.

in order to fix it, I was looking for a way to give my custom input xml , in place of the auto generated one’s.

I could do that by following the following steps

1. right click on your .btm file that you want to debug and open the properties.

2. in the map properties window set the below properties
testmap input = XML
testmap input instance =

if you want no validation to happen, you can even set the below properties to false

Validate testmap input = false
Vaidate testmap output = false

3. after that you can save the project and right click on the btm file and select “debug map”
2013-04-14_1730

Cheers 🙂 !!!!

Posted in Biztalk, Biztalk 2010, Buztalk debugging | Tagged , , | Leave a comment