• kiran punuru
  • NEWBIE
  • 30 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 35
    Questions
  • 22
    Replies
Hi ,
I am getting below error and unable to find the root cause please advise:
@@@Error Message:SendEmail failed. First exception on row 0; first error: INVALID_CONTENT_TYPE, An invalid value (ContentPost) was specified for contentType.: [fileAttachments, ContentPost] 

Thanks
kiran
Hi,

Can someone tell me how many no of roles does a single user can have?

Thanks
Kiran
Hi ,
I Have one question like this :
 1: If using @istest(SeeAllData = true) in test classes is not a best practice then why it is present(why it is implemented).
 2: Which are the places where we can use @istest(SeeAllData = true)

Thanks
kiran
 
Hi Iam trying attach a document which is uploaded in chatter to the email and send that email but iam getting the system.query exception:list has no rows for assignment to sobject.
Trigger:
trigger SendEmailOnFileUploadTrigger2 on ContentDocumentLink (after insert,after update) {
    Set<Id> fieldIds = new Set<Id>();
    Set<Id> docIdSet = new Set<Id>();
    for(ContentDocumentLink content :trigger.new){
        fieldIds.add(content.LinkedEntityId);
        docIdSet.add(content.ContentDocumentId);
    }
    system.debug('@@@ Linked Entity Id:'+fieldIds);
    system.debug('@@@ Content Document Id:'+docIdSet);
    if(trigger.isAfter)
    EmailHandler.sendUploadNotificationEmail(docIdSet);
}

Class:
public without sharing class EmailHandler {
    public static void sendUploadNotificationEmail(set<Id> docIds){
         system.debug('@@@@Document Ids:'+docIds);
         Document doc = [select id, name, body, contenttype, developername, type from Document where Id IN :docIds]; 
         Messaging.EmailFileAttachment attach = new Messaging.EmailFileAttachment();
            attach.setContentType(doc.contentType);
         attach.setFileName(doc.developerName+'.'+doc.type);
         attach.setInline(false);
         attach.Body = doc.Body; */
         Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
         String[] toAddresses = new String[] {'test@xyz.com'};
         String[] ccAddresses = new String[] {'kirankumar.punuru@xyz.com'};
         mail.setUseSignature(false);
         mail.setToAddresses(toAddresses);
         mail.setCcAddresses(ccAddresses);
         mail.setReplyTo('kirankumar.punuru@eclerx.com');
         mail.setSenderDisplayName('Kiran Kumar reddy Punuru');
         mail.setSubject('The Below File Has been uploaded : ');
         //mail.setHtmlBody('Here is the email you requested: '+doc.name);
         //mail.setFileAttachments(new Messaging.EmailFileAttachment[] { attach }); 
         mail.setBccSender(false);
         Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); 
      }
  }

Please correct the above if iam doing in correct.

Thanks
kiran
Hi ,
Is it possible to send an email to a user when any user uploads a file in chatter.Any ideas?

Thanks
Kiran
Can we set a field on opportunity to identify which is one is scheduled using apex scheduler.
Example :
I am sending an emails to opportunity owners on friday using apex scheduler .Is there a way to identify which for which opportunities the email was sent.
 
Thanks
Kiran
Hi ,
How to restrict users from deleting opportunity team members which means only system admin can only delete the opportunity team members .can someone suggest on this?

thanks
kiran
Hi,
How to restrict other users to edit opportunity splits only system admin can edit opportunity split.

Thanks
kiran
Hi ,

Iam having one scenario  where i need to send reminder mails on friday in which the reminder mail contains all the opportunities satisfying this condition:
[select id,name from opportunity where billingstartdate < today];

on monday i need to update for all the opportunities i have sent on friday but here also we are using same condition to update:
[select id,name from opportunity where billingstartdate < today];

Because we are using the same condition it will update the opportunities having billing start date on friday ,sat,sun .But i  need to update for those opps which sended in reminder mail on friday.

If change in the same query will it work ,Any suggestion on this.

Thanks,
kiran 
 
Hi ,
I have created one validation rule on opportunity split object where iam restricting the users to add split percent other than 50 ,25,75.

My validation rule is like this:
 IF(SplitPercent != 0.5 || SplitPercent != 0.25 || SplitPercent != 0.75,1,0   )

But even if iam adding 50 in split percent it is giving the error .Can anyone advise on this.

Thanks,
Kiran
Hi ,
How to add a validation rule which does not allows to add 3rd opportunity team member if the first two opportunity team members having same profile.
Thanks,
kiran
I have one requirement like this,If the user added on opportunity team have different profile then set a check box to true which is best way to acheive this.can anyone advise on this.

thanks
kiran 
I need to add one rule where if the users added in opportunity team  have same profile then it wont allow to add third user .any ideas?

thanks
kiran
Hi All,

How to get the approval process id related to a particular opportunity.

Thanks,
Kiran
Hi All,

Iam having one scenario where i need to jump one step in approval process if the actual approver at step 2 and approver at step 4 are same out of 5 steps.
Example : Approval Process:
          Step 1: approver (rohit)
          Step 2: approver (Ram)
          Step 3:approver  (Naresh)
          Step 4: approver (Ram)
          Step 5 : approver (Shyam)
From the above in step 2 the approver may change depends on the condition but the approver at step 4 is remains fixed ,now if the approver at 2 step is ram then i need to jump step 4 and directly go to step 5.Is there any way to do this??

Thanks
Kiran 
 
Hi All,

I am having one requirement like when 2  opportunity team member is added to a opportunity then if the profile of the opportunity team members are different then i need to set a field to true on opportunity object ,if both profiles are same then false.Any help will be greatly appreciated.

Thanks,
Kiran 
Hi All,
I have one field startdate__c which is of type date field when iam using this field in the soql query and displaying that field it is giving the format like : 2016-05-03 00:00:00 .How can i remove 00:00:00 and display only date ? Can someone advise .

Thanks,
Kiran
Hi All,

Can Someone tell me how to cover the lines of code inside for loop .
My Class is:

public with sharing class MyClass{
  public static void (String userId,List<String> oppids)(){
List<Opportunity> lstopp = new List<Opportunity>();
 for(Opportunity opp :[Select id ,name,Probability  from Opportunity where  Probability == 50]){
      if(opp.probability == 50){
          opp.probability = 65;
       lstopp.add(opp);
}
}
 
How can i create a map of opportunity owner id against list of opportunities for a particular owner id.

Thanks 
Kiran
Hi ,
I Have list of 10 accounts which i need to update out of that 10 records 5 records get updated and 5 records get failed to update due to validation rules ,Is there a way to get the failed record ids .any ideas ??

Thanks 
Kiran
Hi ,
I am getting below error and unable to find the root cause please advise:
@@@Error Message:SendEmail failed. First exception on row 0; first error: INVALID_CONTENT_TYPE, An invalid value (ContentPost) was specified for contentType.: [fileAttachments, ContentPost] 

Thanks
kiran
Hi,

Can someone tell me how many no of roles does a single user can have?

Thanks
Kiran
Hi Iam trying attach a document which is uploaded in chatter to the email and send that email but iam getting the system.query exception:list has no rows for assignment to sobject.
Trigger:
trigger SendEmailOnFileUploadTrigger2 on ContentDocumentLink (after insert,after update) {
    Set<Id> fieldIds = new Set<Id>();
    Set<Id> docIdSet = new Set<Id>();
    for(ContentDocumentLink content :trigger.new){
        fieldIds.add(content.LinkedEntityId);
        docIdSet.add(content.ContentDocumentId);
    }
    system.debug('@@@ Linked Entity Id:'+fieldIds);
    system.debug('@@@ Content Document Id:'+docIdSet);
    if(trigger.isAfter)
    EmailHandler.sendUploadNotificationEmail(docIdSet);
}

Class:
public without sharing class EmailHandler {
    public static void sendUploadNotificationEmail(set<Id> docIds){
         system.debug('@@@@Document Ids:'+docIds);
         Document doc = [select id, name, body, contenttype, developername, type from Document where Id IN :docIds]; 
         Messaging.EmailFileAttachment attach = new Messaging.EmailFileAttachment();
            attach.setContentType(doc.contentType);
         attach.setFileName(doc.developerName+'.'+doc.type);
         attach.setInline(false);
         attach.Body = doc.Body; */
         Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
         String[] toAddresses = new String[] {'test@xyz.com'};
         String[] ccAddresses = new String[] {'kirankumar.punuru@xyz.com'};
         mail.setUseSignature(false);
         mail.setToAddresses(toAddresses);
         mail.setCcAddresses(ccAddresses);
         mail.setReplyTo('kirankumar.punuru@eclerx.com');
         mail.setSenderDisplayName('Kiran Kumar reddy Punuru');
         mail.setSubject('The Below File Has been uploaded : ');
         //mail.setHtmlBody('Here is the email you requested: '+doc.name);
         //mail.setFileAttachments(new Messaging.EmailFileAttachment[] { attach }); 
         mail.setBccSender(false);
         Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail }); 
      }
  }

Please correct the above if iam doing in correct.

Thanks
kiran
Hi ,
How to restrict users from deleting opportunity team members which means only system admin can only delete the opportunity team members .can someone suggest on this?

thanks
kiran
I have one requirement like this,If the user added on opportunity team have different profile then set a check box to true which is best way to acheive this.can anyone advise on this.

thanks
kiran 
Hi All,

How to get the approval process id related to a particular opportunity.

Thanks,
Kiran
Hi All,

I am having one requirement like when 2  opportunity team member is added to a opportunity then if the profile of the opportunity team members are different then i need to set a field to true on opportunity object ,if both profiles are same then false.Any help will be greatly appreciated.

Thanks,
Kiran 
Hi All,
I have one field startdate__c which is of type date field when iam using this field in the soql query and displaying that field it is giving the format like : 2016-05-03 00:00:00 .How can i remove 00:00:00 and display only date ? Can someone advise .

Thanks,
Kiran
Hello ,
I have a requirement ,where the system should automatically  calculate 100 days before the contract end date and send an alert to the customer.How can we formulate the formulae ,
 
1)Date dt = Today()+100 and then assign it to contract end date =:dt in a query
2) Date ed = Date.today().addDays(100);
3)contract end date >=Today+100days
4)Date=(today+100 - contractend date)
or how can we calculate..Im in dilemma  which one should work to calculate.Any thoughts or ideas or example very much appreciated.
i need get error if  inserting a records  if dml is fails  shows error 
how to do  please tell me let you know


public class batchapexerror implements database.Batchable<sobject>,database.stateful {
    public string errors[] =new new string[]{'jnkjdnksdj','hfhh'};
    public database.QueryLocator start(database.BatchableContext be){
        return database.getQueryLocator('select id,name,firstname,lastname from account ');
       }
    public void execute(database.BatchableContext bc,list<sobject> acc){
        account a=new account();
        for(account a1:a){
               try{
                   if(a.AnnualRevenue==50000){
                a.name='prakesh';
                a.industry='banking';
                insert a;
                   }
               }catch(exception e){
                       errors.add(e.getmessage());
                   }
                   
            } 
            
        }
    public void finish(database.BatchableContext bc){
        
    }
   }