Created
June 19, 2017 14:47
-
-
Save manvillej/676a7bbe15007f742267d55242e5fa97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function process(g_request, g_response, g_processor) { | |
var app = "slack slash"; | |
var tablename = "u_slash_commands"; | |
var record = new GlideRecord(tablename); | |
record.setValue("u_method",g_request.getMethod()); | |
record.setValue("u_querystring",g_request.getQueryString()); | |
var urlParamList = g_request.getParameterNames(); | |
while(urlParamList.hasMoreElements()){ | |
var param = urlParamList.nextElement(); | |
var value = g_request.getParameter(param); | |
record.setValue(formatToSNStandards(param),value); | |
} | |
var urlheaderList = g_request.getHeaderNames(); | |
while(urlheaderList.hasMoreElements()){ | |
var header = urlheaderList.nextElement(); | |
var headerValue = g_request.getHeader(header); | |
record.setValue(formatToSNStandards(header),headerValue); | |
} | |
record.insert(); | |
// Add your code here | |
g_response.setStatus(200); | |
})(g_request, g_response, g_processor); | |
function formatToSNStandards(string){ | |
string=string.replace("-","_"); | |
return "u_"+string; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment