Link To Major Incident

PRATIKSHA PAWAR
Tera Expert

As we have Link to Major Incident OOB option available to merge major incidents and it is working fine for "list view"

PRATIKSHAPAWAR_0-1700128168389.png

Similarly I have activated Link to Major Incident option for Form View but it is not working as expected.

PRATIKSHAPAWAR_0-1700127747918.png

 

Can anyone help me for activating link to major incident option for Form view and that button should be working as well.

PRATIKSHAPAWAR_1-1700127922735.png

 

Thanks in advance!

1 ACCEPTED SOLUTION

Sorry, I neglected to point out that on the new UI Action record you need to also uncheck the 'List choice' box.  If you didn't give this record a different name there are 2 actions for the list choice and it's running the wrong one.

View solution in original post

6 REPLIES 6

Brad Bowman
Kilo Patron
Kilo Patron

It sounds like you checked the box for 'Form button' on the same UI Action.  It would be best if you undid that, then Insert and Stay on the UI Action record to create a duplicate.  On this new version, check the 'Form button', uncheck either or both of the 'List v2/v3 Compatible' options, and update the Comment to something more like:

Provides option to link current record to a Major Incident.

Replace the Script with this to link the currently-viewed incident as a child to the Major Incident that you select:

function showSelectMajorIncidentDialog() {
	var title = g_form.getValue('name');
	var incident = g_form.getUniqueValue();
	if (incident) {
		var o = new GlideModal('sn_major_inc_mgmt_select_major_incident_dialog_ui');
		ScriptLoader.getScripts('/scripts/incident/glide_modal_accessibility.js', function() {
			getMessage("Choose a Major Incident", function(msg) {
				o.setTitle(msg);
				o.setPreference('selected_incidents', incident);
				o.template = glideModalTemplate;
				o.on('bodyrendered', function(event) {
					glideModalKeyDownHandler(event, o.getID());
				});
				o.render();
			});
		});

		CustomEvent.observe("mi.addToExisting.associate", function(answer) {
			if (answer) {
				var ans = answer[0];
				var url = new GlideURL('incident.do');
				url.addParam('sys_id', ans.getAttribute('incidentId'));
				var incidentLink = "<a href=" + url.getURL() + ">" + ans.getAttribute('displayValue') + "</a>";
				GlideUI.get().addOutputMessage({
					msg: new GwtMessage().getMessage('Incident was added as child Incident to Major Incident {1}', title, incidentLink),
						type: "info"
					});
				}
				o.destroy();
			});

			CustomEvent.observe("mi.addToExisting.cancel", function() {
				o.destroy();
			});

			o.on('beforeclose', function() {
				CustomEvent.unAll("mi.addToExisting.cancel");
				CustomEvent.unAll("mi.addToExisting.associate");
			});
		}
	}

 

PRATIKSHA PAWAR
Tera Expert

This solution is useful for me, but I want list view and form view both to be work at same time. Now only form view is working and list view is not working.

 

Sorry, I neglected to point out that on the new UI Action record you need to also uncheck the 'List choice' box.  If you didn't give this record a different name there are 2 actions for the list choice and it's running the wrong one.

PRATIKSHA PAWAR
Tera Expert

Thanks It was working as expected but I am getting only 1 incident or blank dialogue box, Can you tell me how I can have all the incident list on form view not only major incidents list.

PRATIKSHAPAWAR_0-1700207708542.png