- This topic has 0 replies, 1 voice, and was last updated 5 years, 6 months ago by .
Viewing 0 reply threads
Viewing 0 reply threads
- The forum ‘Bulk Edit Support Forum’ is closed to new topics and replies.
Home › Forums › Bulk Edit Support Forum › Custom Field EntityType of Project Onlin
Hi,
I am writing some code for retrieving Custom Field which Entity Type is Projects, But i am not able to retrieve Entity Type of any particular custom Field.
Please see this code and correct me how to solve it.
‘use strict’;
ExecuteOrDelayUntilScriptLoaded(initializePage, “sp.js”);
//SP.SOD.executeOrDelayUntilScriptLoaded(initializePage, “PS.js”);
var projContext;
var projects;
var customFields;
var entityTypes;
var projEntity;
var pCustomFields;
function GetCustomFieldsName() {
var projContexts = PS.ProjectContext.get_current();
customFields = projContexts.get_customFields();
entityTypes = projContexts.get_entityTypes();
projEntity = entityTypes.get_projectEntity();
projContexts.load(customFields);
projContexts.load(entityTypes);
projContexts.load(projEntity);
// Run the request on the server.
projContexts.executeQueryAsync(getCFName, getCFFailed);
}
function getCFName() {
var cfEnumerator = customFields.getEnumerator();
var projentitypes = projEntity.get_name();
var SelectedOption;
var count = 1;
while (cfEnumerator.moveNext()) {
var cf = cfEnumerator.get_current();
// var cfProjType = cf.get_entityTypes().get_name();
projContext.load(cf);
projContext.executeQueryAsync(function () {
var s = cf.get_entityTypes();
}, getCFFailed);
if (projEntity.get_name() == “Project”) {
SelectedOption += “<option value=” + cf.get_internalName() + “>” + cf.get_name() + “</option>”;
count++;
}
}
$(‘#ddlListBox1’).html(SelectedOption);
$(‘#spanTotalCF’).html(count);
}
function getCFFailed(sender, args) {
$(‘#divCustomFieldMessage’).text(“Failed to execute: ” + args.get_message());
}