
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2018 03:05 PM
I have the following use case:
On the change_task form, the close_notes will be mandatory OnSubmit -- IF -- the business_service field on the parent change_request STARTSWITH SAP(space).
I was going to do this as a UI Policy, but there is no way to make the field mandatory on change or on submit. I am really perplexed and have not seen any good examples of how to get to the parent change record and validate the contents of a field. I know this is simple but just can't seem to make it work.
Solved! Go to Solution.
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2018 06:32 AM
So in that case you can do something like this:
1. Create a Display business rule and capture the value of business service in g_scratchpad variable. Your BR would like this.
Display BR
Script:
(function executeRule(current, previous /*null when async*/) {
var ciName = current.parent.cmdb_ci.getDisplayValue(); //change cmb_ci to your Business service Name
g_scratchpad.ciName = ciName;
})(current, previous);
2. Use the scratchpad value in your OnSubmit Client Script:
function onSubmit() {
alert(g_scratchpad.ciName);
var str = g_scratchpad.ciName;
if(str.substring(0,4) == 'bond'){ //change bond to 'SAP '
alert('Cannot happen');
g_form.setMandatory('description',true); // replace description with your required field value
return false;
}
}
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-29-2018 07:38 PM
Glad that i was able to help. Cheers. Happy learning 🙂
Please mark my response as correct and helpful if it helped solved your question.
-Thanks