Modify 'Create Incident' button output

scwillson
Mega Guru

I am attempting to modify the "Create Incident' button from the Knowledge Article view.

My Goal

My knowledge article form is going to have a custom form section that dictates the categorization and template that a given INC record is pre-loaded with when clicking on the 'Create Incident' button.

For example: If there is KB article about troubleshooting Outlook mail configuration. The article's form would have fields that define the Incident categorization (CI = "Outlook), or reference a template.

Need Assistance with Jelly

I've been able to find where the 'Create Incident' button is defined; UI Macro: kb_view_common_header_toolbar. However, I am very unfamiliar with jelly. The button is defined on line 45, but I don't see how to add to or modify it's onClick (or equivalent) function. There are also two other UI Macros that look like they might have something to do with it; kb_view_common and kb_view_hidden_fields.

Any input or assistance would be much appreciated.

1 ACCEPTED SOLUTION

scwillson
Mega Guru

I've been able to achieve my goal by modifying a system property, thanks to some feedback from Brad Foolhey.



Before modifying the system property, you must first create custom fields on the KB record form. These fields are what will carry through to the Incident when the "Create Incident" button is clicked for that specific article. For my example, I've created a field on the KB record form called u_inc_ci.



Modify system property glide.knowman.create_incident_link



Basically, the value of this property is the URL that generates and populates the new INC record, so you can just add the field values that you want. use the following format: incident_field_value=$[HTML:knowledgeRecord.knowledge_field_value]



So when modified to include my "u_inc_ci" field to dictate the cmdb_ci field on the incident form, it would look like this:


incident.do?sys_id=-1&sysparm_query=active=true^cmdb_ci=$[HTML:knowledgeRecord.u_inc_ci]^comments=(Created after Knowledge search: $[HTML:knowledgeRecord.short_description])&sysparm_stack=knowledge_home_launcher.do

View solution in original post

23 REPLIES 23

Hi Simon,



I have a requirement where i need to create support request from knowledge article instead of Create incident.How can i do so?



Regards


Sheetal


In any case, there would be 2 parts to it. (1) Modify the functionality of the button and (2) modify the text on the button (or just create a new button).



Functionality


I am not sure what you mean by "support request". If it is just a custom table separate from Incident, it would be as simple as just updating the link in the system property "glide.knowman.create_incident_link" (referenced above, in earlier post) to point to your custom table instead of incident.do



However, if it is for Catalog Requests, that would be a little more involved depending on how you want it to behave with all the tables involved. An easier way you could tackle that one is to add a field to the knowledge form, referencing Catalog Items (lets call it my_item_ref). From there you could modify the same sys_property as above (glide.knowman.create_incident_link) to the catalog view of the specified item (identified in 'my_item_ref'). Something like:



com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=$[HTML:knowledgeRecord.my_item_ref]




Update Button Text


To add buttons or modify existing ones you'll have to get into some Jelly, and change the UI Macro: kb_view_common_header_toolbar



OOTB, I think it looks like this:


<button id="createIncident" title="${gs.getMessage('Create Incident')}" class="btn btn-default navbar-btn snc-article-header-toolbar-button">${gs.getMessage("Create Incident")}</button>



You would have to update the text in both places it has the gs.getMessage.


${gs.getMessage("ENTER CUSTOM TEXT HERE")}




- Simon Willson



-- please mark helpful it helps


Thanks Simon. I am able to create Supprt request.It's custom table



But when I am going to support request -> configure related list, I can't see "Related knowledge" in slushbucket to see which knowledge is related to this support request.


I have attached screenshot of 2 my environment.In one I can see and in other I cant see that option


I tried to activate plugins behind many many relationships but I didn't find it on environment to do.Found.jpgNotfound.jpg


first, I would make sure that your custom table extends the Task table.



If it comes down to it, you can always just create your own many to many list, then add script to the button to create a new relationship on the new m2m table.



To create a new many to many, navigate to the sys_m2m.list from the nav search and click New.


Hi Simon, just wanted to say thanks for this. I would have been looking for a long time to find that sys_property if it was't for your update! Have modified ours slightly to pull in other fields as well, so the overall concept works perfectly.



Thanks again,


-Adam