Here is the apex code to to achieve the same. Run in dev console then use in your test class or anywhere else you want:
Map<String, Schema.SobjectType> gd = Schema.getGlobalDescribe();
String soobjecttype;
for(String g : gd.keySet()){
if(g.contains('__kav')){
soobjecttype = g;
system.debug(g);
break;
}
}
if(soobjecttype != null){
Schema.SObjectType sobjType = gd.get(soobjecttype);
sobject objInstance = sobjType.newSObject();
objInstance.put('Summary', 'testing');
objInstance.put('Title', 'Arvind is awesome!');
objInstance.put('UrlName', 'GrazitbtiianfffArvindisawesome');
insert objInstance;
String recid=objInstance.Id;
List recs = Database.query('select id, knowledgeArticleId from '+soobjecttype + ' where id=:recid and PublishStatus='+'\'draft\''+' and Language='+'\'en_US\'');
KbManagement.PublishingService.publishArticle(String.valueOf(recs[0].get('KnowledgeArticleId')), true);
}
This is my first time pay a quick visit at here and i am in fact happy
to read all at alone place.
constantly i used to read smaller posts which also clear their motive, and that is also happening with this post
which I am reading here. games ps4 185413490784 games ps4
Good day! I know this is kinda off topic but
I was wondering which blog platform are you using
for this website? I’m getting fed up of WordPress because
I’ve had problems with hackers and I’m looking at options for another platform.
I would be great if you could point me in the direction of a good platform.
Great weblog here! Also your site lots up very fast!
What web host are you the usage of? Can I am getting your
affiliate link on your host? I wish my web site loaded up as quickly
as yours lol
It’s wonderful that you are getting thoughts from this paragraph as well as from our argument made
here.
Hi, cool video to watch for everyone https://bit.ly/2PoSCl9
Swallows And Amazons Southport Haryana Board 10th Result 2019 Kab Aayega
Feel free to surf to my website :: read online
The Colour Purple Book Para Teacher Latest News In Jharkhand
My web site: wordpress pdf
World Education Services Request Form Precipitation Reactions Gcse Chemistry
Look into my webpage; wordpress.com
Excellent post. I was checking constantly this blog and I am inspired!
Very helpful info specifically the final part 🙂 I handle such info a lot.
I was seeking this certain information for
a very lengthy time. Thank you and good luck.
0mniartist asmr