- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 03:41 PM
I am working on a UI action that when clicked, changes the state field to pending approval. I can see the field value update when I click the UI Action however it doesn't save the value.
This is what I have for the UI Action:
Name: Open Data Call
Action: open_data_call
Order: 100
Form Button:
Show Update: Checked
Client: Checked
Onclick: updateState()
Condition: current.state=='open_data_call'
Script:
function updateState() {
g_form.setValue('state', 'Pending Approval'); //Should 'Pending Approval' be the value?
gsftSubmit(null, g_formElement()), 'open_data_call';
}
Not sure why it isn't saving on the form. I can see the update in the state field.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 03:51 PM
Hey Shannon,
Is there any reason this has to be a client UI Action? Essentially this means that the changes you make are within the browser and not the server. So while the changes may happen as soon as you select the UI Action, this doesn't mean that the record value has actually had the value changed.
A screenshot would help but I would try the following:
- Uncheck "Client"
- Change Script to below:
function updateState() {
current.state = 'Pending Approval'); // This depends on the backend of value of the options for the 'state' field
current.update(); // This updates the current record
action.setRedirectURL(current); // Redirects the user to the current record after saving, Not necessary, but recommended
}
If you had a screenshot of the record itself that could help, but above might get you pointed in the right direction.
Thanks,
Charles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 03:51 PM
Hey Shannon,
Is there any reason this has to be a client UI Action? Essentially this means that the changes you make are within the browser and not the server. So while the changes may happen as soon as you select the UI Action, this doesn't mean that the record value has actually had the value changed.
A screenshot would help but I would try the following:
- Uncheck "Client"
- Change Script to below:
function updateState() {
current.state = 'Pending Approval'); // This depends on the backend of value of the options for the 'state' field
current.update(); // This updates the current record
action.setRedirectURL(current); // Redirects the user to the current record after saving, Not necessary, but recommended
}
If you had a screenshot of the record itself that could help, but above might get you pointed in the right direction.
Thanks,
Charles
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2023 10:58 AM
This was what I needed and it is now working as expected! Onward to more scripting! 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 04:11 PM
Hi,
Line
gsftSubmit(null, g_formElement()), 'open_data_call'; should be changed to
gsftSubmit(null, g_formElement(), 'open_data_call');
Also, please try adding the code below to your UI action.
if(typeof window == 'undefined')
saveState();
function saveState(){
current.setValue("state", "Pending Approval"); // Ensure this is the backend value
current.update();
action.setRedirectURL(current);
}
Thanks,
Arav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2023 04:57 PM
I am getting the same behavior with the script update. It isn't saving the update to the record. It does show the update in the state field right before it exits out but when I get to the list view the value is changed back to the previous state.