State is not setting to previous value in before update BR?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 12:13 AM
Hi all,
When change task move to close state if there is no attachment change task abort the action and set state and closed code to previous value.
I have written Before update BR on change_task table:
condition state change to closed.
only the state is not set to previous value
can anyone helpme on this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 01:25 AM
Hi @Roshnee Dash ,
In the above client script how the previous will work
g_form.setValue('state', g_form.getValue('previous.state'));
g_form.setValue('close_code', g_form.getValue('previous.close_code'))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 01:37 AM
@Saranya K "previous" object cannot be used in client scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2025 01:54 AM
Yes @Saranya K
previous.state is only accessible server-side in a Business Rule.
Storing the previous values when the form loads allows the Client Script to reference them later.
When the user tries to submit, the script checks for attachments and reverts the state using the stored values instead of attempting to use previous.state.
- Therefore, you can return the required values from the server script in JSON format, including the error message, state value, and close code. Since the form has not yet been saved during this process, it will retrieve the previously stored value.
Stay awesome,
Roshnee Dash
