How do I create a Business Rule that will automatically create a Knowledge article?

barbclark
Mega Expert

We have an existing business rule that will automatically create a Knowledge NEWS topic article based on Priority = High and Service Board being checked.       I am trying to create a new business rule or possibly modify the existing one that will merely change the topic.         My business rule is not working.     I need assistance.     This is my first business rule to try.           I do not see where I can attach my business rule here in this new HI format.    

1 ACCEPTED SOLUTION

edwajs
ServiceNow Employee
ServiceNow Employee

Hi Barbara,



Your business rule is not structured to call your code.



When a business rule is created in Fuji releases and newer, the system automatically brackets all of the code inside a function.



function onBefore(current, previous) {


    //This function will be automatically called when this rule is processed.


   


}



Per your attached screenshot, you have this function in your business rule as expected.   But then you appended all your code and your new functions after this one, and outside the structure.



Try the following:



function onBefore(current, previous) {


    //This function will be automatically called when this rule is processed.


    var sub = gs.getProperty('glide.knowman.submission.workflow');


   


    if (sub == 'true')


      submitCandidate();


    else


      submitDirect();


}



function submitDirect() {


    // your function


}



function submitCandidate() {


    // your function


}


View solution in original post

11 REPLIES 11

Uncle Rob
Kilo Patron

You can put screenshots in with this icon



attach.png


Uncle Rob
Kilo Patron

So first I want to know what the end goal is.   Are we changing how the current one works, or are we developing a new way for articles to be created that is different (but not replacing) the current?


We are creating a new ESS in which Severity 1 incidents (new Knowledge of SEV1) are automatically posted on the ESS (as part of a content block?) when an incident is HIGH and ServiceBoard.       This is replacing a current process that does the same thing , only before it was creating a topic of NEWS.


Incident - Sev1 Businesss Rule.jpgpic of ESS.jpg