• StephenDavidson
  • NEWBIE
  • 25 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 25
    Replies

I have seen the following in the documentation and would like to know if I should simply skip using the streaming api for my application?  I need to subscribe for events for new and changing cases.  I will then use that information to notify engineers/managers/executives that a case has changed.  But I can't afford to miss an event.  How do I use this API and ensure that I don't miss any events?  Possible?

 

The client may not receive messages for a variety of reasons, including:

When a client first subscribes or reconnects, it doesnt receive messages that were processed while it wasnt subscribed to

the channel.

If a client disconnects and starts a new handshake, it may be working with a different application server, so it receives only

new messages from that point on.

Some events may be dropped if the system is being heavily used.

If an application server is stopped, all the messages being processed but not yet sent are lost. Any clients connected to that

application server are disconnected. To receive notifications, the client must reconnect and subscribe to the topic channel.

I have this class:

 

public class MyBestPractices {
 
   public MyBestPractices() {
// Best_Practices__kav
        List<Id> articleIDs = new List<Id>();
        List<String> articleNumbers = new List<String>();  
        system.debug('will this show?');    
        for (Best_Practices__kav a : [SELECT Id, ArticleNumber, KnowledgeArticleId FROM Best_Practices__kav WHERE PublishStatus = 'Online' and language = 'en_US' and IsVisibleINPkb = false limit 100 ]) {
            String Id = KbManagement.PublishingService.editOnlineArticle(a.KnowledgeArticleId, true);
            if (Id == null) System.debug('##### ERROR EDITING');
               articleNumbers.add(a.ArticleNumber);
        }
        List<Best_Practices__kav> articles = new List<Best_Practices__kav>();
        system.debug('will this show2?');
        for (Best_Practices__kav d : [SELECT Id, KnowledgeArticleId FROM Best_Practices__kav WHERE PublishStatus = 'Draft' AND Language = 'en_US' AND ArticleNumber IN :articleNumbers limit 100]) {
            d.IsVisibleInPkb = true;
            articleIDs.add(d.KnowledgeArticleId);
            articles.add(d);
        }
        update articles;
    }
}

 

And am trying to test it by running this test class:

 

@isTest (SeeAllData = true)
private class MyBestPractices_Test {

    static testMethod void myUnitTest()

    MyBestPractices mb = new MyBestPractices();

    }
}

 

Code coverage indicates the test is not dropping into the for loop.

 

 

First, I would like to know why it is not dropping into the for loop.  Anyone?

Then I will hold still while you all whip the crap out of me for this non-best-practice way of doing things.....:-)

 

 

Hi all:

We have partners who go on site to customer site and have the need to open salesforce cases as a contact for that customer.  I am wondering about how to do this -- I have considered temporarily reassigning their existing contact to the customer that they will be consulting for -- I have considered creating a new contact in the customer's account..Just not sure of the best way to do this.  Once the engagement is finished, I will want to either remove them from a contact for the customer, or again, reassign them to their original account.

 

Any comments or suggestions?

Hmm.  If I use simple editor when creating article at case close, I don't see the 'save and create article' button.

So, I use the standard editor, and I can see the button, but I can no longer assign to someone by default!

 

Arghhh..

 

:-)

 

Any hint, Francois?

I am using the article customization class AgentContributionArticleController to pull subject and description and the latest case comment into the title and summary and a custom rich text field in articles.  This customization is invoked upon case close.

 

        Case c = [select subject, description,casenumber from Case where id=:sourceId];
        CaseComment cc = [select LastModifiedDate, LastModifiedBy.Id, LastModifiedBy.Name, IsPublished, CreatedDate, CreatedBy.Id, CreatedBy.Name, CommentBody From CaseComment where ParentId = :sourceId order by LastModifiedDate desc limit 1];
        if (article instanceof case_summary__kav){
     
            article.put('title',c.subject);
            article.put('summary',c.description);
            article.put('resolution__c',cc.CommentBody);
            article.put('Originating_Case__c', +c.casenumber); 
            article.put('Originating_Case_URL__c',+'http://cs4.salesforce.com/' +sourceId);  
          
        }

The problem is, when I have text in my latest case comment, like this:

 

this

is

my

formatted

text

 

It translates into the custom rick text field in my article as this:

 

this is my formatted text.

 

Salesforce says this is by design.  Looks like a bug, smells like a bug.......

 

Anyone know of a workaround?

 

Thanks.

I have created a 'before insert' trigger for the case object.  I have turned on the 'enable suggested articles'.  I have modified the subject so that the stop words are removed, words with _ are double quoted, and all remaining terms are and'ed.  THe result for the article search is quite nice.  Rather than getting hundreds of irrelevant results, I get a set of results that are related to the subject entered by the customer.   So for example, when I create a case with this subject: 

 

I get a Probe distribution fails error: inst_execute failed: permission denied

 

and based on the work I do in the trigger, here is what appears in the search textbox:

 

Probe and distribution and fails and error: and "inst_execute"" and failed: and permission and denied

 

ANd I get only the article result set that I expect to see for these keywords.

 

The problem is, I can't leave the subject like that.  I have tried some other triggers to revert the subject to the original value, but no luck.  What I would really like is the ability to choose the field that would be used for the search so rather than using the search field for my manipulations, I would use an independent field and then use that field (through some magic) for the search, leaving the original subject alone.

 

Anyone have any ideas on how to accomplish this?

 

 

 

Is it possible to modify the existing pages/tabs -- source code -- of the knowledge application?  I believe the changes that I would like to make will require development work and I wonder if what I am wanting to do will be possible and how to go about getting started. 

 

For example, I would like to include a checkbox under categories to modify the filter to return documents for the specific category selected, rather than returning all parent and child documents, which is the default behaviour.  I would like for users doing searches to be able to select/de-select based on their needs.

 

Is this possible with a simple tweak to the existing application?  Or is knowledge not modifiable in this way?

 

 

I have seen the following in the documentation and would like to know if I should simply skip using the streaming api for my application?  I need to subscribe for events for new and changing cases.  I will then use that information to notify engineers/managers/executives that a case has changed.  But I can't afford to miss an event.  How do I use this API and ensure that I don't miss any events?  Possible?

 

The client may not receive messages for a variety of reasons, including:

When a client first subscribes or reconnects, it doesnt receive messages that were processed while it wasnt subscribed to

the channel.

If a client disconnects and starts a new handshake, it may be working with a different application server, so it receives only

new messages from that point on.

Some events may be dropped if the system is being heavily used.

If an application server is stopped, all the messages being processed but not yet sent are lost. Any clients connected to that

application server are disconnected. To receive notifications, the client must reconnect and subscribe to the topic channel.

I have this class:

 

public class MyBestPractices {
 
   public MyBestPractices() {
// Best_Practices__kav
        List<Id> articleIDs = new List<Id>();
        List<String> articleNumbers = new List<String>();  
        system.debug('will this show?');    
        for (Best_Practices__kav a : [SELECT Id, ArticleNumber, KnowledgeArticleId FROM Best_Practices__kav WHERE PublishStatus = 'Online' and language = 'en_US' and IsVisibleINPkb = false limit 100 ]) {
            String Id = KbManagement.PublishingService.editOnlineArticle(a.KnowledgeArticleId, true);
            if (Id == null) System.debug('##### ERROR EDITING');
               articleNumbers.add(a.ArticleNumber);
        }
        List<Best_Practices__kav> articles = new List<Best_Practices__kav>();
        system.debug('will this show2?');
        for (Best_Practices__kav d : [SELECT Id, KnowledgeArticleId FROM Best_Practices__kav WHERE PublishStatus = 'Draft' AND Language = 'en_US' AND ArticleNumber IN :articleNumbers limit 100]) {
            d.IsVisibleInPkb = true;
            articleIDs.add(d.KnowledgeArticleId);
            articles.add(d);
        }
        update articles;
    }
}

 

And am trying to test it by running this test class:

 

@isTest (SeeAllData = true)
private class MyBestPractices_Test {

    static testMethod void myUnitTest()

    MyBestPractices mb = new MyBestPractices();

    }
}

 

Code coverage indicates the test is not dropping into the for loop.

 

 

First, I would like to know why it is not dropping into the for loop.  Anyone?

Then I will hold still while you all whip the crap out of me for this non-best-practice way of doing things.....:-)

 

 

I am using the article customization class AgentContributionArticleController to pull subject and description and the latest case comment into the title and summary and a custom rich text field in articles.  This customization is invoked upon case close.

 

        Case c = [select subject, description,casenumber from Case where id=:sourceId];
        CaseComment cc = [select LastModifiedDate, LastModifiedBy.Id, LastModifiedBy.Name, IsPublished, CreatedDate, CreatedBy.Id, CreatedBy.Name, CommentBody From CaseComment where ParentId = :sourceId order by LastModifiedDate desc limit 1];
        if (article instanceof case_summary__kav){
     
            article.put('title',c.subject);
            article.put('summary',c.description);
            article.put('resolution__c',cc.CommentBody);
            article.put('Originating_Case__c', +c.casenumber); 
            article.put('Originating_Case_URL__c',+'http://cs4.salesforce.com/' +sourceId);  
          
        }

The problem is, when I have text in my latest case comment, like this:

 

this

is

my

formatted

text

 

It translates into the custom rick text field in my article as this:

 

this is my formatted text.

 

Salesforce says this is by design.  Looks like a bug, smells like a bug.......

 

Anyone know of a workaround?

 

Thanks.

I have created a 'before insert' trigger for the case object.  I have turned on the 'enable suggested articles'.  I have modified the subject so that the stop words are removed, words with _ are double quoted, and all remaining terms are and'ed.  THe result for the article search is quite nice.  Rather than getting hundreds of irrelevant results, I get a set of results that are related to the subject entered by the customer.   So for example, when I create a case with this subject: 

 

I get a Probe distribution fails error: inst_execute failed: permission denied

 

and based on the work I do in the trigger, here is what appears in the search textbox:

 

Probe and distribution and fails and error: and "inst_execute"" and failed: and permission and denied

 

ANd I get only the article result set that I expect to see for these keywords.

 

The problem is, I can't leave the subject like that.  I have tried some other triggers to revert the subject to the original value, but no luck.  What I would really like is the ability to choose the field that would be used for the search so rather than using the search field for my manipulations, I would use an independent field and then use that field (through some magic) for the search, leaving the original subject alone.

 

Anyone have any ideas on how to accomplish this?

 

 

 

All,

 

Because of a problem in a migration of knowledge base articles from a 3rd party system, we need to update a few thousands articles. Unfortunately, Salesforce doesn't allow to programmatically update the article objects, whether through the API or Apex.

 

The solutions seems to be either update manually the solutions (which is hardly feasible considering the number) or wipe all the solutions and start the migration again (except we've already started using some articles).

 

An alternative I'm investigating is to write a program that would generate a huge Windows PowerShell script that would create an Internet Explorer instance and control it to log in and programmatically modify each article, one at a time. But before going that route I was wondering if people have other suggestions.

 

Thanks,

Laurent

 

Hello,

In my project we are using suggested articles (as a part of Service Cloud Console).

The question is : 

- Can the search for suggested articles by configured in any way ? For example, my client does not like, that he has to write full words in order for that to work (eg. when you type 'Salesfor' it will not find any Salesforce articles, but 'Salesforce' and 'Salesfor*' will find it). My client would like it to work as if the asterisk (*) was always there at the end of the subject

- Can we in any way customize what fields from the case should be used for search? As far as I notice currently only the Subject field is used.

- And the least important : can we customize the in any way the Suggested Articles columns? We would like to not have the 'New' column.

 

Knowledge looks promising for my client, but these are the limitations for now. I could probably somehow hack into the mechanism - in the HTTP requests i see what is going on and could probably mimic this behaviour with custom buttons and programming, but my client does not really want that.

 

Best regards

  • September 16, 2011
  • Like
  • 0

Hello guys,

Can anyone tell me what kind of files can be indexed when added to an article ?

I mean I added a field of type 'File'.

I upload an attachment to article. What kind of files will be indexed to allow full text search ?

I know that *.doc will work, but what else ?

 

Best regards,

Lukasz

  • September 13, 2011
  • Like
  • 0

I am performing sosl queries to return knowledge articles similar to this.

 

find {test} IN ALL FIELDS RETURNING KnowledgeArticleVersion ( id,title, urlName where publishStatus='online' and language='en_US')

 

How can I find out what type of article each result is? 

 

I don't want to have the sosl return a seperate list for each article type as I would like to keep the articles ranked based on the search term as stronly as possible. I'm only interested in a max of 5 returned records and I have 5 article types.

 

I can't find a good solution to this. Two possible solutions

 

1) for each id returned, query each article type to see if a record is returned

SELECT count() FROM faq__kav where id = 'ka4S0000000CaTSIA0'

...

SELECT count() FROM documentation__kav where id = 'ka4S0000000CaTSIA0'

 

So if I'm returning 5 records in my sosl, I could have up to 25 soql queries if I have 5 article types.

 

2) query knowledgeArticleVersion and the individual article Types in sosl. Take the list of knowledgeArticleVersions and then iterate through the other lists to see which articleType list it belongs to.

 

find {test} IN ALL FIELDS RETURNING KnowledgeArticleVersion ( id,title, urlName where publishStatus='online' and language='en_US'), faq__kav (id), documentation__kav(id)...

 

Is there a better way that I'm missing?

 

Thanks,.

 

hi,

 

I am retriving article type of a particular article using getGlobalDescribe and keyPrefix.

But is there any other way to get article type ?

 

Thanks,

Monali

 

Is there an example on how to write a test class for this controller: Apex Customization for Submitting Articles from Cases

 

public class AgentContributionArticleController {
    // The constructor must take a ApexPages.KnowledgeArticleVersionStandardController as an argument
    public AgentContributionArticleController(ApexPages.KnowledgeArticleVersionStandardController ctl) {
        SObject article = ctl.getRecord();   //this is the SObject for the new article. 
                                             //It can optionally be cast to the proper article type, e.g. FAQ__kav article = (FAQ__kav) ctl.getRecord();
        
        String sourceId = ctl.getSourceId(); //this returns the id of the case that was closed.
        Case c = [select subject, description from Case where id=:sourceId];
        
        article.put('title', 'From Case: '+c.subject);  //this overrides the default behavior of pre-filling the title of the article with the subject of the closed case. 
        article.put('Details__c',c.description);  
        
        ctl.selectDataCategory('Geography','USA');  //Only one category per category group can be specified.
        ctl.selectDataCategory('Topics','Maintenance');                        
    }

 

https://login.salesforce.com/help/doc/en/knowledge_caseclose_apex.htm

 

Thanks.

I have installed Force.com IDE Spring '10 on Eclipse 3.5.2. I have created new Force.com project and pulled all components from salesforce.com. But on "Execute Anonymous" tab, I am not able to select the active project from the drop down. It's disabled. I cannot type into the "Source to Execute" text box either.

 

Is anybody having this issue?

 

Thanks,

Venkat