Actually I try to get access token of salesforce DC from salesforce MC by SSJS Httppost I need to create a record in salesforce object From Salesforce marketing cloud pages
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script runat="server">
Platform.Load("Core","1.1.1");
try {
</script>
%%[
Var @body, @callstatus, @response<br>
Set @body = '{<br>
"grant_type":"password",<br>
"clientId":"Id",<br>
"clientSecret":"****",<br>
"username":"test@email",<br>
"password":"MyPassword12345"<br>
}'<br>
HTTPPost2("https://login.salesforce.com/services/oauth2/token", "application/x-www-form-urlencoded", @body, True, @callstatus, @response)<br>
]%% <br>
<script type="text/javascript" runat="server">
} catch (e) {
Write(Stringify(e));
}
</script><br>
Call:%%=v(@callstatus)=%%<br>
Res:%%=v(@response)=%%
</head>
<body>
</body>
</html>
Getting Error
{"message":"The function expression is invalid. See inner exception for detail.\r\n <br>
Script: HTTPPost2(\"https://login.salesforce.com/services/oauth2/token\", \"application/x-www-form-urlencoded\", @body, True, @callstatus, @response)\r\n<br>
Index: 1098\r\n<br> ListID: 0\r\n" ,<br>
"description":"ExactTaOMM.InvalidScriptException: The function expression is invalid. See inner exception for detail.\r\n<br>
Script: HTTPPost2(\"https://login.salesforce.com/services/oauth2/token\", \"application/x-www-form-urlencoded\", @body, True, @callstatus, @response)\r\n
Index: 1098\r\n ListID: 0\r\n <br>
Error Code: OMM_FUNC_EXPR_INVALID\r\n<br>
- from Jint --> \r\n\r\n<br>
--- inner exception 1---\r\n\r\nExactTarget.OMM.FunctionExecutionException: An error occurred when attempting to evaluate a HTTPPost2 function call. See inner exception for details.\r\n<br>
Error Code: OMM_FUNC_EXEC_ERROR\r\n - from OMMCommon --> \r\n\r\n<br>
--- inner exception 2---\r\n\r\nSystem.Net.WebException: The remote server returned an error: (400) Bad Request. - from System\r\n\r\n\r\n\r\n\r\n\r\n"} <br>
Call: Res: