Last reply
Hi Ummair, OK, Here are three ways to get list name from ListTableId: 1: Hardcode a Map based on known table Ids (documented in the Database Reference ) Map listTableMap; listTableMap.insert("219","AcademicTitle"); listTableMap.insert("225","AmountClass"); listTableMap.insert("2","Associate"); listTableMap.insert("61","Business"); listTableMap.insert("64","Category"); listTableMap.insert("70","CompanyInterest"); listTableMap.insert("109","Competitor"); listTableMap.insert("73","ContactInterest"); listTableMap.insert("19","Country"); listTableMap.insert("97","Credited"); listTableMap.insert("112","Currency"); listTableMap.insert("91","Function"); // Proj. Member Type listTableMap.insert("216","Intent"); listTableMap.insert("94","MrMrs"); listTableMap.insert("76","Position"); listTableMap.insert("79","Priority"); listTableMap.insert("82","Rating"); listTableMap.insert("103","Reason"); listTableMap.insert("222","Rejection"); listTableMap.insert("48","Relation"); listTableMap.insert("100","Source"); listTableMap.insert("88","Status"); listTableMap.insert("130","Template"); listTableMap.insert("67","TypeFollowUp"); listTableMap.insert("85","TypeProject"); listTableMap.insert("106","TypeSelection"); listTableMap.insert("136","UserDefined"); listTableMap.insert("59","UserGroup"); String tableName = listTableMap.get("2"); printLine("Table Name: " + tableName); // prints: Associate 2: Dynamically lookup the table name from the sequence table String GetTableName(Integer tableNumber) { String [] searchFields = String("sequence.TableName").split(","); NSArchiveRestrictionInfo[] restrictions; NSArchiveRestrictionInfo res1; res1.SetName("sequence.TableNumber"); res1.SetOperator("="); res1.SetValues(String(tableNumber.toString()).split(",")); restrictions.pushBack(res1); NSArchiveOrderByInfo[] order; String[] entities = String("").split(","); Integer pageSize = 250; NSArchiveAgent archiveAgent; NSArchiveListItem[] rows = archiveAgent.GetArchiveListByColumns("Dynamic", searchFields, order, restrictions, entities, 0, pageSize); foreach (NSArchiveListItem row in rows) { Map rowData = row.GetColumnData(); String tableName = rowData.get(searchFields[0]); return tableName; } } String table = GetTableName(2); printLine("Table Name: " + table); // prints: ASSOCIATE 3: Use the UserDefinedFieldAgent to look up the list name: NSUserDefinedFieldInfoAgent udefAgent; NSUserDefinedFieldInfo udefInfoList = udefAgent.GetUserDefinedFieldFromProgId("SuperOffice:7", 1); // 1: Contact, 2: Person, 3: Project, 4: Sale, 5: Temp, 6: Appointment, 7: Document printLine("List Name: " + udefInfoList.GetMdoListName()); // prints: List Name: business Hope this helps!