This is nice good work. This code can do that. Looking at that error would I need to define confirm in the client script? Regarding the if action = resolved code block, what is the best way to address having a pop up box to confirm that you want to resolve the incident? This is obviously the best and simplest method since it falls in line with the design of the product and doesnt really require any unusual override of other system behavior. You would need to change that to loop through all of the targeted elements to remove the icons. }. Should we be moving entries out of this table as requested items are closed? On Application [Global], this worked fine in Istanbul P3a. Its just been published here. however, current.variable_pool.location is giving me undefined. Yep. }); $$(.icon-label)[0].hide(); // tag button What must be modified specific to my instance to get this to populate correctly? I have added this to the script. adsbygoogle.requestNonPersonalizedAds = 1; This article shows a couple of client script functions that allow you to remove (show/hide) any button (or all but one button)and, if necessary, disable the form header right-click context menu entirely. Thats whats causing the setReadonly command to fail. Refresh the Catalog Item Form on your Service Portal and see if the button widget is displayed. You can also make catalog variables read only all of the time for specific roles by using the Write roles field on a catalog item form. //Remove any reference or calendar icons In the Server Script if(data.table == incident && gr.state == 6){ data.showButton = true; } else { data.showButton = false; } Seems to be working well. If the reference icon is displayed, the end user can click on it and drill into the records which may be confusing. This example shows one way you could use the button ID value (as defined in the UI action Action name field). For that case, you could use a script like this one to lock down all of the variables on a form. ServiceNow ships with a Button widget out of the box named link-widget, so we will use that. I used this solution to hide the form context menu, the back button and the reference icon on the Request for field on the Requested Item form for our ESS implementation using the following code based on your examples: This worked fine in Calgary, but when we upgraded to Eureka, it quit working. Keep it up. I just updated the article with the updated script. $$(.pointerhand)[0].hide(); // Current View and record number Still no luck. How to add a button asmodify Approver?(should refer to User table) in the catalog item form . Service-now allows you to add roles to any variable in the system for this purpose. The button colors is getting the color from the btn-primary Bootstrap class which gets compiled based on the CSS variables you have defined. Thanks! I had put this into our environment and it was working great, but we have a form with checkboxes and list collectors and its showing them as editable, not read only. Worked with one of our internal web developers and he shortened the section int he server script, lines 16 to 32: if (input && input.action) { var action = input.action; // If Incident table if (data.table == incident) { if (action == resolve) { // Resolve Incident gr.setValue(incident_state, 6); gr.setValue(state, 6); gr.setValue(resolved_by, gs.getUserID()); gr.update(); } if (action == cancel) { // Do something else } } }, switch (input && input.action) { case resolve: gr.setValue(incident_state, 6); gr.update(); break; // case cancel: //do something else keep adding case sections for more buttons }. All rights reserved. Unfortunately the Related Links heading is still present, how would I remove that? function onLoad(){ Please give it a try and let me know how it goes. I have implemented the code in my MSP Instance for one of our customer.But no luck,The code is not working as expected.Even when I click on Resolve Button its not working nor its resolving the Incident. To do this, you just have to create a before business rule on the table you want to restrict the editing of variables. We . Correct. What if I have a form widget and a custom button widget on same page. }. This however doesnt remove teh lookup spyglass next to reference variables, or seem to mark them as read only, nor does setDisabled(). But what if you need to disable something like the Submit button on just a single view of a single form? With the getValue line its not working. Any thoughts? More often than not however, if you are disabling variables at all, you are disabling them entirely or disabling them for a certain group of users. $$(img[id=view.cmn_department])[0].hide(); // reference varialbe to cmn_department table. Step 3.1: Basic authentication. based on what user enters in location, stock room values are available. #8 How to add Catalog Item on Service Portal | How to modify OOB HomePage on Portal | #ServiceNowVideo Link for \"Overview of Service Portal \u0026 How to create new Service Portal\" :https://www.youtube.com/watch?v=BCHbhVideo Link for How to design Portal \u0026 Service Portal Configuration components :https://www.youtube.com/watch?v=ndGI6Video Link for \"How to create custom widget \u0026 pass server \u0026 client side data to html template\" : https://www.youtube.com/watch?v=pj68yVideo Link for \"How to create custom widget from starch with scenario based example in ServiceNow\": https://www.youtube.com/watch?v=3eS2TPlease Like, Share \u0026 Subscribe my channel if you find my video useful and do let me know your doubts or queries in comment section below.Instagram : servicenow_addaGmail : techie.adda123@gmail.comBlog : https://servicenowadda.blogspot.com/Welcome back to my channel !#service portal#servicenow Ive actually had a fix for this for quite some time. I have the same issue when reloading the form the button re-appears. Im not sure why and was wondering if you might have an idea? If form is the body of catalog item then workflow is the soul of catalog item. try{ then comments should passed to the approval form. They are really designed for edge cases where there is no other real solution available. Locking down variables via client scripting. For this demo however, we will leave it enabled. Give it a try and let me know how it goes. Can someone just add the final code for all? Since 2009, ServiceNow Guru has been THE go-to source of ServiceNow technical content and knowledge for all ServiceNow professionals. }. Static Choice nodes have both a Label and a Value.Depending on the context, a developer may want to use one or the other. I created a Reopen Incident button and was able to hide it if the inc state isnt resolved. Can anyone help me out here. }. Hi Mark, I have modified the code with elmnt.readOnly = true. In other words Servic ServiceNow Tutorial: How To Create ServiceNow CATALOG ITEM? //Disable all elements within with a class of cat_item_option Ive tested this with both my admin account and with an ess test user. I chose this method because it also works on multi-section forms where you may have multiple sets of the same buttons on a form. I want to make additional comments mandatory whenever user clicks resolve incident button, This does allow setMandatory, but its a great way to do small client side stuff. Ive noticed that a standard g_form.setReadonly(date, true) greys out the value box, yet doesnt remove the calendar icon, allowing for dates to be changed at any point even after a read only function has been applied. var items = $$(BUTTON).each(function(item){ This is just an example to get you started. Hello, You can set up an onLoad client script like this to accomplish it. Service-now actually provides a simple way to make a variable on a standard task form read only via client scripting. It would be a bit of a hack though. You can also easily add to the worknotes from the server script. When submitting a Service Request, the requester can add attachments using the icon located on the form header. Thanks again! data.table = input.table || $sp.getParameter(table); data.sys_id = input.sys_id || $sp.getParameter(sys_id); data.id = input.id || $sp.getParameter(id); // Valid GlideRecord var gr = new GlideRecord(data.table); if (!gr.isValid()) return; // Valid sys_id if (!gr.get(data.sys_id)) return; I also tried by getting the g_form broadcast from form widget to button widget and resend it back as the response. Copyright 2023 Kevin Custer. The solution is documented here. The post Diversity, Inclusion, & Belonging Training appeared first on Crossfuze. If you want to make a field mandatory though, you need to use the setMandatory client script on the standard form to do it. Hope this will show what I was trying to achieve, thanks for help buddy!! Field Name: Hardware Requirement, Field Type: Radio Button) Options are as mentioned below: Laptop Desktop Mouse Keyboard3. Step 4: Select properties and filter data. Workflow is created through graphical editor tool (Workflow editor), which is very easy and a comfortable tool to design the process. You did such an amazing job. Thanks!! I have my html set to show / hide certain buttons: