Hi All,
I am trying to add a hierarchical set of lookup entries to a lookup table. But all the entries come in a single level. I am using managed client object model for the same. How do I implement indentation ? Following is the code snippet I am using to create a lookup table :
LookupTableCreationInformation linfo = new LookupTableCreationInformation(); linfo.Id = new Guid(); linfo.Name = "Test 01"; linfo.SortOrder = LookupTableSortOrder.Ascending; LookupMask mask = new LookupMask(); mask.Length = 2; mask.MaskType = LookupTableMaskSequence.CHARACTERS; mask.Separator = "."; LookupMask mask2 = new LookupMask(); mask2.Length = 5; mask2.MaskType = LookupTableMaskSequence.CHARACTERS; mask2.Separator = "."; LookupEntryCreationInformation LCntCrInf = new LookupEntryCreationInformation(); LCntCrInf.Description = "Test"; var id = new Guid(); LCntCrInf.Id = id; LCntCrInf.Value = new LookupEntryValue(); LCntCrInf.Value.TextValue = "Aa"; LookupEntryCreationInformation EntryInfo2 = new LookupEntryCreationInformation(); EntryInfo2.Value = new LookupEntryValue(); EntryInfo2.Value.TextValue = "Bb"; EntryInfo2.ParentId = id; EntryInfo2.Description ="level2"; EntryInfo2.Id = new Guid(); List<LookupEntryCreationInformation> lcreInfo = new List<LookupEntryCreationInformation>(); List<LookupMask> lmaskCreIf = new List<LookupMask>(); lmaskCreIf.Add(mask); lmaskCreIf.Add(mask2); lcreInfo.Add(LCntCrInf); lcreInfo.Add(EntryInfo2); linfo.Masks = lmaskCreIf; linfo.Entries = lcreInfo; ctx.LookupTables.Update(); ctx.ExecuteQuery();
In the code I am adding two masks, and then two entries. I am assigning to the parent id of the second entry, the id of the first entry.
Everything is being created fine, except the second entry should be a child of the first entry (ie its full value should be Bb.Aa). How am I supposed to resolve this ?
Thanks,
Swayam