Auto-populate the assigned to field within the Hardware New record with a business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11 hours ago
Hi,
I am trying to auto-populate the 'Assigned to' field in the Hardware New record with the user from the 'Requested for' field in the Requested Item, after the RITM number is populated in a custom field called 'RITM Number' in the Hardware New record.
I tried to auto-populate the 'Assigned to' field with a business rule I created, but whenever I add an RITM number to my custom field in the Hardware New record, the 'Assigned to' field remains empty.
My steps:
1. Accessed the business rules under system definition.
Created a business rule new record:
1. Advanced = checked
When to run:
1. When = before.
2. Update = checked.
Advanced:
1. I created a custom script.
See Assigned to1 and Assigned to2.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
This Business Rule will never run because of the condition. Since u_ritm_number is a reference field is stores a sys_id, but it will never = literally 'number'. In the condition, I don't know what you're trying to do here, but I would think you would only want this to run on a hardware update when assigned_to is empty and the RITM number field changes
current.assigned_to.nil() && current.u_ritm_number.changes()
Or better yet, remove these and put them in the Filter Conditions for less chance of a coding mistake. In the script, you can do a GlideRecord if you really want to, but use 'sys_id' instead of 'number' in the addQuery. All you really need is this:
(function executeRule(current, previous /*null when async*/) {
current.assigned_to = u_ritm_number.requested_for;
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
In the condition, I was trying to trigger the business rule when the assigned_to field is empty, and the u_ritm_number field is populated.
I tried adjusting my condition to what you provided
current.assigned_to.nil() && current.u_ritm_number.changes()
and the script
(function executeRule(current, previous /*null when async*/) {
current.assigned_to = u_ritm_number.requested_for;
})(current, previous);
But after I save the script, create a Hardware New record and enter a RITM in the RITM Number field, the Assigned to field remains blank.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Sorry, that should be
(function executeRule(current, previous /*null when async*/) {
current.assigned_to = current.u_ritm_number.requested_for;
})(current, previous);
There probably would have been an entry in the System Logs showing u_ritm_number undefined. If this still doesn't work, remove the Condition to make sure the script runs, then add them back, preferably to the Filter Conditions on the When to run tab vs Condition.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Checking the sys logs, from 2025-12-17 15:39 to 2025-12-17 15:50 I am seeing errors about LDAP API.
LDAP API - LDAPLogger : Communication error: host-name:389: javax.naming.CommunicationException: host-name:389 [Root exception is java.net.UnknownHostException: host-name]: java.naming/com.sun.jndi.ldap.Connection.<init>(Connection.java:251)
java.naming/com.sun.jndi.ldap.LdapClient.<init>(LdapClient.java:137)
java.naming/com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1616)
java.naming/com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2848)
java.naming/com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:348)
java.naming/com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxFromUrl(LdapCtxFactory.java:229)
java.naming/com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:189)
java.naming/com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:247)
java.naming/com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:154)
java.naming/com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:84)
java.naming/javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:732)
java.naming/javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:305)
java.naming/javax.naming.InitialContext.init(InitialContext.java:236)
java.naming/javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:154)
com.glide.sys.ldap.LDAPConnectionTester.testConnection(LDAPConnectionTester.java:57)
com.glide.processors.ldap.LDAPTestConnectionProcessor.testServerURLConnections(LDAPTestConnectionProcessor.java:143)
com.glide.processors.ldap.LDAPTestConnectionProcessor.testServerURLConnections(LDAPTestConnectionProcessor.java:99)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.base/java.lang.reflect.Method.invoke(Method.java:569)
org.mozilla.javascript.MemberBox.invoke(MemberBox.java:232)
org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:294)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:3081)
org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1721)
org.mozilla.javascript.Interpreter.interpret(Interpreter.java:907)
org.mozilla.javascript.InterpretedFunction.lambda$call$0(InterpretedFunction.java:137)
com.glide.caller.gen._refname_.call(Unknown Source)
com.glide.script.ScriptCaller.call(ScriptCaller.java:22)
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:135)
org.mozilla.javascript.ScriptRuntime.doCall2(ScriptRuntime.java:3181)
org.mozilla.javascript.ScriptRuntime.doCall(ScriptRuntime.java:3088)
org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1721)
org.mozilla.javascript.Interpreter.interpret(Interpreter.java:907)
org.mozilla.javascript.InterpretedFunction.lambda$call$0(InterpretedFunction.java:137)
com.glide.caller.gen._refname_.call(Unknown Source)
com.glide.script.ScriptCaller.call(ScriptCaller.java:22)
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:135)
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:720)
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:4501)
org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:151)
com.glide.script.ScriptCompiler.executeAndPublishMetric(ScriptCompiler.java:78)
com.glide.script.ScriptEvaluator.execute(ScriptEvaluator.java:469)
com.glide.script.ScriptEvaluator.evaluate(ScriptEvaluator.java:236)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:382)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:160)
com.glide.script.ScriptEvaluator.evaluateString(ScriptEvaluator.java:151)
com.glide.script.Evaluator.evaluateString(Evaluator.java:105)
com.snc.automation.ScriptJob.executeInSingleDomain(ScriptJob.java:77)
com.snc.automation.ScriptJob.execute(ScriptJob.java:47)
com.glide.schedule.JobExecutor.lambda$executeJob$1(JobExecutor.java:197)
com.glide.schedule.JobExecutor.executeJob(JobExecutor.java:200)
com.glide.schedule.JobExecutor.execute(JobExecutor.java:180)
com.glide.schedule.JobExecutor.execute(JobExecutor.java:170)
com.glide.schedule_v2.SchedulerWorkerThread.executeJob(SchedulerWorkerThread.java:612)
com.glide.schedule_v2.SchedulerWorkerThread.lambda$process$3(SchedulerWorkerThread.java:404)
com.glide.worker.TransactionalWorkerThread.executeInTransaction(TransactionalWorkerThread.java:35)
com.glide.schedule_v2.SchedulerWorkerThread.process(SchedulerWorkerThread.java:404)
com.glide.schedule_v2.SchedulerWorkerThread.run(SchedulerWorkerThread.java:180)