• Santhosh Gaddam 3
  • NEWBIE
  • -1 Points
  • Member since 2018
  • ABC

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
public class Document_TriggerHandler{
    // Getting the Document Id and creating a Document Url.
    public static string getStrLogoUrl(){
        list<Document> lstDocument = [SELECT Id,Name,DeveloperName FROM Document WHERE DeveloperName=:Label.my_Label2];
        String strOrgId = UserInfo.getOrganizationId();
         string strLogoUrl = System.URL.getSalesforceBaseUrl().toExternalForm() + 
            '/servlet/servlet.ImageServer?id='+lstDocument[0].Id +
            '&amp;oid=' + strOrgId;
        system.debug('===>'+strLogoUrl);
        return strLogoUrl;
    }
    public static string getLogoUrl(){
        list<Document> documentLst = [SELECT Id,Name,DeveloperName FROM Document WHERE DeveloperName=:Label.My_Label1];
        String orgId = UserInfo.getOrganizationId();
            String logoUrl = System.URL.getSalesforceBaseUrl().toExternalForm() + 
            '/servlet/servlet.ImageServer?id='+documentLst[0].Id +
            '&amp;oid=' + orgId;
        return logoUrl;
    }
    
    public String getLoginUrl(){
        List<Network> netList= [SELECT Id,Name FROM Network where Name=:Label.MY_Label];
        return Network.getLoginUrl(netList[0].Id);
        
    }
}
I have a requirement to capture the approval process comments on a custom field we just have one step for approval process. Can some one guide me to achieve the same.
  • December 29, 2016
  • Like
  • 0
Hi can someone help me in writing a trigger for the below scenario as i'm new for coding and do not have much  experience in writing trigers

When a Contact is updated and Primary checkbox is set, that contact will become the primary contact and the reference should get updated on Parent Account. The Primary Contact flag should be true for only one contact at a time. If an Account has no Contacts, then the first created contact by default becomes the primary and that value should be set in reference. If the primary contact is deleted, the next available contact, if there is any, should be the primary contact and the relationship on account should reflect this. If all contacts are deleted, the primary contact reference on Account will be Blanked out. Test Class as well for it.
  • February 06, 2015
  • Like
  • 0

Hello,

 

I've discovered something very strange with Force.com Sites and the Customer Portal.  If you change the owner of a Case to a Customer Portal User this then updates the Case's Contact to the Contact associated with the Customer Portal User.

 

This change happens deep in the background and by passes all of the validation rules and triggers that we have in place to prevent Case Contact's from changing, and Cases being logged with Contacts associated to an Account other than the one the Case is associated with.  However, when you change the Case Owner back to an internal user, the Validation and Triggers are fired and then it recgonises that the Case's Contact is not assoicated with the same Account as the Case and an error is produced.

 

My question is:  Is this correct behaviour or am I missing something obvious with Sharing Rules or such like?

 

Any tips would be greatly appreciated.

 

Kind regards,

 

Paul.