• cbc
  • NEWBIE
  • 10 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
Hi ,  I am new to Developer Console and in an installed package the code automatically assigns a file name to an attachment and then saves it. Staff use this when out in the field to gather and save signatures. The line of code is:
att.name = 'eSignature_dtd_' + Datetime.now().format('MM_dd_yyyy_HH_MM_ss'); 

The full code is as follows:
public class ZVFSignaturePadController {
    public ZVFSignaturePadController(ApexPages.StandardController stdController){
        
    }
    
    @RemoteAction
    public static String uploadSignature(String b64SignData, String id){
        returnData ret = new returnData();
        ret.success = true;
        ret.message = 'Signature uploaded successfully';
        try{
            Blob signature = EncodingUtil.base64Decode(b64SignData);
            Attachment att = new Attachment();
            att.body = signature;
            att.ContentType = 'image/png';
            att.name = 'eSignature_dtd_' + Datetime.now().format('MM_dd_yyyy_HH_MM_ss');
            att.IsPrivate = false;
            att.ParentId = id;
            insert att;
        }catch(Exception e){
            ret.success = false;
            ret.message = e.getMessage();
        }    
        
        return JSON.serialize(ret);
    }
    
    
     private class returnData{
        Boolean success {get;set;}
        String message {get;set;}
    }
}

I want to add the client name at the front of the file name. This is stored in a custom object called Client. The field names are Client First Name and Client Last Name and the API names are Client_First_Name__C and Client_Last_Name__C. These are formula fields that look up the Contact record.

I am not sure how to add the first and last names to this line of code. 
I am doing this in a sandbox at the moment.
Any help appreciated.

Sue
  • March 22, 2018
  • Like
  • 0
One of our staff member accidentally deleted a contact that had revenue associated with it. I can still see the revenue via the campaign, but how do I re-associate the revenue with the new, replacement contact record? thanks.
  • February 14, 2018
  • Like
  • 0
I am using Trailhead Playground and doing the challenges. But after my second one where I had to make a change to account settings I received an email to say that the setting had been changed for my actual organisation. Surely that shouldn't happen? I will be very wary of completing the challenges if this is the case.
  • September 11, 2017
  • Like
  • 0
Hi ,  I am new to Developer Console and in an installed package the code automatically assigns a file name to an attachment and then saves it. Staff use this when out in the field to gather and save signatures. The line of code is:
att.name = 'eSignature_dtd_' + Datetime.now().format('MM_dd_yyyy_HH_MM_ss'); 

The full code is as follows:
public class ZVFSignaturePadController {
    public ZVFSignaturePadController(ApexPages.StandardController stdController){
        
    }
    
    @RemoteAction
    public static String uploadSignature(String b64SignData, String id){
        returnData ret = new returnData();
        ret.success = true;
        ret.message = 'Signature uploaded successfully';
        try{
            Blob signature = EncodingUtil.base64Decode(b64SignData);
            Attachment att = new Attachment();
            att.body = signature;
            att.ContentType = 'image/png';
            att.name = 'eSignature_dtd_' + Datetime.now().format('MM_dd_yyyy_HH_MM_ss');
            att.IsPrivate = false;
            att.ParentId = id;
            insert att;
        }catch(Exception e){
            ret.success = false;
            ret.message = e.getMessage();
        }    
        
        return JSON.serialize(ret);
    }
    
    
     private class returnData{
        Boolean success {get;set;}
        String message {get;set;}
    }
}

I want to add the client name at the front of the file name. This is stored in a custom object called Client. The field names are Client First Name and Client Last Name and the API names are Client_First_Name__C and Client_Last_Name__C. These are formula fields that look up the Contact record.

I am not sure how to add the first and last names to this line of code. 
I am doing this in a sandbox at the moment.
Any help appreciated.

Sue
  • March 22, 2018
  • Like
  • 0
One of our staff member accidentally deleted a contact that had revenue associated with it. I can still see the revenue via the campaign, but how do I re-associate the revenue with the new, replacement contact record? thanks.
  • February 14, 2018
  • Like
  • 0