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

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

HI All,



Thanks for this discussion. I have additional comments/Requirements on this topic.


In our organization we have made few fields mandatory on Incident [company, caller, location, categorization,contact type...etc.] . So Create Incident under knowledge article self service view is not working since for the end users only caller and short description will be visible. While submitting the Incident it shows as "Invalid Insert" as per our business rule configured.



So my question is where will I prepopulate all those mandatory fields so that end users will be able to submit teh INcident.



Please reply as soon as possible since its really important for us



Thanks


Ganapati


When you say "per our business rule configured"...does that mean you have a BR handling the mandatory fields?


Yes....we have a business rule which sets the fields as mandatory fields. So it will not allow user to submit the ticket without populating the mandatory fields as explained before. So How can I proceed with this?. I want to populate the mandatory fields once the ess user clicks on "Create Incident" button in Knowledge article


Well, I find it strange that you have the BR doing that, when it is really an OOTB feature to not allow a form to be submitted if there are empty mandatory fields. So it might be better to re-examine your utilization of that BR.



Aside from that, you could just add identical fields to the knowledge form (possibly new section to separate from the main form), replicating the fields you want to populate on the Incident. Just as I've outlined in this post as "correct answer".



However, if you need the auto population to be more dynamic, you could just create a hidden checkbox on the incident form ("ess_flag") that gets checked when the "Create Incident" button is used. Then have an onLoad client script checking for this value to be true, when it finds it to be true, script the population of the fields appropriately and clear the ess_flag box at the end of the script.



I may not be fully understanding your requirements. If this doesn't help yet, please provide an example and more detail.




If this helped, please mark it helpful