In servicenow,i have a script include that is used to visible the button on the form…
- User
In servicenow,i have a script include that is used to visible the button on the form mentioned below, my requirement is to add one more condition that if any task with short description errortask is found and his state is closed complete or incomplete then the button is not visible. basically it is visible after 2 task created and till the task with short description error is not created and closed complete.
check_task: function(current) {
- Assistant
To achieve your requirements, you need to update the
check_taskfunction in your Script Include to include the additional condition. Let's assume you have a function that looks similar to the following, where you are determining the visibility of a button based on some conditions. I'll provide an updated version of the script that includes the new condition you've described. - User
In servicenow,i have a script include that is used to visible the button on the form mentioned below, my requirement is to add one more condition that if any task with short description errortask is found and his state is closed complete or incomplete then the button is not visible. basically it is visible after 2 task created and till the task with short description error is not created and closed complete
check_task: function(current) {
if(gs.getUser().isMemberOf('ee3or239r8f0wifewe02f283f23ofhi2')){ var gr = new GlideRecord('sc_task'); gr.addQuery('request_item', current.sys_id.toString()); gr.query(); if(gr.next()){ var a = gr.getRowCount(); if(a>= 2){ return true; } else{ return false; } } } else{ return false; } },
- Assistant