3 Mart 2010 Çarşamba

CRM 4.0 lookup filtreleme

<CRM site folder>\_controls\lookup\lookupsingle.aspx dizinine yazılacak kod;

<script runat="server">

protected override void OnLoad( EventArgs e )
{
base.OnLoad(e);
      crmGrid.PreRender += new EventHandler( crmgrid_PreRender );
}

void crmgrid_PreRender( object sender , EventArgs e )
{
// As we don't want to break any other lookups, ensure that we use workaround only if
// search parameter set to fetch xml.
if (crmGrid.Parameters["search"] != null && crmGrid.Parameters["search"].StartsWith("<fetch"))
    {
        crmGrid.Parameters.Add("fetchxml", crmGrid.Parameters["search"]); 

// searchvalue needs to be removed as it's typically set to a wildcard '*'
        crmGrid.Parameters.Remove("searchvalue"); 

// Icing on a cake - ensure that user cannot create new contact outside of the account
// and then select it.
this._showNewButton = false;
    }
}

</script>

 

Filtreleme yapmak istediğimzi bir lookupı aşağıdaki şekilde bir fecht xml ile kolayca filtreleyebilriz.
onchange event a;

var field = crmForm.all.new_ilceid;
if( crmForm.all.new_ilid.DataValue == null || crmForm.all.new_ilid.DataValue=="")
{
   debugger;
   crmForm.all.new_ilceid.DataValue=null;
    // Disable lookup for new account record as there can be no contacts
    //field.Disabled = true;
}
else
{
  field.lookupbrowse = 1;
  crmForm.all.new_ilceid.DataValue=null;
debugger;
field.AddParam("search",
     "<fetch mapping='logical'><entity name='new_ilce'>"
    + "<filter><condition attribute='new_ilid' operator='eq' value='"
    +  crmForm.all.new_ilid.DataValue[0].id
    + "' /></filter></entity></fetch>");
//field.additionalparams += "&selObjects=1&findValue=0";

}

İşte sonuç ;

Capture

 

 

Kaynak:http://crm.georged.id.au/post/2008/02/16/Filtering-lookup-data-in-CRM-4.aspx

27 Şubat 2010 Cumartesi

Teklif ürünleri ve Sipariş ürünleri arasında mapping işlemi

In SQL Server Management Studio.  Run the following query:
Select * from entitymapbase where targetentityname = 'salesorderdetail'
This query should return three items, we care about the row with a SourceEntityName column value of "quotedetail".

Now copy the GUID value of the EntityMapId column for that row.
Then I use this URL, and at the end of it I paste the GUID that I just
copied:
http://yourservernamehere/Tools/SystemCustomization/Relationships/Mappings/mappingList.aspx?mappingId=
This gives me the secret hidden mappings that I was after, between "Quote Product" and "Order Product".  It is just another normal CRM GUI relationship mappings form.

20 Şubat 2010 Cumartesi

Set the State/Status of A Custom Entity in CRM 4.0

SetStateDynamicEntityRequest stateReq = new SetStateDynamicEntityRequest();

stateReq.Entity = new Moniker();

stateReq.Entity.Id = new Guid("The GUID of your Entity instance here");
stateReq.Entity.Name = "your entity Name here";

//Set to Inactive
stateReq.State = "inactive";
stateReq.Status = -1;

//Set to Active
//stateReq.State = "active";
//stateReq.Status = 1;

SetStateDynamicEntityResponse stateSet = SetStateDynamicEntityResponse)crmService.Execute(stateReq);