This topic contains 4 replies, has 0 voices, and was last updated by chanarbon 7 years, 8 months ago.
-
AuthorPosts
-
February 7, 2017 at 11:56 am #6472
adurangalvisHello,
we are calling a saved search by its internal ID, and we want to output some of the custom fields from the search but we have had no luck. This is what we have so far, the out of the box IDs such as email, last name, birthday and subsidiary work. The custom field one does not work, I have tried putting the field id inside intelnalid() but it doesn’t like that.
Code:
EmployeeSearchAdvanced employeeSearch = new EmployeeSearchAdvanced();
//set saved search id
employeeSearch.savedSearchId = “929”;
// perform the search
SearchResult result = nsservice.search(employeeSearch);
if (result.totalRecords > 0)
{
Console.WriteLine(result.totalRecords);SearchRow[] searchRows = result.searchRowList;
if (searchRows != null && searchRows.Length >= 1)
{
for (int i = 0; i This is a cached copy. Click here to see the original post. -
February 14, 2017 at 9:29 am #6473
adurangalvis**bump**
-
February 23, 2017 at 8:15 am #6474
latchadev -
February 23, 2017 at 11:18 am #6475
jc122500It might be too late and not a perfect way by far, but its how I was able to get it to work. Hopefully it will give you a starting point to figure it out. I created a dictionary outside the search and then loop through the custom fields inside. An example using your code would be something like this. You can use the internal id of the field once it loops through. I am handling the search a little differently so not sure if the [0] is needed on customfieldlist.
–outside loop
Dictionary CustomFields = new Dictionary();
–inside loop
CustomFields.Clear();
foreach(CustomFieldRef c in employeeRow.basic.customFieldList[0]){
if (c.GetType() == typeof(DateCustomFieldRef)) {
CustomFields.Add(c.internalId,((DateCustomFieldRef )c).value.ToString());
}
else if (c.GetType() == typeof(SelectCustomFieldRef))
{
CustomFields.Add(c.internalId, ((SelectCustomFieldRef)c).value.ToString());
}
else if (c.GetType() == typeof(StringCustomFieldRef))
{
CustomFields.Add(c.internalId, ((StringCustomFieldRef)c).value.ToString());
}
else if (c.GetType() == typeof(BooleanCustomFieldRef))
{
CustomFields.Add(c.internalId, ((BooleanCustomFieldRef)c).value.ToString());
}
}
if (CustomFields.ContainsKey(“185”))
{
empcustomone = CustomFields[“185”];
}
if (CustomFields.ContainsKey(“147”))
{
empcustomtwo = CustomFields[“147”];
}
-
February 26, 2017 at 10:21 am #6476
chanarbonFor this concern,
1. If the value for the custom field is not empty, what you do get from customFieldList[0].searchValue (for non-select fields) and customFieldList[0].searchValue.internalId for the select fields.
2. Have you tried it on other fields.
From my point of view, this should be work.
-
AuthorPosts
You must be logged in to reply to this topic.