In a Business Rule Dot-Walking with getValue() or getDisplayValue() are not showing any Values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2020 03:23 AM
Hi Community,
I am trying to set the "Needed at" date on a Request Item via a Business Rule. I am using the following code:
(function executeRule(current, previous /*null when async*/ ) {
gs.log("This is the Request sys_id: " + current.getUniqueValue() + " This is the Requested For: " + current.u_requested_for.name.getDisplayValue() + " This is the effective start Date: " + current.u_requested_for.u_effective_start_date.getDisplayValue(), "LDOM");
var neededat = current.u_requested_for.u_effective_start_date.getDisplayValue();
gs.log("Needed at: " + neededat, "LDOM");
current.setValue('request.u_due_date', neededat);
})(current, previous);
Getting the Request ID in the Log Statement works fine but I can neither get the name of the Requested For nor the actual Effective Start Date on the "Requested For" user, which should be the value to fill the needed at date. At this point I should say that this RITM is created by an Onboarding Order Guide and the Business Rule itself is reacting to an Insert on the sc_req_item table where the condition just applies to the field "order_guide" being filled with our "Employee Onboarding" value of our Onboarding Order Guide.
I played around with getValue('current.u_requested_for.u_effective_start_date') and current.u_requested_for.u_effective_start_date.getDisplayValue() but either it's giving me a blank value or it's just giving me a "null" value in my log statements.
If I open the user there definitely is a value in the field.
Any thoughts on how to get my actual values? I know this might be a very simple solution but my brain is rather blocked at the moment.
Kind Regards
Lucas
- Labels:
-
Request Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2020 03:52 AM
Hi Lucas,
use getElement() and getElementValue().
The getElementValue() DOES allow you to specify a dot-walk string value.
Hope this help!!
If my response helps you then please mark answer helpful 👍and correct ✔.if any query 🤔 feel free to ask .
Regards,
Ajim.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2020 03:57 AM
and for your information getValue() or getDisplayValue() does not work on dot walking you always need to use getElement() or getElementValue() instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2020 01:00 AM
Hi Ajim,
I am just getting "null" values for my fields but they are filled. Following my new script in the Business Rule:
(function executeRule(current, previous /*null when async*/ ) {
gs.log("This is the Request sys_id: " + current.getUniqueValue() + " This is the Requested For: " + current.u_requested_for.name.getElementValue() + " This is the effective start Date: " + current.u_requested_for.u_effective_start_date.getElementValue(), "LDOM");
var neededat = current.u_requested_for.u_effective_start_date.getDisplayElementValue();
gs.log("Needed at: " + neededat, "LDOM");
current.setValue('request.u_due_date', neededat);
})(current, previous);
And here is the Log Statement I got: "This is the Request sys_id: c8d16b6edb2d1090500f5bd05b9619a5 This is the Requested For: null This is the effective start Date: null"
This is the XML with filled fields:
<xml>
<sys_user>
<active>false</active>
<agent_status/>
<avatar/>
<average_daily_fte/>
<building/>
<calendar_integration>1</calendar_integration>
<city/>
<company/>
<cost_center display_value="22334455">ac7f51eddb55d410500f5bd05b9619c7</cost_center>
<country/>
<date_format/>
<default_perspective/>
<department display_value="Department">6c7f51eddb55d410500f5bd05b9619c8</department>
<edu_status>faculty</edu_status>
<email/>
<employee_number/>
<enable_multifactor_authn>false</enable_multifactor_authn>
<failed_attempts/>
<first_name>Test</first_name>
<gender>Male</gender>
<geolocation_tracked>false</geolocation_tracked>
<home_phone/>
<internal_integration_user>false</internal_integration_user>
<introduction/>
<last_login/>
<last_login_device/>
<last_login_time/>
<last_name>User INC0091822</last_name>
<last_password/>
<last_position_update/>
<latitude/>
<ldap_server/>
<location/>
<locked_out>true</locked_out>
<longitude/>
<manager display_value="XXXXXX">a22495a1dbbfb200ab48ffc41d961943</manager>
<middle_name/>
<mobile_phone/>
<name>Test User INC0091822</name>
<notification>2</notification>
<on_schedule/>
<password_needs_reset>false</password_needs_reset>
<phone/>
<photo/>
<preferred_language/>
<roles/>
<schedule/>
<source/>
<sso_source/>
<state/>
<street/>
<sys_class_name>sys_user</sys_class_name>
<sys_created_by>lucas.domberg</sys_created_by>
<sys_created_on>2020-06-25 07:34:30</sys_created_on>
<sys_domain>global</sys_domain>
<sys_domain_path>/</sys_domain_path>
<sys_id>35a1676edb2d1090500f5bd05b96194c</sys_id>
<sys_mod_count>2</sys_mod_count>
<sys_updated_by>lucas.domberg</sys_updated_by>
<sys_updated_on>2020-06-25 07:34:30</sys_updated_on>
<time_format/>
<time_sheet_policy/>
<time_zone/>
<title>Testuser</title>
<u_comment/>
<u_contract_end_date/>
<u_effective_start_date>2020-07-01</u_effective_start_date>
<u_external_company/>
<u_flexi_time>false</u_flexi_time>
<u_is_supervisor>false</u_is_supervisor>
<u_job_level/>
<u_local_user>false</u_local_user>
<u_objectguid/>
<u_objectguidformat/>
<u_objectsid/>
<u_region>europe</u_region>
<u_second_account>false</u_second_account>
<u_sf_account_type/>
<u_sf_id>E9923</u_sf_id>
<u_sf_user_id>E9923</u_sf_user_id>
<u_sid_history/>
<u_termination_date/>
<u_umg_account_employee>true</u_umg_account_employee>
<u_umg_account_external>false</u_umg_account_external>
<u_umg_account_multiuser>false</u_umg_account_multiuser>
<u_umg_salesforce_user_b2c>false</u_umg_salesforce_user_b2c>
<u_umg_salesforce_user_standard>false</u_umg_salesforce_user_standard>
<u_umg_snow_externaluser>false</u_umg_snow_externaluser>
<u_user_principal_name/>
<user_name/>
<user_password/>
<vip>false</vip>
<web_service_access_only>false</web_service_access_only>
<zip/>
</sys_user>
</xml>
What Am I doing wrong? Do I have to change something on the Business Rule itself? It's an After Business Rule and has the order 10000 which should be okay.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2020 01:15 AM
What table business rule is on? Also, replace u_requested_for with requested_for