- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-06-2021 08:47 AM
Hi All,
I have a requirement mentioned below, could someone help me to achieve it.
Right now Category field and subcategory fields are not mandatory.
when we make category/subcategory fields mandatory by Client script/UI Policy even then the user is able to resolve incident bypassing mandatory fields. Now I was told that remove the mandatory tag from both the fields and create a BR which can perform below:
Requirement: If someone tries to update state field then
if(current.state.changesTo('Resolved/In progress/On hold') && current.category || current.subcategory =='')
then system should abort the action with a message that please category and subcategory filed.
This BR should also prevent updating state when user trying to update by sending email or via service portal. (This is main requirement)
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-06-2021 12:14 PM
gs.addInfoMessage('Your message');
current.state=previous.state;
current.setAbortAction(true);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-06-2021 12:19 PM
In UI Action try below
function resolveIncident(){
//Set the 'Incident state' and 'State' values to 'Resolved', and display mandatory fields
if(g_form.getValue('category')=='' || g_form.getValue('subcategory')==''){
alert('Fill Category or Subcategory');
return false;
}
g_form.setValue('incident_state', 6);
g_form.setValue('state', 6);
g_form.setValue('resolved_by', g_user.userID);
gsftSubmit(null, g_form.getFormElement(), 'resolve_incident'); //MUST call the 'Action name' set in this UI Action
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-06-2021 10:54 PM
Hi Upendra,
Thank you for you time and suggestion.
If we make changes in UI action then Incident can be resolved via service portal(We have an Resolve button on SP) and also via email State can be updated, so we are looking for BR.
Below script is also not working as I guess it is aborting the action, so the rest code is not run. Still I have to reload to get state from Resolve to In Progress.
gs.addErrorMessage("your message here");
current.setAbortAction(true);
var url = gs.generateURL(current.getTableName(), current.sys_id);
gs.setRedirect(url);
One more thing, where are we getting the below circled message, i do not see it in "Resolve" UI action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-06-2021 11:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-07-2021 01:35 AM
Hi Rohila,
I used that but it does not prevent when someone updating state via email or service portal and therefore we need BR.
We can use data policy but it will impact on other import as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-06-2021 11:51 AM
Try below
gs.addErrorMessage("your message here");
current.setAbortAction(true);
var url = gs.generateURL(current.getTableName(), current.sys_id);
gs.setRedirect(url);