How to update the latest KB article display number in customized reference field

thaduri sai
Tera Contributor

Hi Team,

 

We have created a reference field (BIA Knowledge Article) in business application cmdb form.It will shows the KB article display number in the field.

thadurisai_0-1694936094773.png

 

So, If KB article expire after 1 year - Then users are updating the KB article through portal.

But Here Its not taking the new updated version number. Its still showing the old version number

thadurisai_1-1694936123562.png

 

Its showing the updated display number in the search box - But its not taking the new value in the field. Still we are updating this process manually - Kindly please assist.

thadurisai_2-1694936146361.png

 

We have return After BR - But its not working as expected.

thadurisai_3-1694936252249.png

 

thadurisai_4-1694936268767.png

 

Thanks,

Sai

1 ACCEPTED SOLUTION

Hi @babbi / @thaduri sai 

Try the following code and check the system log, if you didn't find any of the log statement, it means the BR didn't ran, if it is running observer which log statement is not logged.

 

(function executeRule(current, previous){
   var BIA = new GlideRecord("cmdb_ci_business_app");
   BIA.addQuery('sys_id', current.cmdb_ci);
   BIA.query();
   gs.info('Before BIA IF Condition');
   if(BIA.next()){
      gs.info('Found BIA');
      BIA.setValue('u_bia_knowledge_article', current.getUniqueValue());
      vat update_res = BIA.update();
      if(update_res){
         gs.info('Updated BIA KB Successfully');
      } else{
         gs.info('Updated BIA KB Failed');
      }
   }
})

 

Thanks,
Anvesh

View solution in original post

8 REPLIES 8

@thaduri sai That Great 😀 I'm glad it helped!

Thanks,
Anvesh

Hi @AnveshKumar M ,

 

Hope you are doing fine.

 

Here below we have return After BR :-

thadurisai_0-1698666524942.png

When knowledge article updates - The automacally the new display version number is taking in BIA  Knowledge field. working as expected.

thadurisai_1-1698666779250.png

But when we are re-loading the page of business application. The Last BIA Approval (date) field is not taking as expected.

thadurisai_2-1698666931726.png

Could you please help on this @AnveshKumar M ,

 

Thanks for the advance.

 

Thanks,

Sai

 

Hi @thaduri sai 

I didn't get what you mean by reloading the page, is it just the browser refresh?

Thanks,
Anvesh

@thaduri sai 

Try changing the line 12 as below,

 

BIA.setValue("u_last_bia_approval", current.getValue("published"));

 

Thanks,
Anvesh