• Bhushan2710
  • NEWBIE
  • 5 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 10
    Replies
Hi,

I am doing a SOSL query to find the account records. My query is as below: 
string searchText;
string querySosl = 'FIND \'' +searchText+'*\' IN  ALL FIELDS RETURNING Account(Id,Name,BillingPostalCode,ShippingPostalcode,Website,AccountNumber)'; 
List<List<sObject>> searchList = search.query(querySosl);
System.debug('****searchList****** '+searchList);

The above query does not  returns me correct record as expected. 

So for example I have a Account Named : 512 Tech Limited
So when I search for  word 'Limited' nothing is returned to me.  But if  I search for '512'  the query returns the correct account. 
So is this a limitation of the SOSL query ?? or something else that is causing query to behave in this manner. 

We had a situation where one of the user erroneously changed the ownership of an case form portal user to himself. He tried to change the ownership back to the Portal user, but the Lookup on the Change Owner page didn’t find the Portal user.

can anyone tell why he can't find the portal user ?

Hello,

 

I am trying to insert a feedComment of contentcomment type on a feedpost in the follwing test method- 

when i run the test i get an error  saying "System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary.: []"

 

static testmethod void mytest(){
        Account Acc = new Account(Name = 'TestAccountBhushan',Phone = '040-754-7845');
        insert acc;  
        
        contentVersion cv = new contentVersion(
        pathonclient = 'My Document.docx',
        versionData = EncodingUtil.base64Decode('SampleImageFile')
        );
        insert cv;   
        //Inserting  post on chatter
        FeedItem textFeed = new FeedItem(
                Body = 'This is a text post',
                Type = 'TextPost',
                ParentId = acc.id               
        );          
        insert textFeed;
        
        FeedComment fc = new FeedComment(
            feedItemId = textFeed.Id,
            relatedRecordId = cv.id,
            commentBody = 'Test Comment Body'
            //commentType = 'ContentComment'
        );   
        insert fc;
        system.debug('****** Comment******'+ fc);

}

 

Thanks,

Bhushan

There is file that has been shared privately by a user with some set of users on chatter.

I can view that file from the UI, but when i look into contentVersion i don't see a record for this file.

Why being an administrator, its not vissible in contentVersion object?

There is file that has been shared privately by a user with some set of users on chatter.

I can view that file from the UI, but when i look into contentVersion i don't see a record for this file.

Why being an administrator, its not vissible in contentVersion object?

Hi,

 

I am working on a peice of code ,for following scenario -

When i upload a new version of a File on chatter, i want to get all  the  feedItems and comments where this new file version is reflected.

Form the ContentDocument i get the Id of the New file version(i.e ContentVersion Id),

Using this Id when i query on FeedItem and filter on RelatedRecordId i get an error saying

 

"RelatedRecordId From FeedItem Where RelatedRecordId = '068e00000008ax0AAA' ^ ERROR at Row:1:Column:56 field 'RelatedRecordId' can not be filtered in query call"

 

Here is my query - Select Id,ParentId,RelatedRecordId From FeedItem Where RelatedRecordId = '068e00000008ax0AAA'

 

So if i can't filter on RelatedRecordId, then is there an another way to get the feeditem record related to new version?

 

Thanks,

Bhushan

Hi ,

 

I have test method where i try to get the Feeditem of type trackedChange which is automatically created when we update a field value that is being tracked via feedTracking. But the test method is not able to get that feedItem record. Even tried with lowering the version, but no results. Can someone help?

Following is the testmethod: -

static testmethod void mytest(){
        Account acc = new Account(Name = 'TestAccountBhushan',Phone = '040-754-7845');
        insert acc;        
        acc.Phone = '040-123-4567';            
        update acc;      
        List<FeedItem > txtFeedItem = [SELECT Id,
               ParentId FROM FeedItem Where ParentId=: acc.Id];
               System.assertEquals(1, txtFeedItem.size());
        }

Hi ,

 

I have test method where i try to get the Feeditem of type trackedChange which is automatically created when we update a field value that is being tracked via feedTracking. But the test method is not able to get that feedItem record. Even tried with lowering the version, but no results. Can someone help?

Following is the testmethod: -

static testmethod void mytest(){
        Account acc = new Account(Name = 'TestAccountBhushan',Phone = '040-754-7845');
        insert acc;        
        acc.Phone = '040-123-4567';            
        update acc;      
        List<FeedItem > txtFeedItem = [SELECT Id,
               ParentId FROM FeedItem Where ParentId=: acc.Id];
               System.assertEquals(1, txtFeedItem.size());
        }

Where i can find suggested tags for a content while publishing in library. I checked the WSDL but was not able to locate the element where suggested tags are saved. Pls help me on this.

 

Thanks

Bhushan

Hi,

I am doing a SOSL query to find the account records. My query is as below: 
string searchText;
string querySosl = 'FIND \'' +searchText+'*\' IN  ALL FIELDS RETURNING Account(Id,Name,BillingPostalCode,ShippingPostalcode,Website,AccountNumber)'; 
List<List<sObject>> searchList = search.query(querySosl);
System.debug('****searchList****** '+searchList);

The above query does not  returns me correct record as expected. 

So for example I have a Account Named : 512 Tech Limited
So when I search for  word 'Limited' nothing is returned to me.  But if  I search for '512'  the query returns the correct account. 
So is this a limitation of the SOSL query ?? or something else that is causing query to behave in this manner. 

We had a situation where one of the user erroneously changed the ownership of an case form portal user to himself. He tried to change the ownership back to the Portal user, but the Lookup on the Change Owner page didn’t find the Portal user.

can anyone tell why he can't find the portal user ?

There is file that has been shared privately by a user with some set of users on chatter.

I can view that file from the UI, but when i look into contentVersion i don't see a record for this file.

Why being an administrator, its not vissible in contentVersion object?

Hi ,

 

I have test method where i try to get the Feeditem of type trackedChange which is automatically created when we update a field value that is being tracked via feedTracking. But the test method is not able to get that feedItem record. Even tried with lowering the version, but no results. Can someone help?

Following is the testmethod: -

static testmethod void mytest(){
        Account acc = new Account(Name = 'TestAccountBhushan',Phone = '040-754-7845');
        insert acc;        
        acc.Phone = '040-123-4567';            
        update acc;      
        List<FeedItem > txtFeedItem = [SELECT Id,
               ParentId FROM FeedItem Where ParentId=: acc.Id];
               System.assertEquals(1, txtFeedItem.size());
        }

I noticed this issue while writing an Apex test case for some chatter related functionality. For sake of this post, I am just posting the simplified test case. Here is the code

 

public static testmethod void testFeeds() {
  Test.startTest();
    // Create a Test Account
    Account acc = new Account(Name = 'Demo Account');
    insert acc;
    
    // Create FeedItem using this Account as a Parent Record
    FeedItem fp = new FeedItem();
    fp.Body = 'Testing via Apex';
    fp.parentId = acc.id;
    insert fp;
    
    // Query AccountFeed back to verify if the post was created correctly
    AccountFeed[] accFeed = [Select Id, Body From AccountFeed Where ParentId =:acc.Id];
    // should be 1 record in the feed for this accountid
    System.assertEquals(1, accFeed.size());
  Test.stopTest();
}

 

This test case fails, because there are no rows in AccountFeed for the given “parentId”. This happens only if Apex class API version is “24”, but the same tests passes if the API version is lowered, for ex. “23”.

Seems something is broken in Apex Test fixture.