• SGul
  • NEWBIE
  • 30 Points
  • Member since 2010

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 13
    Replies

Hi, We have a requirement where we need to get dashboard refreshed every two minutes automatically. If anyone has pointers related to same, please let me know. Thanks.

  • October 03, 2011
  • Like
  • 0

Hi,

We have a requirement where attachment history need to be maintained along with attachment content in a separate object. evry time when attachment is uploaded, updated or deleted from the system should get logged and attachment contents should be retained in history table. Salesforce doesn't have provision for tracking history related to attachments as per my knowledge.

 

So i am creating a custom object attachmenthistory to cater to this and writing trigger on attachment whch is logging the entire information to history object. but i am facing following challenges while saving the body of attachment:

Approach 1 :  

Rich Text Area field in Custom object supports storing only 1 MB Data. I tried to save the encoded data of attachment to this field , but it supports only 1 MB data max while i can receive attachments upto 5MB.

Conversion of attachment body data to binary is not working as rich text area field ha limitation of 32768 characters only. It throws error even for saving data for 1 MB file

 

Approach 2:

Inserting the attachment directly in Attachment History via Future Class.

and In trigger of attachment , put check that attachment relating to history, log need not to be maintained.

This will work but in that case there is limitation on number of invocations for Future Class. 200 per user license per 24 hours. we are expecting bulk of attachments to be uploaded into the system at time of migration of data.

 

Is there any other alternative to cater to this requirement?please help.

Thanks.

 

  • June 10, 2011
  • Like
  • 0

Hi,

I want to call a third party webservice which is expecting parameters of List<FILE> and LIST<PartSource>

PartSource datatype relates to org.apache.commons.httpclient.methods.multipart.PartSource.

 

Since i need to call this from Apex, can you please help me out to figure out , How can I pass out this information from Apex to webservice?

P.S.

1) Passing onto BLOB Data in these parameters is failing. Salesforce documentation @ Page No 206 of Apex Code Developer's Guide says that BLOB can't be passed in CALLOUTs.

 

2) We don't want to/can't  have a Java Layer in between which accepts String and convert to the acceptable format of File and PartSource

 

Can we write something in Apex to cater to this requirement??

Is it possible to import Java Libraries and use their functions in Salesforce???

 

Thanks.

  • June 09, 2011
  • Like
  • 0
Hi,

I have written a  trigger on Attachment (after insert, after update) I am trying to fetch the Parent Name in that by following code.
Anyone having idea why reference field's data is not accessible in trigger?

for(attachment  a: trigger.new)
{
   system.debug(a.ParentId) ;                 //It returns the ID appropriately
   system.debug(a.Parent.Name);        //but this is returning null even when corresponding name field is having data.
   system.debug(a.Parent);                   //even this is being returned as null;
}

There can be attachments related to n  number of objects. I don't want to fire too many SOQL just to know to which Parent this attachment is referring to.
Can anyone please suggest workaround for it?
Thanks
  • June 09, 2011
  • Like
  • 0

Hi,

I am writing following code in Attachment Trigger.
I want to get the Body content of Attachment after update and before delete, but its returning null in both the cases.
Only in case of insert i am able to fetch the body content of attachment. Here is the code:



trigger attachmentHistoryManager on Attachment (after insert, after update,before delete)
{
    List<AttachmentHistory__c> lstHistoryToBeIns = new List<AttachmentHistory__c>();
  
    if(trigger.isBefore && trigger.isDelete)
    {
      
        for(Attachment objAttach : trigger.old)
        {
            AttachmentHistory__c objHistory = new AttachmentHistory__c();
            system.debug('*****Printing Old Attachment Body data'+objAttach.body);
            objHistory.Body__c = Encodingutil.base64Encode(objAttach.body);
           
            lstHistoryToBeIns.add(objHistory);
         
        }
    }  
    if(trigger.isAfter)
    {
       
        for(Attachment objAttach : trigger.new)
        {
       
            AttachmentHistory__c objHistory = new AttachmentHistory__c();
            system.debug(Encodingutil.base64Encode(objAttach.Body));
           
            objHistory.Body__c = Encodingutil.base64Encode(objAttach.body);
            
            lstHistoryToBeIns.add(objHistory); 
         
        }
    }
    if(lstHistoryToBeIns!=null && lstHistoryToBeIns.size()>0)
    {
        Database.SaveResult[] lsr = Database.insert(lstHistoryToBeIns);
    }  
}

 

Can anyone there please help me out.

 

thanks.

  • June 09, 2011
  • Like
  • 0

Hi,

 

Whenever WSDL is being created from an APEX Class by clicking on Generate WSDL corres. to it, the generated WSDL contains some redundant elements such as DebuggingInfo, LogCategory, LogInfo, DebuggingHeader etc which are related to Debug/Log Information.

 

Is there any way by which these tags can be removed automatically when i click on generate WSDL and create the same?

 

Since Debug Headers are irrelevant and we dont want it to be there in generated WSDL , please let me know how to do it auomatically without changing it manually in generated WSDL.

 

Thanks,

Shipra

  • April 19, 2011
  • Like
  • 0

Hi, We have a requirement where we need to get dashboard refreshed every two minutes automatically. If anyone has pointers related to same, please let me know. Thanks.

  • October 03, 2011
  • Like
  • 0

Hi,

We have a requirement where attachment history need to be maintained along with attachment content in a separate object. evry time when attachment is uploaded, updated or deleted from the system should get logged and attachment contents should be retained in history table. Salesforce doesn't have provision for tracking history related to attachments as per my knowledge.

 

So i am creating a custom object attachmenthistory to cater to this and writing trigger on attachment whch is logging the entire information to history object. but i am facing following challenges while saving the body of attachment:

Approach 1 :  

Rich Text Area field in Custom object supports storing only 1 MB Data. I tried to save the encoded data of attachment to this field , but it supports only 1 MB data max while i can receive attachments upto 5MB.

Conversion of attachment body data to binary is not working as rich text area field ha limitation of 32768 characters only. It throws error even for saving data for 1 MB file

 

Approach 2:

Inserting the attachment directly in Attachment History via Future Class.

and In trigger of attachment , put check that attachment relating to history, log need not to be maintained.

This will work but in that case there is limitation on number of invocations for Future Class. 200 per user license per 24 hours. we are expecting bulk of attachments to be uploaded into the system at time of migration of data.

 

Is there any other alternative to cater to this requirement?please help.

Thanks.

 

  • June 10, 2011
  • Like
  • 0
Hi,

I have written a  trigger on Attachment (after insert, after update) I am trying to fetch the Parent Name in that by following code.
Anyone having idea why reference field's data is not accessible in trigger?

for(attachment  a: trigger.new)
{
   system.debug(a.ParentId) ;                 //It returns the ID appropriately
   system.debug(a.Parent.Name);        //but this is returning null even when corresponding name field is having data.
   system.debug(a.Parent);                   //even this is being returned as null;
}

There can be attachments related to n  number of objects. I don't want to fire too many SOQL just to know to which Parent this attachment is referring to.
Can anyone please suggest workaround for it?
Thanks
  • June 09, 2011
  • Like
  • 0

Hi,

I am writing following code in Attachment Trigger.
I want to get the Body content of Attachment after update and before delete, but its returning null in both the cases.
Only in case of insert i am able to fetch the body content of attachment. Here is the code:



trigger attachmentHistoryManager on Attachment (after insert, after update,before delete)
{
    List<AttachmentHistory__c> lstHistoryToBeIns = new List<AttachmentHistory__c>();
  
    if(trigger.isBefore && trigger.isDelete)
    {
      
        for(Attachment objAttach : trigger.old)
        {
            AttachmentHistory__c objHistory = new AttachmentHistory__c();
            system.debug('*****Printing Old Attachment Body data'+objAttach.body);
            objHistory.Body__c = Encodingutil.base64Encode(objAttach.body);
           
            lstHistoryToBeIns.add(objHistory);
         
        }
    }  
    if(trigger.isAfter)
    {
       
        for(Attachment objAttach : trigger.new)
        {
       
            AttachmentHistory__c objHistory = new AttachmentHistory__c();
            system.debug(Encodingutil.base64Encode(objAttach.Body));
           
            objHistory.Body__c = Encodingutil.base64Encode(objAttach.body);
            
            lstHistoryToBeIns.add(objHistory); 
         
        }
    }
    if(lstHistoryToBeIns!=null && lstHistoryToBeIns.size()>0)
    {
        Database.SaveResult[] lsr = Database.insert(lstHistoryToBeIns);
    }  
}

 

Can anyone there please help me out.

 

thanks.

  • June 09, 2011
  • Like
  • 0