SHARE
TWEET

Untitled

a guest Jun 19th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function process(g_request, g_response, g_processor) {
  2.     var app = "slack slash";
  3.     var tablename = "u_slash_commands";
  4.    
  5.     var record = new GlideRecord(tablename);
  6.     record.setValue("u_method",g_request.getMethod());
  7.     record.setValue("u_querystring",g_request.getQueryString());
  8.    
  9.     var urlParamList = g_request.getParameterNames();
  10.     while(urlParamList.hasMoreElements()){
  11.         var param = urlParamList.nextElement();
  12.         var value = g_request.getParameter(param);
  13.         record.setValue(formatToSNStandards(param),value);
  14.     }
  15.  
  16.  
  17.     var urlheaderList = g_request.getHeaderNames();
  18.     while(urlheaderList.hasMoreElements()){
  19.         var header = urlheaderList.nextElement();
  20.         var headerValue = g_request.getHeader(header);
  21.         record.setValue(formatToSNStandards(header),headerValue);  
  22.     }
  23.    
  24.     record.insert();
  25.     // Add your code here
  26.     g_response.setStatus(200);
  27.  
  28. })(g_request, g_response, g_processor);
  29.  
  30. function formatToSNStandards(string){
  31.     string=string.replace("-","_");
  32.     return "u_"+string;
  33. }
RAW Paste Data
Top