Meta Data Using WebApiRequest
////////////////Query Entity Metadata along with all attributes/////////////
var url = req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/EntityDefinitions(LogicalName='contact')/Attributes", false);
/////////////////Entity Object Type code///////////////////////
req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.0/EntityDefinitions?$filter=LogicalName eq '" + entityLogicalName + "'&$select=ObjectTypeCode", false);
////////////////////////////////////Querying single Field Metadata/////////////////////
var url = req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/EntityDefinitions(LogicalName='contact')/Attributes(LogicalName='firstname')", false);
/////////////////Querying Relationships///////////////////
var url = req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/RelationshipDefinitions(SchemaName='contactleads_association')", false);
////////////////Query Entity Metadata/////////////////////
var url = req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/EntityDefinitions(LogicalName='contact')", false);
/////////////relationship MetaData///////////////////////////////////
var url = req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/RelationshipDefinitions/Microsoft.Dynamics.CRM.OneToManyRelationshipMetadata?$select=SchemaName,MetadataId,ReferencingEntity,ReferencingAttribute,ReferencedAttribute&$filter=ReferencedEntity eq 'account'", false);
/////////////////Querying global Optionsets////////////
var url = req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/GlobalOptionSetDefinitions(Name='decisionmaker')", false);
///////////////////////////OptionSetMetaData/////////////////////////
var url = req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/EntityDefinitions(LogicalName='account')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$expand=OptionSet&$select=IsValidForAdvancedFind,IsCustomizable,IsRenameable,IsManaged,IsValidForUpdate,IsValidForRead,IsValidForCreate,AttributeType,DisplayName,LogicalName", false);
/////////////////////////Created Record Id//////////////////////////
var req = new XMLHttpRequest();
url;
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");//this request is used for record meta data
req.onreadystatechange = function () {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 200) {
var results = JSON.parse(this.response).value;
//debugger;
optionSetData = results;
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send();
var url = req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/EntityDefinitions(LogicalName='contact')/Attributes", false);
/////////////////Entity Object Type code///////////////////////
req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.0/EntityDefinitions?$filter=LogicalName eq '" + entityLogicalName + "'&$select=ObjectTypeCode", false);
////////////////////////////////////Querying single Field Metadata/////////////////////
var url = req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/EntityDefinitions(LogicalName='contact')/Attributes(LogicalName='firstname')", false);
/////////////////Querying Relationships///////////////////
var url = req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/RelationshipDefinitions(SchemaName='contactleads_association')", false);
////////////////Query Entity Metadata/////////////////////
var url = req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/EntityDefinitions(LogicalName='contact')", false);
/////////////relationship MetaData///////////////////////////////////
var url = req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/RelationshipDefinitions/Microsoft.Dynamics.CRM.OneToManyRelationshipMetadata?$select=SchemaName,MetadataId,ReferencingEntity,ReferencingAttribute,ReferencedAttribute&$filter=ReferencedEntity eq 'account'", false);
/////////////////Querying global Optionsets////////////
var url = req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/GlobalOptionSetDefinitions(Name='decisionmaker')", false);
///////////////////////////OptionSetMetaData/////////////////////////
var url = req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/EntityDefinitions(LogicalName='account')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$expand=OptionSet&$select=IsValidForAdvancedFind,IsCustomizable,IsRenameable,IsManaged,IsValidForUpdate,IsValidForRead,IsValidForCreate,AttributeType,DisplayName,LogicalName", false);
/////////////////////////Created Record Id//////////////////////////
var req = new XMLHttpRequest();
url;
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");//this request is used for record meta data
req.onreadystatechange = function () {
if (this.readyState === 4) {
req.onreadystatechange = null;
if (this.status === 200) {
var results = JSON.parse(this.response).value;
//debugger;
optionSetData = results;
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send();
Comments
Post a Comment