Windows Online Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Wednesday, 24 September 2008

Check Number of notes attached to a Crm Record.

Posted on 11:30 by Unknown

Write below code on save of the entity.

var CRM_FORM_TYPE_CREATE = 1;
 
if (crmForm.FormType == CRM_FORM_TYPE_CREATE)
{
    var obj=document.frames(”notescontrol”).document;
    var textarea=obj.getElementsByTagName(’TEXTAREA’);
 
    if (textarea.length < 1)
    {
        alert (”please eneter somenotes”);
 
        // Cancel the save
        event.returnValue = false;
    }
}

Read More
Posted in MS CRM | No comments

CRM Form Types

Posted on 11:26 by Unknown

Is the user creating a new record?
crmForm.FormType == 1

Is the user updating an existing record
crmForm.FormType ==2

Is the user unable to update this record?
crmForm.FormType == 3

Is this record deactivated?
crmForm.FormType == 4

Is the user using the Quick Create form?
crmForm.FormType == 5

Is the user using the Bulk Edit form?
crmForm.FormType == 6

What is the unique ID for this record?
= crmForm.ObjectId

What type of record is this?
= crmForm.ObjectTypeCode

What type of record is this (Entity Name)?
= crmForm.ObjectTypeName

Is the user using the Outlook Client?
crmForm.IsForOutlookClient==true

Is the user using the Outlook Light Client?
crmForm.IsForOutlookLightClient == true

Is the user working On line?
crmForm.IsOnline==true

Have any fields in this form been changed?
crmForm.IsDirty==true
Read More
Posted in Java Script, MS CRM | No comments

Hide all Tabs on CRM Form

Posted on 05:28 by Unknown


//Below is the javascript code, which will hide all tabs on CRM form.
document.getElementById("crmTabBar").style.display = "none";


//If you want to hide a specific tab, use below code:
document.getElementById("tab0Tab").style.display = "none";


//Here "tab0Tab" is first tab on the Crm Form.
Read More
Posted in Java Script | No comments

Tuesday, 23 September 2008

How to attach onClose event to MS CRM Entity.

Posted on 01:49 by Unknown

When you work with CRM Forms, if you want to capture / attach a onClose() Event, just use below javascript code.

window.onunload = function() {
//add code here
}

Read More
Posted in Java Script | No comments

Delete / DisAssociate Many to Many Relationship Record.

Posted on 01:39 by Unknown

When you say DisAssocaiating a Many to Many Relationship Record, then you usually deattach the record, you won't delete the record.

Below function will DisAssocaiate a record. Here, you need to pass three parameter values
Parent Entity Guid,
Child Entity Guid, and
Relationship Name.

public bool DisassociateManyToManyEntityRecords(Moniker Moniker1, Moniker Moniker2, string strEntityRelationshipName)
{
try
{
// Create a request.
DisassociateEntitiesRequest request = new DisassociateEntitiesRequest();

        // Assign the request a moniker for both entities that need to be disassociated.
request.Moniker1 = Moniker1;
request.Moniker2 = Moniker2;

        // Set the relationship name that associates the two entities.
request.RelationshipName = strEntityRelationshipName.Trim();
        // Execute the request.
DisassociateEntitiesResponse response = (DisassociateEntitiesResponse)Service.Execute(request);

        return true;
}

    catch (SoapException ex)
{
return false;
}
}
Read More
Posted in Associated Records | No comments

Retrieve Associated Many to Many Relationship Records.

Posted on 01:15 by Unknown

In our last post we have seen "Creating Records for Many to Many Relationship in MS CRM".

Now how do you retrieve the (many to many) records ?

Its Very Easy .... :) I'm serious.... See below function........

Lets assume, we have "Hotel Reservation" and "Guest" Entity. We have many to many relationship between Guest and HotelReservation Entity.

Below function will return the list of Hotel Reservations (Guids) for the Guest.



public List GetAllAssocaitedRecords(Guid GuestGuid) 
{ 
    string strEntityRelationshipName = "Specify Relationship Name";
 
    List ObjHotelReservationGuids = new List();
 
    string fetchXml = @"<fetch mapping=""logical""> <entity name=""@HotelReservationContactRelation"">
                            <all-attributes />
                            <filter>
                                <condition attribute=""contactid"" operator=""eq"" value =""@GuestGuid"" />
                            </filter>
                            </entity>
                        </fetch>";
 
 
    fetchXml = fetchXml.Replace("@GuestGuid", GuestGuid.ToString());
    fetchXml = fetchXml.Replace("@HotelReservationContactRelation", strEntityRelationshipName );
 
    string strResult = Service.Fetch(fetchXml);
 
    XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(strResult);
    XmlNodeList nodeList = xmlDoc.SelectNodes("resultset/result");
 
    if (nodeList.Count > 0)
    {
        foreach (XmlNode xmlNode in nodeList)
        {
            ObjHotelReservationGuids.Add(new Guid(xmlNode.SelectSingleNode("neuguest_hotelreservationid").InnerText));
        }
    }
    
    return ObjHotelReservationGuids;
}
 


Happy Coding !!!!!


Read More
Posted in Associated Records | No comments

Thursday, 11 September 2008

Creating Records for Many to Many Relationship in MS CRM

Posted on 02:49 by Unknown

Have you ever created Many to Many Relationship in MS CRM 4.0 ?

Use AssociateEntitiesRequest Class (CrmService)
Contains the data needed to add a link between two entity instances in a many-to-many relationship.
When you create Many to Many Relationship between two entities (system / Custom), MS CRM 4.0 creates New Table in MS CRM database. The name would be the "Relationship name" which you specified while creating Many to Many relationship.

Now, how do u associate a record to Entities?

Let's say, You have One "Entity: Contact" and other "Entity: New_CustomEntity".


Step 1: Create the record for first "Entity: Contact" (you will get a GUID for this record)

Step 2: Create the record for Second "Entity: New_CustomEntity" (you will get a GUID for this record)

Step 3: When you create Many to Many Relationship between two entities, you will specify "Relationship name" Eg: Contact_New_CustomEntity_ManyToMany

Step 4: Call below method and pass both the Entity Information with Relationship name. For more info see below example.


// Code Create Moniker for first Entity: Contact
Moniker Moniker1 = new Moniker();
Moniker1.Id = new Guid("SPECIFY GUID For the record");
Moniker1.Name = EntityName.contact.ToString();
 
// Code Create Moniker for second Entity: New_CustomEntity
Moniker Moniker2 = new Moniker();
Moniker2.Id = new Guid("SPECIFY GUID For the record");
Moniker2.Name = EntityName.New_CustomEntity.ToString();
 
string strManyToManyRelationshipName = "Contact_New_CustomEntity_ManyToMany"; 
 
if (ObjCrmHelper.AssociateManyToManyEntityRecords(Moniker1, Moniker2, strManyToManyRelationshipName))
MessageBox.Show("Associated Entities Record.");
else
MessageBox.Show("Error Occoured.");


//Method which will associate the records.
public bool AssociateManyToManyEntityRecords(Moniker Moniker1, Moniker Moniker2, string strEntityRelationshipName)
{
try
{
// Create an AssociateEntities request.
AssociateEntitiesRequest request = new AssociateEntitiesRequest();

        // Set the ID of Moniker1 to the ID of the lead.
request.Moniker1 = Moniker1;

        // Set the ID of Moniker2 to the ID of the contact.
request.Moniker2 = Moniker2;

        // Set the relationship name to associate on.
request.RelationshipName = strEntityRelationshipName;

        // Execute the request.
Service.Execute(request);

        return true;
}

    catch (SoapException ex)
{
return false;
}
}

/******************/
Happy Coding !!!!!!


Read More
Posted in Associated Records | No comments
Newer Posts Older Posts Home
Subscribe to: Comments (Atom)

Popular Posts

  • MS CRM 2011 Beta - Product Keys
    Here are the Product Keys for MS CRM 2011 Beta. The following product keys are available for this release: •Microsoft Dynamics CRM Workgroup...
  • Callout vs. Workflow
    You might find yourself wondering when you should use a pre- or post-callout versus when you should use a workflow rule. As you would expect...
  • Microsoft Dynamics CRM 2011 Release Candidate (RC) Announcement
    The Microsoft Dynamics CRM 2011 Release Candidate (RC) is now available for download from the Microsoft Download Center.  As with the Micros...
  • Declare Global Access Level functions in MS CRM Form.
    Global functions in MS CRM Form. The way CRM adds the javascript to the page, any function defined in the onload event will only have a loca...
  • How to remove the background color of XP Desktop Icon (in Wodows XP)
    In case you are wondering why your Windows XP Desktop Icons have a background, here is a quick guide to restore your transparent background ...
  • Say Hello to the World of Dynamics CRM 2011 Beta version
    Today, the Microsoft Dynamics CRM team has reached a key milestone as it releases the beta of Microsoft Dynamics CRM 2011, for both cloud-ba...
  • Install MS CRM 2011 Beta on Windows 2008 SP2 or Windows 2008 R2?
    I think everybody is consfuse when choosing the Operating System. So here are the facts: 1. You can choose either Windows 2008 SP2 or Window...
  • "Virtual Memory Low"
    “Your system is low on virtual memory” error message when you try to start an application.... Solution : Windows XP 1. Click Start , right-c...
  • Remove / Detach Email from Queue
    DetachFromQueueEmail Message Detaches the e-mail from the specified queue. // Use below code. // Rreplace the WebService URL service.Url = s...
  • Windows Washer v4.5 (Full) (for Windows XP only)
    Download

Categories

  • .NET
  • .NET String Methods
  • Adapters
  • Aggregate Functions
  • All Elements
  • Associated Records
  • Azure
  • BizTalk Adapter
  • Callouts
  • Child Pipeline
  • Crm 2011
  • Crm 2011 Beta
  • Crm 2011 Beta - Ribbons
  • Crm 2011 Beta Installation
  • CRM Online 2011
  • Customizations
  • Database
  • Debug
  • Deployment Service
  • Dynamic Entity
  • Email
  • FetchXml
  • FileSync
  • Form Assistant
  • Hide Button
  • IIS
  • Integration
  • Internet Connectivity
  • ISV
  • Java Script
  • Lead Capture
  • MS CRM
  • MS CRM 2011 RC
  • MS CRM 4 Roll Ups
  • MS CRM 5 Features
  • MS CRM Accelerators
  • MS CRM Entity Schema
  • MS CRM Global Variable and Functions
  • MS CRM Templates
  • Pivot Tables
  • Plugin Constructor
  • Plugins
  • Reports
  • s
  • Save Record
  • SDK
  • Sharepoint
  • Sharepoint 2010
  • Sharing Data Between Plug-ins
  • Social Networking
  • SSRS
  • Tabs
  • Tracing
  • Videos
  • Visual Studio 6
  • VPC
  • WampServer
  • Windows Service
  • Windows XP
  • Workflows
  • xRM

Blog Archive

  • ►  2013 (4)
    • ►  September (4)
  • ►  2012 (8)
    • ►  September (1)
    • ►  July (7)
  • ►  2011 (12)
    • ►  July (1)
    • ►  March (1)
    • ►  February (2)
    • ►  January (8)
  • ►  2010 (27)
    • ►  December (1)
    • ►  October (3)
    • ►  September (10)
    • ►  August (2)
    • ►  July (5)
    • ►  June (5)
    • ►  February (1)
  • ►  2009 (41)
    • ►  December (1)
    • ►  November (5)
    • ►  August (3)
    • ►  July (2)
    • ►  June (3)
    • ►  May (9)
    • ►  April (2)
    • ►  March (5)
    • ►  February (7)
    • ►  January (4)
  • ▼  2008 (33)
    • ►  December (7)
    • ►  November (3)
    • ►  October (1)
    • ▼  September (7)
      • Check Number of notes attached to a Crm Record.
      • CRM Form Types
      • Hide all Tabs on CRM Form
      • How to attach onClose event to MS CRM Entity.
      • Delete / DisAssociate Many to Many Relationship Re...
      • Retrieve Associated Many to Many Relationship Reco...
      • Creating Records for Many to Many Relationship in ...
    • ►  August (4)
    • ►  July (1)
    • ►  February (4)
    • ►  January (6)
  • ►  2007 (11)
    • ►  October (3)
    • ►  September (1)
    • ►  August (3)
    • ►  July (4)
Powered by Blogger.

About Me

Unknown
View my complete profile