You need to sign in to do that
Don't have an account?
Jaymin Sutarwala 7
Compilation error: Expecting a colon, found ','
While trying to compile the following test class I am getting a compilatio error Compilation error: Expecting a colon, found ',' at this particular line in the code
ConnectApi.FeedElementPage Leadpost = ConnectApi.ChatterFeeds.getFeedElementsFromFeed(null, ConnectApi.FeedType.Record, TestLead1.id, null, 5, CreatedDateDesc);
Can anyone help me to get rid of this.
ConnectApi.FeedElementPage Leadpost = ConnectApi.ChatterFeeds.getFeedElementsFromFeed(null, ConnectApi.FeedType.Record, TestLead1.id, null, 5, CreatedDateDesc);
Can anyone help me to get rid of this.
@isTest(seeAllData=true) private class TestLeadContactFeedTrigger { static testmethod void initTest(){ Profile p = [SELECT Id FROM Profile WHERE Name='Standard User']; User u = new User(Alias = 'TLCFT', Email='TLCFTest@test.com', EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', LocaleSidKey='en_US', ProfileId = p.Id, TimeZoneSidKey='America/Los_Angeles', UserName='TLCFTest@test.com'); insert u; System.debug('User created: ' + u.Id); Lead TestLead1 = new Lead(FirstName = 'Test', LastName = 'Lead1', Company = 'Test Comp1', Status ='Working-Contacted', Email ='test.lead1@test.com', OwnerId = u.Id, // OwnerId = '005K0000002N5GT', Lead_Info__c = 'This is the Lead Info for a test lead John Doe1'); insert TestLead1; ConnectApi.FeedElementPage Leadpost = ConnectApi.ChatterFeeds.getFeedElementsFromFeed(null, ConnectApi.FeedType.Record, TestLead1.id, null, 5, CreatedDateDesc); System.assertEquals('This is the Lead Info for a test lead John Doe1', TestLead1.Lead_Info__c); } }
I copied your code and noticed that there's a zero-width space in "ConnectApi.FeedType.Record" between "ConnectApi." and "FeedType.Record". After I removed the zero-width space, the Apex code compiled properly.
The zero-width space was likely inserted accidentally when copying and pasting from the API documentation. Do you have a link to the page that you may have copied the value from?
All Answers
ConnectApi.FeedElementPage Leadpost =ConnectApi.ChatterFeeds.getFeedElementsFromFeed(null, ConnectApi.FeedType.Record, TestLead1.id, null, 5, CreatedDateDesc);
On the line above, you are using CreatedDateDesc but you have not defined any variable as CreatedDateDesc.
If CreateDateDesc is a fuction use it like It may be string. If it is string you have to writ it like or you have to define CreatedDate varible in your code.
Regards Vickey
Please let me know if it works.
getFeedElementsFromFeed(String, ConnectApi.FeedType, String, Integer, ConnectApi.FeedDensity, String, Integer, ConnectApi.FeedSortOrder)
I even tried using ConnectApi.FeedSortOrder.createdDateDesc but even then it is not working.
ConnectApi.FeedElementPage Leadpost = ConnectApi.ChatterFeeds.getFeedElementsFromFeed(null, ConnectApi.FeedType.Record, TestLead1.id, null, 5, ConnectApi.FeedSortOrder.CreatedDateDesc);
I copied your code and noticed that there's a zero-width space in "ConnectApi.FeedType.Record" between "ConnectApi." and "FeedType.Record". After I removed the zero-width space, the Apex code compiled properly.
The zero-width space was likely inserted accidentally when copying and pasting from the API documentation. Do you have a link to the page that you may have copied the value from?
I am using Eclipse IDE so how can i identify zero-width space in Eclipse editor in case i come across this in future ?