Declarative Action opening a new record but field is readOnly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi Experts, our team has a Related List declarative action that opens a new record with some column values auto-populated. Not sure if this is the correct way to do this, but found some community posts showing this particular method:
function onClick() {
g_aw.openRecord('sn_hr_core_corrective_action_noa_cases', -1, {
"query": "u_helpdesk_case=" + g_form.getUniqueValue() + "^u_noa_code=" + g_form.getValue('u_noa_code') + "^u_effective_date=" + g_form.getValue('u_effective_date')
});
}
When logged in as an admin, the form appears as expected. The NOA Code and Effective Date columns are configured to be Read Only:
But when impersonating an end user, the entire form is Read Only:
There are no client scripts, UI policies, ACL's that are causing this. The only thing we can think of is this declarative action, but unsure why this would be happening. Any suggestions?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
What’s happening here is that g_aw.openRecord() with a query string doesn’t actually “pre-populate” the fields — instead, it loads the form in query mode with default values. When you’re admin, the read-only dictionary attributes are bypassed, so you still see the values filled. But for non-admin users, those fields are locked as per ACL/dictionary, so they stay read-only and the values don’t display until saved.
The right way to pre-populate fields in a new record from a Related List Declarative Action is:
Use the Default Values property in the Declarative Action instead of query string. That way the values are injected at record creation, not by query mode.
Or create an onClick client script/UI action that uses g_aw.createRecord() (not openRecord), which allows you to pass field:value pairs directly as defaults. Example:
function onClick() {
g_aw.createRecord('sn_hr_core_corrective_action_noa_cases', {
u_helpdesk_case: g_form.getUniqueValue(),
u_noa_code: g_form.getValue('u_noa_code'),
u_effective_date: g_form.getValue('u_effective_date')
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3m ago
thanks for the suggestion! I gave that a try but the button doesn't do anything and I can't find any documentation on createRecord. In my console I actually see a TypeError: g_aw.createRecord is not a function.