Just set the next rights to the all domain users.
![]() |
| From IT Blog Posts |
Via http://www.cnblogs.com/patrick/archive/2010/04/30/1725167.html
Sergey Kravchenko about Microsoft Dynamics CRM 4.0 implementation and development.
![]() |
| From IT Blog Posts |
if(crmForm.all.new_1!=null)
{
var oField = crmForm.all.new_1;
// field to hide
var FieldToHide;
if(document.getElementById("IDENT") != null)
{
FieldToHide = document.getElementById("IDENT");
FieldToHide.style.display = "block";
}
// section to hide
var td = document.getElementsByTagName("td");
var tableH;
for(var i=0; i<td.length; i++)
{
// enter the correct section name
if(td[i].innerText == "Section name")
{
tableH = td[i].parentNode.parentNode.parentNode;
tableH.style.display = "block";
}
}
// here set the needed picklist value
if(oField.DataValue == 1)
{
// field to hide
if(FieldToHide != null)
{
FieldToHide.style.display = "none";
}
}
else
if(oField.DataValue == 3)
{
// section to hide
if(tableH != null)
{
tableH.style.display = "none";
}
}
}
var ele = document.getElementById("firstname_c");
ele.title = "Name Name Name!";
select ObjectTypeCode, Name, LogicalName, l.Label
from MetadataSchema.Entity e left join
MetadataSchema.LocalizedLabel l on e.EntityId=l.ObjectId
where l.ObjectColumnName='LocalizedName'
and l.CustomizationLevel=1
union
select ObjectTypeCode, Name, LogicalName, l.Label
from MetadataSchema.Entity e left join
MetadataSchema.LocalizedLabel l on e.EntityId=l.ObjectId
where l.ObjectColumnName='LocalizedName'
and l.CustomizationLevel=0
and ObjectTypeCode not in
( select ObjectTypeCode
from MetadataSchema.Entity e left join
MetadataSchema.LocalizedLabel l on e.EntityId=l.ObjectId
where l.ObjectColumnName='LocalizedName'
and l.CustomizationLevel=1
)
SELECT e.Name as EntityName ,l.Label as 'Наименование атрибута', a.LogicalName ,at.Description as 'Тип атрибута' ,a.AttributeLogicalTypeId ,apv.Value as 'Значения пиклиста', lp.Label as 'Наименования пиклиста' ,[AttributeRequiredLevelId] ,[MaxLength] ,[MinValue] ,[MaxValue] ,LookupClass ,LookupStyle ,LookupBrowse FROM [NaviconGroup_MSCRM].[MetadataSchema].[Attribute] a join MetadataSchema.Entity e on e.EntityId=a.EntityId join MetadataSchema.AttributeTypes at on at.AttributeTypeId=a.AttributeTypeId join MetadataSchema.LocalizedLabel l on l.ObjectId=a.AttributeId and l.ObjectColumnName='DisplayName' left join MetadataSchema.AttributePicklistValue apv on apv.AttributeId=a.AttributeId left join MetadataSchema.LocalizedLabel lp on lp.ObjectId=apv.AttributePicklistValueId order by EntityName, l.Label, at.Description,apv.Value
namespace test
{
public class CrmServiceProvider
{
private WebMetadataService.MetadataService _MetaService = null;
///* Create a MetadataService end point */
private WebMetadataService.MetadataService MetaService
{
get
{
if (_MetaService == null)
{
_MetaService = new WebMetadataService.MetadataService();
_MetaService.Url = "http://localhost/mscrmservices/2007/metadataservice.asmx";
// Use a special user credentials
NetworkCredential cred = new NetworkCredential();
cred.Domain = ConfigurationManager.AppSettings["Domain"];
cred.UserName = ConfigurationManager.AppSettings["UserName"];
cred.Password = ConfigurationManager.AppSettings["PassWord"];
_MetaService.UseDefaultCredentials = false;
_MetaService.Credentials = cred;
_MetaService.UnsafeAuthenticatedConnectionSharing = true;
WebMetadataService.CrmAuthenticationToken token = new WebMetadataService.CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = ConfigurationManager.AppSettings["Organization"];
_MetaService.CrmAuthenticationTokenValue = token;
}
return _MetaService;
}
}
public int GetPicklistValueByPicklistName(string PicklistName, string EntityLogicalName, string LogicalName)
{
int retval = -1;
/* Retrieve the attribute metadata */
WebMetadataService.RetrieveAttributeRequest attributeRequest = new WebMetadataService.RetrieveAttributeRequest();
attributeRequest.EntityLogicalName = EntityLogicalName;
attributeRequest.LogicalName = LogicalName; //picklist
WebMetadataService.RetrieveAttributeResponse attributeResponse =
(WebMetadataService.RetrieveAttributeResponse)MetaService.Execute(attributeRequest);
/* Cast the attribute metadata to a picklist metadata */
WebMetadataService.PicklistAttributeMetadata picklist =
(WebMetadataService.PicklistAttributeMetadata)attributeResponse.AttributeMetadata;
foreach (WebMetadataService.Option op in picklist.Options)
{
if (op.Label.UserLocLabel.Label == PicklistName)
retval = op.Value.Value;
}
return retval;
}
}
}
int psv = GetPicklistValueByPaymentSystemName(categorycode, "account", "accountcategorycode");
if (psv > 0)
{
acc.accountcategorycode = new Picklist();
acc.accountcategorycode.Value = psv;
}