Home › Forums › Bulk Edit Support Forum › Custom Field EntityType of Project Onlin
- This topic has 0 replies, 1 voice, and was last updated 3 years, 12 months ago by
Mantu Singh.
-
AuthorPosts
-
-
June 5, 2019 at 10:23 pm #119646
Mantu Singh
GuestHi,
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());
}
-
-
AuthorPosts
- You must be logged in to reply to this topic.