app user name shown in ui
This commit is contained in:
parent
b1003de515
commit
5ed1022a7b
@ -791,12 +791,20 @@ export function DynamicForm({ client, activityId: initialActivityId, instanceId:
|
|||||||
const isValEmpty = val === undefined || val === null || String(val).trim() === '';
|
const isValEmpty = val === undefined || val === null || String(val).trim() === '';
|
||||||
const currentFieldError = showErrors && f.mandatory && isValEmpty ? 'Required' : undefined;
|
const currentFieldError = showErrors && f.mandatory && isValEmpty ? 'Required' : undefined;
|
||||||
|
|
||||||
|
let displayVal = (val as string) ?? '';
|
||||||
|
if (schema.field_defaults?.[f.id]?.prefill?.value === 'current_user_id') {
|
||||||
|
const user = client.currentUser();
|
||||||
|
if (user && String(val) === String(user.id)) {
|
||||||
|
displayVal = user.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TextField
|
<TextField
|
||||||
label={f.name}
|
label={f.name}
|
||||||
required={f.mandatory}
|
required={f.mandatory}
|
||||||
type={type}
|
type={type}
|
||||||
value={(val as string) ?? ''}
|
value={displayVal}
|
||||||
onChange={(newVal) => handleFieldChange(f.id, newVal)}
|
onChange={(newVal) => handleFieldChange(f.id, newVal)}
|
||||||
error={currentFieldError}
|
error={currentFieldError}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user