Help to populate field using business rule

Virendra Dwived
Tera Expert

Hi everyone,

I have to create a business rule to populate a custom field on work order table with knowledge articles .

find_real_file.png

5 REPLIES 5

palanikumar
Mega Sage

In business rule you can set value to a field using following options:

1) Actions tab - Select your field in Set field values and set the value
2) Advanced tab - You need to check advanced check box first. Set "when" as "before" in "when to run" tab and add code current.field_name='expected value'; in Advanced tab

Thank you,
Palani

Hi @palanikumar 

Can you please help me with below : I am stuck on step 2 .

Contextual Search Option

We need a field value on the form for the search to work. So the possible solution would be as follows

  1. Create a new field called “Additional Search Term” of type string on the table.
  2. Set up a business rule to populate the value for the new field as the same as the “Knowledge Base” display name. We do not have to display this field on the form.
  3. The on the table configuration, do not set up any filter (we do not want to compare the knowledge_base field on the article with any field on the table)
  4. On the search context, go to the Resource configuration tab then click on the record and click on the “Condition” from the Search context properties. On the condition field add the value as “kb_knowledge_base=<sysID of the knowledge base you want to display>”

image

  1. This would populate all the articles on the particular knowledge base on to the form

The below example shows all the knowledge articles from a particular knowledge base on a catalog task using the above set up.

image

 

Abhijit4
Mega Sage

Hi, 

Since you are stuck with your 2nd point then you can use below approach.

You can write before BR and use below script,

current.u_additional_search_term=current.kb_knowledge_base.getDisplayValue();

// change u_additional_search_term field name with your new field backend name and change 'kb_knowledge_base ' text with your kb_knowledge_base field backend name if needed.

Let me know if you have any further queries.

Please mark this as Correct or Helpful if it helps.

Thanks and Regards,
Abhijit
Community Rising Star 2022

 

 

 

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

Hi @Abhijit 

I have done as suggested by but still I cannot see articles on form .