CSV file example:
Category,Name,Status,Handler,Submit Date Folder,“Sample, Inc”,active,Mike Clinton,10/19/04 2:35 PM Software Bug,Can’t login,003 Closed,,10/19/04 2:50 PM
Use the following script to get the values of the attributes:
String categoryName = (String) inputMap.get("Category"); String taskName = (String) inputMap.get("Name"); String statusName = (String) inputMap.get("Status"); String handlerName = (String) inputMap.get("Handler"); String submitDateStr = (String) inputMap.get("Submit Date");
Use the following script to import a task from the specified file:
Map taskMap = new HashMap(); String locale = sc.getUser().getLocale(); DateFormatter df = new DateFormatter(sc.getUser().getTimezone(), locale); taskMap.put(CSVImport.TASK_NAME, inputMap.get("Name")); taskMap.put(CSVImport.TASK_CATEGORY_ID, CSVImport.findCategoryIdByName((String) inputMap.get("Category"))); taskMap.put(CSVImport.TASK_STATUS_ID, CSVImport.findStateIdByName((String) inputMap.get("Status"), (String) inputMap.get("Category"))); taskMap.put(CSVImport.TASK_HANDLER_USER_ID, CSVImport.findUserIdByName((String) inputMap.get("Handler"))); taskMap.put(CSVImport.TASK_SUBMIT_DATE, inputMap.get("Submit Date") != null ? df.parseToCalendar((String) inputMap.get("Submit Date")) : null); return taskMap;