CustomField Look up Table update issue.

Jul 20, 2013 at 6:41 PM
Once again need your help. I am not sure what i am doing wrong ?

I am trying to update a customlookup field value. If value exists in lookup table everything is fine. If value not exists then getting error as below.

I would like to know if value not exists whether FluentPS insert lookup values automatically or we need to insert values ?

[PSLookupField("{xxxx}",LookupTableUid="{xxx}",LookupTableName = "LookupTable1", FieldName = "LookupField1")]
public string CFLookupField1 { get; set; }

projectDetails.CFLookupFieldValue1 = strLookupFieldValue1
Error Details:Specified argument was out of the range of valid values.
Parameter name: No lookup value 'XXX XXXX-XXXX XXXXXXXXX' found. Lookup Uid: xxxxxxxx-xxxx-xxxx-xxxx-7a71173c54ad
Error Details:   at FluentPS.Services.Impl.PSLookupTableService.GetLookupValueUids(Guid lookupTableUid, IList dataList, Type valueType)
   at FluentPS.Mapping.EntityDataMapper`1.GetLookupValueUids(Guid lookupTableUid, Object fieldValue)
   at FluentPS.Mapping.EntityDataMapper`1.MapCustomFieldsToDataSet(T entity, Guid entityUid, DataTable dtCustomFields, List`1 propertiesToUpdate, ICustomFieldsMappingInfo cfMappingInfo, PSEntityType entityType, EntityWorkflowStageFieldsInfo stageFieldsInfo)
   at FluentPS.Services.Impl.PSProjectService`1.Update(T entity, Guid sessionId, List`1 propertyInfos)
   at FluentPS.Services.Impl.PSProjectService`1.Update(T entity, Guid sessionId)
   at SynchProjectDataWinApp.UpdateProjectData.UpdateProjectDataFromExternal() in C
Coordinator
Jul 22, 2013 at 8:04 AM
Hi
, you should manually write a code to insert new value to the lookup. PSLookupTableService class is used for this purpose.
Andrew
Jul 22, 2013 at 4:02 PM
Thanks for the response. Is there any sample or example which i can reference.

I need to verify whether lookup value already exists if not need to add the value. I found the some code in the below site.
Kindly help if you have any samples or any other place i can refer.

http://sharepoint1on1.blogspot.com/2013/01/project-server-update-custom-lookup.html
Coordinator
Jul 23, 2013 at 7:41 AM
It would be easier for you to PSLookupTableService class intead of WCF client directly. The sample you can probably use is in class CreateLookupTableByDefinitionTest in Samples project. The Idea is to use AddLookupTableValues method of PSLookupTableService class.