I want to update data category selection from knowledge article's custom field.
I have written a process builder and calling apex from there. but it is not updating data category selection But in debug logs i can see insertion is done. Below is the apex class:
@InvocableMethod
public static void updatekMA1rticleType(List<Id> knowledgeid)
{
List<Knowledge__DataCategorySelection> kADCSLst = new List<Knowledge__DataCategorySelection>();
List<Knowledge__kav> kArticle = [SELECT ID FROM Knowledge__kav WHERE Id IN: knowledgeid];
for(Knowledge__kav kak: kArticle)
{
Knowledge__DataCategorySelection kADCS = new Knowledge__DataCategorySelection();
kADCS.ParentId = kak.Id;
kADCS.DataCategoryGroupName = 'Geography';
kADCS.DataCategoryName = 'India';
kADCSLst.add(kADCS);
}
if(kADCSLst.size()>0)
{
insert(kADCSLst);
system.debug('res**'+kADCSLst);
}
}
Can anyone help me?