You need to sign in to do that
Don't have an account?
Shaun A
adding extension to document
Hi,
I want to append the extension of document like .doc,.docx,.ppt etc based on the content type.For this I want to use custom setting that maintains all content type value with extension(Custom setting > Two fields > 1.content type of document 2.Extension) so that based on contnent type I can add the extension at time of sending email with attachement :
Snippet of code :
for (Attachment attachDoc : [select Name, Body, ContentType
from Attachment
where Id in :attachmentIds])
{
Messaging.EmailFileAttachment Email= new Messaging.EmailFileAttachment();
/* IF content type from Custom setting == Content Type Of Attachment
Name of Attachment would be appneded with Custom Setting Extension Value,
*/
Email.setFileName(attach.Name);
Email.setBody(attach.Body);
Email.setContentType(attach.ContentType);
AttachmentList.add(Email) ;
}
mail.setFileAttachments(AttachmentList) ;
I want to append the extension of document like .doc,.docx,.ppt etc based on the content type.For this I want to use custom setting that maintains all content type value with extension(Custom setting > Two fields > 1.content type of document 2.Extension) so that based on contnent type I can add the extension at time of sending email with attachement :
Snippet of code :
for (Attachment attachDoc : [select Name, Body, ContentType
from Attachment
where Id in :attachmentIds])
{
Messaging.EmailFileAttachment Email= new Messaging.EmailFileAttachment();
/* IF content type from Custom setting == Content Type Of Attachment
Name of Attachment would be appneded with Custom Setting Extension Value,
*/
Email.setFileName(attach.Name);
Email.setBody(attach.Body);
Email.setContentType(attach.ContentType);
AttachmentList.add(Email) ;
}
mail.setFileAttachments(AttachmentList) ;
If your question is about how to access custom settings, please see this help document on how to use custom settings in apex code: http://help.salesforce.com/HTViewHelpDoc?id=cs_accessing.htm&language=en_US
When you add data to a custom setting, you must name each set of data. Then you can distinguish between the sets of data by the data set name. The following returns a map of custom settings data. The getAll method returns values for all custom fields associated with the list setting.
Map<String_dataset_name, CustomSettingName__c> mcs = CustomSettingName__c.getAll();
The following example uses the getValues method to return all the field values associated with the specified data set. This method can be used with both list and hierarchy custom settings, using different parameters.
CustomSettingName__c mc = CustomSettingName__c.getValues(data_set_name);
Thanks,
Shashank