• Jaap Branderhorst
  • NEWBIE
  • 35 Points
  • Member since 2013
  • Senior ISV Technical Evangelist
  • Salesforce


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 10
    Replies
Hello,
I am having error "Error Occurred: Guest users are not permitted in internal communities"  when I use site guest user to post message  to chatter thro' process flow.

​How can I fix it? Is it something I am missing permission on chatter for this site guest user?
  • November 04, 2015
  • Like
  • 0
All, I was wondering if someone can help me. Below is my trigger which is very simple. It will take Feed item from Account page and will repost it to Chatter group. Trigger works fine for Post and Link, but when I`m trying to attach exisitng File from content library and share it, it generates below error.

Field_Integrity_Exception, ContentFileName is required field for feed post of type ContentPost. Content File Name: [ContentFileName]

Can someone pls suggest a workaround?
trigger autoPostFromAccToGroup on FeedItem (before insert) {

List <FeedItem> Feedlist = New List <FeedItem> ();

 Map <id,Account> AccMaps = New Map <id, Account> () ;
Set <Id> idsets = New Set <Id> ();

      For (Feeditem fe : Trigger.New) {
          String idStr = fe.Parentid;
           if(idStr.startsWith('001')){
                     idsets.add(idStr);    
           
      
      }
    }
    
       List <Account> accs = [SELECT ID, Owner.Name, RecordTypeid, Name FROM Account WHERE id IN :idsets ];
       
           for (Account  acc : accs) {
                   
            AccMaps.put(acc.id,acc);      

    
        
        
                   for (Feeditem f : Trigger.New) {
                   
                   if (AccMaps.get(f.parentid).Recordtypeid == '012300000000uth') {  
                   
            FeedItem FI = New FeedItem ();
            FI.ParentId = '0F91b0000008ThRCAU' ; 
            FI.TYPE = F.TYPE; 
            Fi.IsRichText = True;
            FI.Body = F.Body;
            Fi.LINKURL = F.LINKURL;
            Fi.TITLE = F.TITLE;
            Fi.ContentFileName = F.ContentFileName;
            Fi.ContentData = F.ContentData ;
            Fi.ContentDescription= F.ContentDescription;
           Fi.CreatedByid = UserInfo.getUserId() ;


            Feedlist.add(FI);

        
        }
        }
        }
         insert Feedlist;  
        
}

 

Thank you in advance for any assistance!  Within a specific quote record type, we "look up" to an existing custom object record and when the quote is closed "won", a new custom object record is created.  Let me paint the picture.  I create a new 'conversion" opportunity and then a "conversion" quote where I'm able to look up to machine number "1234".  The machine number field is an auto number that issues in sequence.  When I close a new conversion quote as won, a few things happen.  First, the existing machine (in this example "1234" switches to a "Converted" record type with matching page layout that locks down all fields and shows the converted date.  Second, the new machine record is created with updated specs from the quote.  The machine number is whatever is next in the sequence is and this is where I'm struggling.  

I need for the new record to reflect the old machine "1234" and then to show "C-1" for conversion 1.  If the old machine was "1234 C-1" then new one should be "1234 C-2".  I hope that this makes sense and that someone can point me in the right direction.
 

Thanks again,
 

Jessica

I am attempting to extract metadata from one org and deploy to another and I receive the message 
profiles/Standard.profile -- Error: Unknown user permission: EditReports
for .profile XML files that contain
<userPermissions>
        <enabled>true</enabled>
        <name>EditReports</name>
    </userPermissions>
I've searched through the Release notes for Summer '13, Winter '14, Spring '14 and Summer '14 and cannot find any reference for a change to this user permission, although I can see that there are new User Permissions like ManageReportsInPubFolders although this looks more like the old EditPublicReports.

Can anyone point me towards documentation or references that describe the current User Permissions by their API names in the metadata API? Or the release in which this was changed?

I'm working with an organization that has a large amount of Apex code developed with previous contractors, and I've run into some issues with getting my new code playing nice with the existing Apex.

 

I've written a new controller which requires an Account object for testing. I'm creating the Account object as follows:

public static Account getAccount(){
    return new Account(
        Name = 'Test Acc EL CH FB',
        Squad_Class__c = 'CH - Cheer',
        Squad_Type__c = 'EL - Elementary',
        Squad_Group__c = 'FB - Football',
        BillingStreet = 'Test Bill Address',
        BillingCity = 'Test Bill City',
        BillingState = 'CA',
        BillingCountry = 'US',
        Billing_County__c = 'US',
        BillingPostalCode  = '523622',
        RecordTypeId = [select Id from RecordType where SObjectType ='Account' and Name = 'Squads/Teams' Limit 1][0].Id
    );
}

 

This is called from the test as so:

Account acc = AllStarTestUtils.getAccount();
insert acc;

 

On insert an existing Trigger written by a previous contractor is run:

trigger NewAccountTrigger on Account (before insert) {
    AccountSettings__c acctSettings = AccountSettings__c.getOrgDefaults();
    Double CustAutoNum = acctSettings.DB2_Customer_Number_Auto__c;
    ...

 

When I run my test I'm seeing the code bomb out on line 3 of the existing Trigger with the following exception:

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, NewAccountTrigger: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.NewAccountTrigger: line 3, column 1: []

 

From what I can tell, the custom settings object AccountSettings__c is null when running the test. I've verified the custom setting exists in my sandbox, and when I output the following code in the Debug Console, the logs are returning the expected value:

System.debug(AccountSettings__c.getOrgDefaults());
System.debug(AccountSettings__c.getOrgDefaults().DB2_Customer_Number_Auto__c);

 

So, it looks like everything should be working fine, but obviously this null pointer is causing problems. I read in the documentation for getOrgDefaults there was a change in the what getOrgDefaults returns when empty. In v21 or prior a NULL was returned. The existing Trigger is versioned at v20 and my new code is versioned at v24. If I bump my new code down to v20 the test passes, but it does not work in reverse; if I increase the existing trigger to v24 I still get a null pointer.

 

I should mention this Trigger is working fine outside the context of the test. Any ideas?

Hi all.

 

I am writing an apex trigger,

 

trigger LatestEvaluationHistory on Evaluation_History__c (after delete, after insert,
 after undelete, after update) {

// this is the child object.

 

 

 

//then I want to update the parant object when the child is delete/insert/update

List<Job_Evaluation__c> dateToUpdate = new List <Job_Evaluation__c>{};

 

 

}

 

then I got the error:  Field is not writeable

 

 

Any body can help me on this? cause I am totally new in apex :)

 

 

Hi Experts,

can i call standard controller's save action in my extension controller...

 

 

<apex:page standardcontroller="opportunity" extension="oppoExtesion"> <apex:form> <apex:pageblock> <apex:pageblockbutton> <apex:commandbutton value="Save" action="{!mysave}"/> </apex:pageblockbutton> <apex:inputfield value="{!opportunity.name}"/> <apex:inputfield value="{!opportunity.amount}"/> <apex:inputfield value="{!opportunity.closedate}"/> </apex:pageblock> </apex:form> </apex:page> ********Extension************* public class oppoextension { public pagereference mysave() { my validation check...... //Here i wnat to call standard controller's Save Action to perform the save operation as standard way... save(); } }

 

i want to experience standard salesforce validation check , field level security , profile base permission 

as well as my custom validation through apex code

 

so how can i standard controller's Save from my extension's save method...


 

Is there any tool available through which we can review Apex code?