Creatio mobile - empty fields are not overwritten on record save
Hi,
I'm working with Creatio mobile and Freedom UI. I've added a button that triggers an action to open a record for editing, passing some default parameter values to it. I do this by setting the value of a global object and then opening the edit view:
Data.PageParameters = {
CaseDS_EvField1_e051o13: '',
CaseDS_EvField2_i3021bq: '',
};
await HandlerChainService.instance.process({
type: "crt.OpenPageRequest",
$context,
schemaName,
modelInitConfigs: [
{
action: "edit",
recordId
}
]
} as BaseRequest);
On the page being opened, an init handler then runs, which looks like this:
@CrtRequestHandler({
type: 'usr.PageParametersInitHandler',
requestType: 'crt.HandleViewModelInitRequest',
})
export class PageParametersInitHandler extends BaseRequestHandler {
public async handle(request: BaseRequest): Promise {
const result = await this.next?.handle(request);
request.$context.CaseDS_EvField1_e051o13 = Data.PageParameters.CaseDS_EvField1_e051o13;
request.$context.CaseDS_EvField2_i3021bq = Data.PageParameters.CaseDS_EvField2_i3021bq;
return result;
}
}The goal was to display a popup in the mobile app in such a way that the user has to fill in these fields from scratch every time, without being influenced by previous values and without having to manually clear them.
Overall this works well, but there's one problem: when a field has an empty value, it isn't overwritten on the record at all during save (using the default crt.SaveRecordRequest action). It doesn't show up on the popup, but saving the popup doesn't clear the value on the record. This happens when:
- I don't modify the field at all
- I type something into it and then delete it shortly after
- I manually set the context attribute to an empty string or a space before save
I traced the HTTP request sent from the mobile app to the server and noticed that empty fields are simply omitted from the payload entirely. As a temporary workaround, I've been setting some placeholder string value and then clearing it later in a server-side event listener, but during save the value is briefly visible to the user and the placeholder disappears. It would be good to find a proper solution to this.
Like