var priority = 0; var rtn = ArrayNew(1); var tempQuestions = ""; var groups =variables.cedata.getCEData(application.customerKnowledgeMap.getQuestionGroupFormName()); var cleanedGroups = StructNew(); var i =1; if(Len(questionID)){ tempQuestions = variables.cedata.getCEData(application.customerKnowledgeMap.getQuestionFormName(),"id",arguments.questionID); }else{ tempQuestions = variables.cedata.getCEData(application.customerKnowledgeMap.getQuestionFormName(),"guuid",session.guuid); } for(i=1;i<=ArrayLen(groups);i++){ cleanedGroups[groups[i].values.id] = groups[i].values.name; } for(i=1;i<=ArrayLen(tempQuestions);i++){ if(StructKeyExists(tempQuestions[i].values,"active") and tempQuestions[i].values.active eq 1){ //Add in the group name tempQuestions[i].values.groupName = cleanedGroups[tempQuestions[i].values.groupID]; priority = 0; switch(tempQuestions[i].values.priority){ case "High":{ priority = 3; break; } case "Medium":{ priority = 2; break; } case "Low":{ priority = 1; break; } } tempQuestions[i].values.priorityOrder = priority; //Add it to the return array (arrayAppend so we dont get spaces of null crap) ArrayAppend(rtn,tempQuestions[i]); } } rtn = variables.ceData.arrayOfCEDataSort(rtn,"priorityOrder","desc"); return rtn; if(len(arguments.storyID)){ return variables.ceData.getCEData(application.customerKnowledgeMap.getStoryFormName(),"id",arguments.storyID); }else if(len(arguments.answerID)){ return variables.ceData.getCEData( customElementName = application.customerKnowledgeMap.getStoryFormName(), queryType = "search", searchValues=arguments.answerID, searchFields="customerAnswerIDs"); }else if(Len(arguments.accountID)){ return variables.ceData.getCEData(application.customerKnowledgeMap.getStoryFormName(),"accountID",arguments.accountID); }else if(Len(arguments.categoryID)){ return variables.ceData.getCEData(application.customerKnowledgeMap.getStoryFormName(),"categoryID",arguments.categoryID); }else if(Len(arguments.text)){ return variables.ceData.getCEData( customElementName = application.customerKnowledgeMap.getStoryFormName(), queryType="search", searchValues=arguments.text, searchFields="title,content,marketingValue" ); }else{ return variables.ceDAta.getCEData(application.customerKnowledgeMap.getStoryFormName(),"guuid",session.guuid); } var story = getStory(storyID); if(ArrayLen(story)){ return story[1].pageID; } return -1; var i = ''; var tempStruct = ''; var scheduleParams = ''; var scheduleUUID = ''; var scheduleArray= ArrayNew(1); for(i=1;i<=ArrayLen(answerObjects);i++){ tempStruct = StructNew(); tempStruct.bean = "customerKnowledgeMapDAO"; tempStruct.method = "saveAnswer"; tempStruct.args = answerObjects[i]; ArrayAppend(scheduleArray,tempStruct); } scheduleParams = StructNew(); scheduleParams.tasksPerBatch = 50; scheduleParams.delay = 1; scheduleUUID = createUUID(); variables.scheduler.scheduleProcess(scheduleUUID,scheduleArray,scheduleParams); if(variables.scheduler.getScheduleStatus(scheduleUUID).status != "failure"){ return true; }else{ return false; } var answerObject= StructNew(); var dump = ""; answerObject.accountID = arguments.accountID; answerObject.customerQuestionID = arguments.customerQuestionID; answerObject.id = arguments.id; answerObject.value = arguments.value; answerObject.contact = arguments.contactID; answerObject.guuid = session.guuid; answerObject.enteredBy = request.user.id; if(Len(arguments.dataPageID)){ answerObject.dataPageID = arguments.dataPageID; } dump = Application.ADF.utils.doDump(answerObject,"answerObject","true",true); application.ADF.utils.logAppend("There was NOT an error while saving answer. #dump#","customerKnowledgeMapErrors.html"); var results = variables.csContent.populateContent(application.customerKnowledgeMap.getAnswerFormName(),answerObject); if(results.contentUpdated){ return true; }else{ dump = Application.ADF.utils.doDump(results,"results","true",true); application.ADF.utils.logAppend("There was an error while saving answer. #dump#","customerKnowledgeMapErrors.html"); return false; } var whereClauseRequired = false; var returnArray = ArrayNew(1); var concatenatorRequired = false; var questionStruct = ""; if(Len(accountID) || Len(answerID) || Len(questionID)){ whereClauseRequired = true; } select * from questionAnswerMapping qa join ( select accountID, questionID, max(dateApproved) as 'dateApproved' from questionAnswerMapping qa group by accountID, questionID ) sqa on qa.questionID = sqa.questionID and sqa.dateApproved = qa.dateApproved order by qa.groupName, (case qa.priority when 'High' then 3 when 'Medium' then 2 when 'Low' then 1 end ) desc, qa.question, qa.account, qa.dateApproved desc answers = variables.data.queryToArrayOfStructures(answers); for(i=1;i<=ArrayLen(answers);i++){ if(Len(answers[i].enteredBy)){ contactData = variables.csData.getContactData(answers[i].enteredBy); contactData = variables.data.queryToArrayOfStructures(contactData); if(ArrayLen(contactData)){ answers[i].enteredBy = contactData[1].FirstName&" "&contactData[1].lastName; } } } if(Len(arguments.contactID)){ return variables.ceDAta.getCEData(application.customerKnowledgeMap.getContactFormName(),"id",arguments.contactID); }else if(Len(arguments.accountID)){ return variables.ceDAta.getCEData(application.customerKnowledgeMap.getContactFormName(),"account",arguments.accountID); }else{ return variables.ceData.getCEData(application.customerKnowledgeMap.getContactFormName(),"guuid",session.guuid); } select accountID as id, account, Max(dateApproved) as dateUpdated from questionAnswerMapping where guuid = and enteredBy = group by accountID, account order by dateUpdated desc select id, name from CKMAccountView where guuid = and name like order by name if(Len(searchID)){ return variables.ceData.getCEdata(application.customerKnowledgeMap.getSavedSearchFormName(),"id",arguments.searchID); }else if(Len(userID)){ return variables.ceData.getCEdata(application.customerKnowledgeMap.getSavedSearchFormName(),"userID",arguments.userID); }else{ return variables.ceData.getCEdata(application.customerKnowledgeMap.getSavedSearchFormName()); }