We have successfully configured AD_v2 connection , but not able to create users in AD using spoke

C_S3
Tera Contributor

Hello All, 

We have successfully configured AD_v2 connection , but not able to create users in AD using spoke. We are getting below error : 


Root cause of JavaScriptException: org.mozilla.javascript.NativeError
JavaScript evaluation error on:
(function execute(inputs, outputs) {

function handleError(error_message) {
var errMessage = error_message;
var actionErrors = {
CANT_FIND_OBJECT: "Cannot find an object with identity"
};
var commErrors = {
AUTH_FAILURE: "Authentication failure with the user",
SERVER_UNAVAILABLE: "The RPC server is unavailable",
UNREACHABLE_STATUS: "Failed to access target system. Please check credentials and firewall settings on the target system to ensure accessibility: Access is denied."
};
var errorMessages = {
INVALID_OBJECT_IDENTITY: "Invalid resource name",
CREDENTIALS_FAILED: "Invalid credentials for host",
ACCOUNT_LOCKED_OUT: "The referenced account is currently locked out and may not be logged on to",
INVALID_HOST: "Invalid hostname in connection or host not reachable from MID Server",
AUTH_FAILED_WITH_MID: "Host credentials incorrect. Authentication error in MID Server"
};

if (error_message.indexOf(commErrors.AUTH_FAILURE) != -1)
error_message = errorMessages.CREDENTIALS_FAILED;
else if (error_message.indexOf(actionErrors.CANT_FIND_OBJECT) != -1)
error_message = errorMessages.INVALID_OBJECT_IDENTITY;
else if (error_message.indexOf(commErrors.SERVER_UNAVAILABLE) != -1)
error_message = errorMessages.INVALID_HOST;
else if (error_message.indexOf(commErrors.UNREACHABLE_STATUS) != -1)
error_message = errorMessages.AUTH_FAILED_WITH_MID;

throw new Error(error_message);

}

if (inputs.errorMessage)
handleError(inputs.errorMessage);
else {
var responseBody = JSON.parse(inputs.responseBody);
if (responseBody.status == "Success")
outputs.user_guid = responseBody.body.ObjectGUID;
else if (responseBody.status == "Error")
if (responseBody.body)
handleError(responseBody.body);
else
handleError("Unknown error. Please check error log for more information");
else
handleError("Unknown error. Please check error log for more information");
}
})(inputs, outputs);
ece495ac8705de1030670e16cebb350010-01-2024 08:09:39
Select record for action: Created 10-01-2024 08:09:39 Create User.ece495ac8705de1030670e16cebb...ErrorJavaScript evaluation error on:
(function execute(inputs, outputs) {

function handleError(error_message) {
var errMessage = error_message;
var actionErrors = {
CANT_FIND_OBJECT: "Cannot find an object with identity"
};
var commErrors = {
AUTH_FAILURE: "Authentication failure with the user",
SERVER_UNAVAILABLE: "The RPC server is unavailable",
UNREACHABLE_STATUS: "Failed to access target system. Please check credentials and firewall settings on the target system to ensure accessibility: Access is denied."
};
var errorMessages = {
INVALID_OBJECT_IDENTITY: "Invalid resource name",
CREDENTIALS_FAILED: "Invalid credentials for host",
ACCOUNT_LOCKED_OUT: "The referenced account is currently locked out and may not be logged on to",
INVALID_HOST: "Invalid hostname in connection or host not reachable from MID Server",
AUTH_FAILED_WITH_MID: "Host credentials incorrect. Authentication error in MID Server"
};

if (error_message.indexOf(commErrors.AUTH_FAILURE) != -1)
error_message = errorMessages.CREDENTIALS_FAILED;
else if (error_message.indexOf(actionErrors.CANT_FIND_OBJECT) != -1)
error_message = errorMessages.INVALID_OBJECT_IDENTITY;
else if (error_message.indexOf(commErrors.SERVER_UNAVAILABLE) != -1)
error_message = errorMessages.INVALID_HOST;
else if (error_message.indexOf(commErrors.UNREACHABLE_STATUS) != -1)
error_message = errorMessages.AUTH_FAILED_WITH_MID;

throw new Error(error_message);

}

if (inputs.errorMessage)
handleError(inputs.errorMessage);
else {
var responseBody = JSON.parse(inputs.responseBody);
if (responseBody.status == "Success")
outputs.user_guid = responseBody.body.ObjectGUID;
else if (responseBody.status == "Error")
if (responseBody.body)
handleError(responseBody.body);
else
handleError("Unknown error. Please check error log for more information");
else
handleError("Unknown error. Please check error log for more information");
}
})(inputs, outputs);
: org.mozilla.javascript.JavaScriptException: Error: Access is denied (Process Automation.1f4e808e87b0d210bd8d43b5cebb3587; line 30): org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1248)
org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1030)
org.mozilla.javascript.InterpretedFunction.lambda$call$0(InterpretedFunction.java:161)
com.glide.caller.gen.Process_Automation_1f4e808e87b0d210bd8d43b5cebb3587.call(Unknown Source)
com.glide.script.ScriptCaller.call(ScriptCaller.java:22)
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:160)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:3058)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2981)
org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1720)
org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1030)
org.mozilla.javascript.InterpretedFunction.lambda$call$0(InterpretedFunction.java:161)
com.glide.caller.gen.Process_Automation_1f4e808e87b0d210bd8d43b5cebb3587.call(Unknown Source)
com.glide.script.ScriptCaller.call(ScriptCaller.java:22)
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:160)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:3058)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:2981)
org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1720)
org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1030)
org.mozilla.javascript.InterpretedFunction.lambda$call$0(InterpretedFunction.java:161)
com.glide.caller.gen.Process_Automation_1f4e808e87b0d210bd8d43b5cebb3587.call(Unknown Source)
com.glide.script.ScriptCaller.call(ScriptCaller.java:22)
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:160)
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:725)
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:4024)
org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:173)
com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:412)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:223)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:141)
com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:364)
com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:251)
com.glide.script.fencing.GlideScopedEvaluator.evaluateScript(GlideScopedEvaluator.java:230)
com.snc.process_flow.operation.GlidePFScriptEvaluator.runScript(GlidePFScriptEvaluator.java:49)
com.snc.process_flow.operation.script.ScriptOperationBase.runScript(ScriptOperationBase.java:50)
com.snc.process_flow.operation.script.ScriptOperation.run(ScriptOperation.java:75)
com.snc.process_flow.engine.Operation.execute(Operation.java:208)
com.snc.process_flow.engine.restricted_caller_access.ExecuteWithCallerAccessTracking.executeWithMetaStack(ExecuteWithCallerAccessTracking.java:21)
com.snc.process_flow.engine.ProcessEngine.executeOps(ProcessEngine.java:647)
com.snc.process_flow.engine.ProcessEngine.runInternal(ProcessEngine.java:544)
com.snc.process_flow.engine.ProcessEngine.resume(ProcessEngine.java:525)
com.snc.process_flow.engine.ProcessEngine.resumeWithExecutionResult(ProcessEngine.java:530)
com.snc.process_flow.engine.ProcessAutomation.runWithExecutionResult(ProcessAutomation.java:111)
com.snc.process_flow.engine.ProcessAutomation.run(ProcessAutomation.java:74)
com.snc.process_flow.engine.GlideProcessAutomation.runSync(GlideProcessAutomation.java:216)
com.snc.process_flow.engine.GlideProcessAutomation.runWithDomain(GlideProcessAutomation.java:376)
com.snc.process_flow.engine.GlideProcessAutomation.lambda$runAsUserSync$1(GlideProcessAutomation.java:341)
com.snc.process_flow.engine.PFSessionClone.run(PFSessionClone.java:71)
com.snc.process_flow.engine.GlidePFSession.runPlanAsUserSession(GlidePFSession.java:42)
com.snc.process_flow.engine.GlideProcessAutomation.runAsUserSync(GlideProcessAutomation.java:339)
com.snc.process_flow.engine.GlideProcessAutomation.messageFlow(GlideProcessAutomation.java:427)
com.snc.process_flow.engine.GlideProcessAutomation.messageFlow(GlideProcessAutomation.java:406)
com.snc.process_flow.engine.ProcessHubEventHandler.doSendMessage(ProcessHubEventHandler.java:538)
com.snc.process_flow.engine.ProcessHubEventHandler.process(ProcessHubEventHandler.java:156)
com.snc.process_flow.engine.ProcessHubEventHandler.process(ProcessHubEventHandler.java:119)
com.snc.process_flow.engine.FlowEventManager.processEvents(FlowEventManager.java:170)
com.glide.job.EventHandlerJob.execute(EventHandlerJob.java:50)
com.glide.schedule.JobExecutor.lambda$executeJob$1(JobExecutor.java:194)
com.glide.schedule.JobExecutor.executeJob(JobExecutor.java:197)
com.glide.schedule.JobExecutor.execute(JobExecutor.java:177)
com.glide.schedule.JobExecutor.execute(JobExecutor.java:167)
com.glide.schedule_v2.SchedulerWorkerThread.executeJob(SchedulerWorkerThread.java:577)
com.glide.schedule_v2.SchedulerWorkerThread.lambda$process$2(SchedulerWorkerThread.java:396)
com.glide.worker.TransactionalWorkerThread.executeInTransaction(TransactionalWorkerThread.java:35)
com.glide.schedule_v2.SchedulerWorkerThread.process(SchedulerWorkerThread.java:396)
com.glide.schedule_v2.SchedulerWorkerThread.run(SchedulerWorkerThread.java:172)
ece495ac8705de1030670e16cebb350010-01-2024 08:09:39
Select record for action: Created 10-01-2024 08:09:39 Create User.ece495ac8705de1030670e16cebb...ErrorOperation(Create User.ece495ac8705de1030670e16cebb3500) failed with error: com.snc.process_flow.exception.OpException: Error: Access is denied (Process Automation.1f4e808e87b0d210bd8d43b5cebb3587; line 30)
at com.snc.process_flow.operation.script.ScriptOperationBase.handleScriptResult(ScriptOperationBase.java:64)
at com.snc.process_flow.operation.script.ScriptOperationBase.runScript(ScriptOperationBase.java:52)
at com.snc.process_flow.operation.script.ScriptOperation.run(ScriptOperation.java:75)
at com.snc.process_flow.engine.Operation.execute(Operation.java:208)
at com.snc.process_flow.engine.restricted_caller_access.ExecuteWithCallerAccessTracking.executeWithMetaStack(ExecuteWithCallerAccessTracking.java:21)
at com.snc.process_flow.engine.ProcessEngine.executeOps(ProcessEngine.java:647)
at com.snc.process_flow.engine.ProcessEngine.runInternal(ProcessEngine.java:544)
at com.snc.process_flow.engine.ProcessEngine.resume(ProcessEngine.java:525)
at com.snc.process_flow.engine.ProcessEngine.resumeWithExecutionResult(ProcessEngine.java:530)
at com.snc.process_flow.engine.ProcessAutomation.runWithExecutionResult(ProcessAutomation.java:111)
at com.snc.process_flow.engine.ProcessAutomation.run(ProcessAutomation.java:74)
at com.snc.process_flow.engine.GlideProcessAutomation.runSync(GlideProcessAutomation.java:216)
at com.snc.process_flow.engine.GlideProcessAutomation.runWithDomain(GlideProcessAutomation.java:376)
at com.snc.process_flow.engine.GlideProcessAutomation.lambda$runAsUserSync$1(GlideProcessAutomation.java:341)
at com.snc.process_flow.engine.PFSessionClone.run(PFSessionClone.java:71)
at com.snc.process_flow.engine.GlidePFSession.runPlanAsUserSession(GlidePFSession.java:42)
at com.snc.process_flow.engine.GlideProcessAutomation.runAsUserSync(GlideProcessAutomation.java:339)
at com.snc.process_flow.engine.GlideProcessAutomation.messageFlow(GlideProcessAutomation.java:427)
at com.snc.process_flow.engine.GlideProcessAutomation.messageFlow(GlideProcessAutomation.java:406)
at com.snc.process_flow.engine.ProcessHubEventHandler.doSendMessage(ProcessHubEventHandler.java:538)
at com.snc.process_flow.engine.ProcessHubEventHandler.process(ProcessHubEventHandler.java:156)
at com.snc.process_flow.engine.ProcessHubEventHandler.process(ProcessHubEventHandler.java:119)
at com.snc.process_flow.engine.FlowEventManager.processEvents(FlowEventManager.java:170)
at com.glide.job.EventHandlerJob.execute(EventHandlerJob.java:50)
at com.glide.schedule.JobExecutor.lambda$executeJob$1(JobExecutor.java:194)
at com.glide.schedule.JobExecutor.executeJob(JobExecutor.java:197)
at com.glide.schedule.JobExecutor.execute(JobExecutor.java:177)
at com.glide.schedule.JobExecutor.execute(JobExecutor.java:167)
at com.glide.schedule_v2.SchedulerWorkerThread.executeJob(SchedulerWorkerThread.java:577)
at com.glide.schedule_v2.SchedulerWorkerThread.lambda$process$2(SchedulerWorkerThread.java:396)
at com.glide.worker.TransactionalWorkerThread.executeInTransaction(TransactionalWorkerThread.java:35)
at com.glide.schedule_v2.SchedulerWorkerThread.process(SchedulerWorkerThread.java:396)
at com.glide.schedule_v2.SchedulerWorkerThread.run(SchedulerWorkerThread.java:172)
4 REPLIES 4

Rajesh Chopade1
Mega Sage

hi @C_S3 

 

Error seems to be related to authentication or connectivity issues. You should have following checks:

 

Ensure that the MID Server is correctly configured and running. It should have access to the Active Directory server.

 

Ensure that the credentials you are using for the AD connection are correct. Check for typos in the username or password.

 

Confirm that there are no firewall rules blocking access to the AD server from the MID Server. Test network connectivity between the MID Server and the AD server.

 

Check the ServiceNow logs (System Logs > All) for any additional error messages or details that might help identify the issue.

 

Ensure the ServiceNow user has the necessary roles and permissions to invoke the actions related to AD user creation.

Hello @Rajesh Chopade1 ,
We have tried 'Look up user' action and it's working fine.

Andr_ Pires
Tera Contributor

Have you got any solution? facing the same issue

Have you got any solution? facing the same issue