Export Ask Now results

Once an Ask Now is completed, export its results using any of these methods:

Note: Ask Now does not store question wording, answers, and metadata in the same set of System fields that the legacy Ask Now used. Every question on an Ask Now is a unique Feedback field. This allows Medallia Text Analytics processing to run.

Custom data export

Use the Custom data option to export the Ask Now question fields from the Results sub-tab:

Select Excel from the Export icon in the Web reporting toolbar

For more information, see Export data from Responses List reports.

Note: By default, all Ask Now question are included in the export, although there might be more available to select if they were configured in Ask Now Medallia Setup Exports screen.

K-fields

Use K-fields with the getAskNow() function and an export to download these fields in a file, based on the filter and timeperiod criteria.

getAskNow() exposes all Ask Now data applied to the record (Survey ID) evaluated by the K-field. If the Survey ID has an Ask Now associated to it, it returns an object with each Ask Now question content (wording), response (value), 'Other' choice set item ('Other' question content and response, if applicable), and translation (if applicable); otherwise, it returns null.
{
    "questions":[
        {
            "wording":"theQuestionWording",
            "values":[
                "value1",
                "value2"
            ],
            "translatedComment":"theCommentTranslatedToTheTargetLanguage",
            "otherQuestion":"wording":"theOtherQuestionWording",
            "values":[
                "otherQuestionValue1",
                "otherQuestionValue2"
            ],
            "translatedComment":"theOtherQuestionCommentTranslated"
        }
}
Note: The attribute values is always an array with 0 or 1 values for single-value questions and n values for multi-valued ones. If the question is not translated, the translatedComment attribute is null. If the question does not have an 'Other' choice set item associated, the otherQuestion attribute is null.

Configure K-fields

Follow these steps to configure K-fields to export Ask Now data:

Tip: Create a separate K-field for each Ask Now question content (wording), response (value), 'Other' choice set ('Other' question value, if applicable), and translation (if applicable).
  1. From Setup K-fields screen, click New.

  2. Enter a distinctive label and name, such as asknow_checkout_question1_wording.

  3. On Slug Availability, choose Export only.

  4. On Alternative Set, choose the Alternative set that matches what the getAskNow() exports.

  5. On Calculation, click Edit JavaScript to open the JavaScript editor, and add the these code snippets depending on what to export:

    • To export an Ask Now question content (wording):

      (function() {
      
      	var asknowArray = getAskNow();
      
      	// If there is no Ask Now data associated to the survey ID (record), it returns an empty string.
      	if (asknowArray == null) {
      
      	return '';
      
      	} else { 
      		//Checks if there is AskNow data associated with survey ID (record).
      		var askNowQuestions = asknowArray.questions;
      
      		var questionIndex = 0;
      
      		//If there is at least one question, it returns the wording of the first question. 
      		//Change the questionIndex value [0] for subsequent questions.
      		//For example, to retrieve the second question wording in the response record use questionIndex=1 .
      		if (
      
      		Array.isArray(askNowQuestions) &&
      
      		askNowQuestions.length > questionIndex &&
      
      		askNowQuestions[questionIndex] &&
      
      		askNowQuestions[questionIndex].wording
      
      		) {
      
      			return askNowQuestions[questionIndex].wording;
      
      			} else {
      
      			return '';
      
      			}
      
      		}
      
      })();
    • To export an Ask Now question response (value):

      (function() {
      
      	//Defines if a record value has Date data type.  
      	const dateRegEx = /((Mon)|(Tue)|(Wed)|(Thu)|(Fri)|(Sat)|(Sun))\s((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))/;
      
      	var askNowArray = getAskNow();
      
      	// If there is no Ask Now data associated to the survey ID (record), return an empty string.
      	if(askNowArray === null){
      
      		return '';
      
      	}else{
      		//Checks if there is Ask Now data associated with survey ID (record).
      
      		var askNowQuestions = askNowArray.questions;
      
      		//If there is at least one question response, it returns the value of the first question response. 
      		//Change the array value [0] to return the value of subsequent question responses.
      		//For example, to retrieve the second question value in the response record use askNowQuestions[1].values.
      		if (askNowQuestions.length >= 1){
      
      			var askNowQuestionsValues = askNowQuestions[0].values;
      
      			//Determines if the response value is either a single value or an array.
      			//If the value is of Date Data type, it transforms it into a string, otherwise returns a single value. 
      			//If the value is multi-valued, it returns an array (multi-value separated by comma).
      			if (askNowQuestionsValues.length === 1){
      
      				if (dateRegEx.test(askNowQuestionsValues[0]))
      
      					return askNowQuestionsValues[0].toString();
      
      				else
      
      				return askNowQuestionsValues[0];
      
      			}else{
      
      				if (askNowQuestionsValues.length >1){
      
      					var outputMultiValuedSet = '';
      
      					// Uses getName to return the name of the AltSet instead of the Sequence Number.
      
      					for (var i=0;i<askNowQuestionsValues.length;i++){
      
      						outputMultiValuedSet = outputMultiValuedSet + askNowQuestionsValues[i].getName() + ',';
      
      					}
      
      				return outputMultiValuedSet;
      
      			}else{
      
      			return '';
      
      			}
      
      			}
      
      		// If the survey taker does not answer, it returns an empty string. 
      
      		}else
      
      		return '';
      
      	}
      
      })();
    • To export an Ask Now question content translation (if applicable):

      (function() {
      	
          var askNowArray = getAskNow();
      	//If there is no Ask Now data associated to the survey ID (record), it returns an empty string.
      	if(askNowArray == null){
      		return '';
      	}else{
      		//Checks if there is AskNow data associated with survey ID (record).
      		var askNowQuestions = askNowArray.questions;
      		//If there is at least one question, it returns the translation of the first question. Change the array value [0] to return the value of subsequent question responses. For example, to retrieve the second question translation in the response record use askNowQuestions[1].translatedComment. If there is no translation, it returns an empty string; otherwise, it returns a translation. 
      		if (askNowQuestions.length >= 1){
      			if (askNowQuestions[0].translatedComment == null)
      				return '';
      			else
      				return askNowQuestions[0].translatedComment;
      		// If the survey taker does not answer, it returns an empty string.
      		}else{
      			return '';
      	    }
      	}
      
      })();
    • To export an Ask Now question 'Other' choice set item (if applicable):

      Content (wording):

      (function() {
      	
          var askNowArray = getAskNow();
      
      	//If there is no Ask Now data associated to the survey ID (record), it returns an empty string.
      	if(askNowArray == null){
      		return '';
      	}else{
      		//Checks if there is Ask Now data associated with survey ID (record).
      		var askNowQuestions = askNowArray.questions;
      		
      		//If there is at least one question with 'Other' choice set item, returns the wording of 'Other' choice set item for the first question. Change the array value [0] to return the wording of 'Other' choice set item subsequent questions. For example, to retrieve the second question's 'Other' choice set item content (wording) in the response record use askNowQuestions[1].otherQuestion.
      		if (askNowQuestions.length >= 1){
      			var askNowOtherQuestion = askNowQuestions[0].otherQuestion;
      
      			//If there is no 'Other' choice set item, it returns an empty string, otherwise returns an 'Other' choice set item content (wording).
      			if (askNowOtherQuestion == null)
      				return '';
      			else
      				return askNowOtherQuestion.wording;
      
      		// If the survey taker does not answer, it returns an empty string.
      		}else{
      			return '';
      	    }
      	}
      
      })();

      Response (value):

      (function() {
      	
          var askNowArray = getAskNow();
      	
      	// If there is no Ask Now data associated to the survey ID (record), it returns an empty string.
      	if(askNowArray == null){
      		return '';
      	}else{
      		
      		//Checks if there is AskNow data associated with survey ID (record).
      		var askNowQuestions = askNowArray.questions;
      		
      		//If there is at least one 'Other' choice set item, returns the response (value) of the 'Other' choice set item. Change the array value [0] to return the value of 'Other' choice set item subsequent questions. For example, to retrieve the second question's 'Other' choice set item response (value) in the response record use askNowQuestions[1].otherQuestion.
      		if (askNowQuestions.length >= 1){
      			var askNowOtherQuestion = askNowQuestions[0].otherQuestion;
      			
      		//If there is no 'Other' choice set item, it returns an empty string; otherwise, it returns an 'Other' choice set item response (value).
      			if (askNowOtherQuestion == null)
      				return '';
      			else
      				return askNowOtherQuestion.values;
      		}else{
      			return '';
      	    }
      	}
      
      })();
  6. To export Ask Now metadata, add these code snippets depending on what to export:
    • User (also known as Author)

      (function() {
          var askNowArray = getAskNow();
      	// If there is no Ask Now data associated to the survey ID (record), it returns an empty string.
      	if(askNowArray == null){
      		return '';
      	}else{
      	// If there is no Ask Now user (author), it returns an empty string.
              if (askNowArray.ask_now_author == null){
                  return '';
      	// If there is an Ask Now user associated with the Ask Now, it returns the user name as follows: jdoe.
              }else{
                  return askNowArray.ask_now_author;  
              }
      	}
      })();
    • Ask Now name

      (function() {
          var askNowArray = getAskNow();
      	// If there is no Ask Now data associated to the survey ID (record), it returns an empty string.
      	if(askNowArray == null){
      		return '';
      	}else{
      	// If there is no Ask Now name, it returns an empty string.
              if (askNowArray.ask_now_name == null){
                  return '';
      	// If there is an Ask Now name, it returns the name as follows: AN name.
              }else{
                  return askNowArray.ask_now_name;  
              }
      	}
      })();
      
    • Ask Now ID

      (function() {
          var askNowArray = getAskNow();
      	// If there is no Ask Now data associated to the survey ID (record), it returns an empty string.
      	if(askNowArray == null){
      		return '';
      	}else{
      	// If there is no Ask Now name, it returns an empty string.
              if (askNowArray.ask_now_id == null){
                  return '';
      	// If there is an Ask Now ID, it returns the ID as follows: 5480.
             }else{
                  return askNowArray.ask_now_id;  
              }
      	}
      })();
    • Status

      (function() {
          var askNowArray = getAskNow();
      	// If there is no Ask Now data associated to the survey ID (record), it returns an empty string.
      	if(askNowArray == null){
      		return '';
      	}else{
      	// If there is no Ask Now status, it returns an empty string.
              if (askNowArray.ask_now_status == null){
                  return '';
      	// If there is an Ask Now status, it returns the status as follows: ACTIVE.
              }else{
                  return askNowArray.ask_now_status;  
              }
      	}
      })();
    • Start date

      (function() {
          var askNowArray = getAskNow();
      	// If there is no Ask Now data associated to the survey ID (record), it returns an empty string.
      	if(askNowArray == null){
      		return '';
      	// If there is an Ask Now, it stores the array of the existing start and end dates.
      	}else{
      		var askNowDates=askNowArray.ask_now_date_ranges;
      	// If there is no start or end date, it returns an empty string. 
              if (askNowDates == null){
                  return '';
      	}else{
      	    // If the Ask Now has a start date, it checks if the variable is null and returns NULL as a string.
                  if (askNowDates[0].start_date == null || askNowDates[0].start_date == 'NULL' ){
                      return 'NULL';
      	    // If there Ask Now has a start date, it returns the start date formatted as string.
      	    }else{
                      return askNowDates[0].start_date.toString();
                  } 
              }
      	}
      })();
    • End date

      (function() {
          var askNowArray = getAskNow();
      	// If there is no Ask Now data associated to the survey ID (record), it returns an empty string.
      	if(askNowArray === null){
      		return '';
      	// If there is an Ask Now, it stores the array of the existing start and end dates.
      	}else{
      		var askNowDates=askNowArray.ask_now_date_ranges;
      	// If there is no start or end date, it returns an empty string. 
              if (askNowDates === null){
                  return '';
              }else{
      	    // If the Ask Now has a end date, it checks if the variable is null and returns NULL as a string.		
                  if (askNowDates[0].end_date === null || askNowDates[0].end_date === 'NULL' ){
                      return 'NULL';
      	    // If there Ask Now has a end date, it returns the end date formatted as string.		
                  }else{
                      return askNowDates[0].end_date.toString();
                  } 
              }
      	}
      })();
    • Scope

      (function() {
          var askNowArray = getAskNow();
      	// If there is no Ask Now data associated to the survey ID (record), it returns an empty string.
      	if(askNowArray === null){
      		return '';
      	// If there is an Ask Now, it initializes the variables to store the object structure (All units versus Condition and Scope).
      	}else{
              var anCondition = ""; // Stores the Audience attributes as a string.
              var anAllUnits = ""; // Units. "Yes" if the Target audience is 'All surveys takers from the parent survey'.
              var anUGs = ""; // Stores Units and Unit groups as a string if the Target audience is 'Custom' and has a Unit or Unit group selected.
      		// It stores the object of the Ask Now that contains the scope. 
      		var askNowScope = askNowArray.ask_now_scope;
      	// If there is an Audience attribute condition, it stores it in the corresponding variable; otherwise, it stores "FALSE".       
              if (askNowScope.condition != null){
                  anCondition = askNowScope.condition;
              }else{
                  anCondition = "FALSE"; 
              }
      	// If Ask Now Target audience is 'All survey takers from parent survey', it sets anAllUnits as "Yes" and anUGs as "N/A".   
              if (askNowScope.all_unit_groups === true){
                  anAllUnits = "Yes";
                  anUGs = "N/A";
      	// If If Ask Now Target audience is 'Custom' and it has Units and Unit groups,  anAllUnits is set to "No" and the Units and Unit groups are parsed as strings.  
             }else{
                  anAllUnits = "No";
                  var UGs = askNowScope.unit_groups;
      			var len = UGs.length;
      			// Parses the Units and Unit groups as a formatted string.
      			for(var i=0;i<len;i++){
      				if(i===0){
      					anUGs = "(";
      				}
      				if(i===len-1){
      					anUGs = anUGs+ UGs[i].name;
      					anUGs = anUGs + ")";
      				}else{
      					anUGs = anUGs+ UGs[i].name + ", ";
      				}
      			}
              }
      	// Returns the concatenation of the Audience attributes condition and whether or not this Ask Now has a restricted audience.
              return "[Condition: " + anCondition + " |  All Units: " + anAllUnits + " | Scope: " + anUGs + "]";
          }
      })();
      
  7. Click Save.

Configure an export

From the Exporters screen, create a new export to download the previously created K-fields:

  1. Click Create.

  2. Enter a name for the export.

  3. Enter the name of export file.

  4. Define the Order where the export appears in the list on the Exports screen.

  5. Select the Format of the file.

  6. Under Fields, select the K-fields to include in the export.

  7. Define the Time period.

  8. Select the Time field to identify the time range to apply to survey records during export.

  9. Click Create.

Export details for Ask Now K-fields.

For more information, see Create an export .