UI Action - UI Page re-open an Issue and Have comments Popup then set the State back to Review not

triciav
Kilo Sage

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

 

 

1 ACCEPTED SOLUTION

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.

View solution in original post

5 REPLIES 5

shyamkumar VK
Kilo Patron

@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

 

Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar

Shyamkumar,

 

Here is a screenshot of my UI Action:

triciav_0-1709482236985.png

 

And my UI Page

triciav_1-1709482389184.png

I tried changing the code in UI Page as mentioned above, but it is still not working

Thank you so much!

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.

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.