- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2024 11:02 AM
I am struggling with how I can set the State to "Review" value(0) in my UI Action.
I have a UI Action to "Return to Review" on the sn_grc_issue table
I have a UIPage with a modal to have the user enter Comments.
This is working - the comments are being added to the record, however, I am not able to set the current state value
If the current state is Closed Complete as an example - when they click the UI Action "Return to Review"
Comments should be added and the state should change to Review
Comments works but I am not able to get the state to change.
Attached are both my UIAction and UIPage XMLS.
Any help would be greatly appreciated!
Thank you.
Tricia
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2024 08:26 AM
Hi @triciav ,
you can directly set the state value from Ui Action,
Here is a code for that, but please check are you passing the correct value of state (which you are trying to set)
var dialog = new GlideModal("sn_risk_advanced_additional_comments", false, 500);
dialog.setTitle(new GwtMessage().getMessage("Risk Event Comments"));
dialog.setPreference("comments_text", g_form.getValue("comments"));
dialog.setPreference("table_name", g_form.getTableName());
dialog.setPreference("sys_id", g_form.getUniqueValue());
dialog.render();
// Set the state value to "Review"
var gr = new GlideRecord('sn_grc_issue');
if (gr.get(g_form.getUniqueValue())) { // Assuming g_form.getUniqueValue() returns the sys_id of the record
gr.state = '0'; // Assuming '0' represents the state value for "Review"
gr.update();
}
Please hit helpful if it solved your problem and accept this as a solution.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2024 02:03 PM
@triciav ,
Ensure your passing Correct state value in the UI action , Also can you please share the screenshots of your UI action instead of XML
Also keep some alert messages and check so this can help you if your logic is getting triggered or not
Regards,
Shyamkumar
Regards,
Shyamkumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2024 08:13 AM
Shyamkumar,
Here is a screenshot of my UI Action:
And my UI Page
I tried changing the code in UI Page as mentioned above, but it is still not working
Thank you so much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2024 08:26 AM
Hi @triciav ,
you can directly set the state value from Ui Action,
Here is a code for that, but please check are you passing the correct value of state (which you are trying to set)
var dialog = new GlideModal("sn_risk_advanced_additional_comments", false, 500);
dialog.setTitle(new GwtMessage().getMessage("Risk Event Comments"));
dialog.setPreference("comments_text", g_form.getValue("comments"));
dialog.setPreference("table_name", g_form.getTableName());
dialog.setPreference("sys_id", g_form.getUniqueValue());
dialog.render();
// Set the state value to "Review"
var gr = new GlideRecord('sn_grc_issue');
if (gr.get(g_form.getUniqueValue())) { // Assuming g_form.getUniqueValue() returns the sys_id of the record
gr.state = '0'; // Assuming '0' represents the state value for "Review"
gr.update();
}
Please hit helpful if it solved your problem and accept this as a solution.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2024 09:23 AM
I confirmed the state value I want to set is "0"
The comments are updating as expected, but no matter what I di in your recommendations, its not working.