none
Search a resource Uid by the value of a custom field. RRS feed

  • Question

  • Hi everybody,

    I have some enterprise resources created and a custom field called resourceId for each one. I'm trying to get the RES_UID value but the dataset always get null value. Here I paste the code, can anyone tell me what was wrong?

    // Function that returns the Uid for a enterprise custom field
    Guid? customFieldUId = GetCustomFieldUIdByName("resourceId", EntityTypes.Recursos);
    
    ResourceWebSvc.ResourceDataSet resourceDs = new ResourceWebSvc.ResourceDataSet();
    string tableName = resourceDs.ResourceCustomFields.TableName;
    string cfUidColumn = resourceDs.ResourceCustomFields.MD_PROP_UIDColumn.ColumnName;
    string valueColumn = resourceDs.ResourceCustomFields.NUM_VALUEColumn.ColumnName;
    string resUidColumn = resourceDs.ResourceCustomFields.RES_UIDColumn.ColumnName;
    
    PSLibrary.Filter.FieldOperationType equal = PSLibrary.Filter.FieldOperationType.Equal;
    PSLibrary.Filter.LogicalOperationType and = PSLibrary.Filter.LogicalOperationType.And;
    
    PSLibrary.Filter resourceFilter = new PSLibrary.Filter();
    resourceFilter.FilterTableName = tableName;
    
    resourceFilter.Fields.Add(new PSLibrary.Filter.Field(resUidColumn));
                
    PSLibrary.Filter.FieldOperator byCustomFieldUid = new PSLibrary.Filter.FieldOperator(equal, cfUidColumn, customFieldUId);
    PSLibrary.Filter.FieldOperator byIdRecurso = new PSLibrary.Filter.FieldOperator(equal, valueColumn, idRecurso);
    resourceFilter.Criteria = new PSLibrary.Filter.LogicalOperator(and, byCustomFieldUid, byIdRecurso);
    
    resourceDs = resourceSVC.ReadResources(resourceFilter.GetXml(), false);
    // After this, resourceDs is always null 

    Thank you in advanced!

    Friday, April 13, 2012 9:19 AM

Answers

All replies