• RAMANJINEYULU GOGULA
  • NEWBIE
  • 20 Points
  • Member since 2016
  • Salesforce Developer
  • SIEMENS


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 12
    Replies
I have rich text area field with an image but when I am trying to include the field using the merge field in the html email template ...image is not displaying in email.Any ways to display image from richtext area field.
Hi,
I'm uploading an image in Salesforce, where that field datatype is Text Area Rich, and I also gave that API name in Email  Template.

But when I ever send an email, attachment is not sending and only text is passing. So can anybody help regarding this. How to showcase my attachment image in sent email?
Please if you have any ideas, let me know. 

In the report generator we can able to see drop down where, Run Report and Schedule Reports options avail.

While scheduling reports we can send emails to existed users and groups. But my case is to send reports to Email Id's that are present in Contact object.

So kindly share your ideas.. 
Class::

global class Rfleet_C2GFRScheduledBatchable_SCH implements Schedulable{
  
    global void execute(SchedulableContext sc) {
    
    //added by murugan
     //If the model, the version already exists in the R-FLEET product object but isn’t present in C2G return then the ‘Active’ checkbox on Product object isn’t ticked anymore
       list<Product2>updateActive=new list<Product2>(); 
       list<Product2> lsprodinactive=[Select IsActive from Product2 where CountryCode__c='FR'];
           for(Product2 prod:lsprodinactive){
              if(prod.IsActive==true){
                  prod.IsActive=false;
                  updateActive.add(prod);
              }
           }
            update updateActive;
    
         Rfleet_C2GProductDetails_BATCH frBatch = new Rfleet_C2GProductDetails_BATCH(label.Rfleet_FranceLabel.touppercase());   
         ID batchprocessid = Database.executeBatch(frBatch ,1);           
    }
}


Test Class:

@isTest
public class Rfleet_C2GDEScheduledBatchable_SCH_TEST {
    @isTest static void c2GDEScheduleTest(){
        Product2 p2=new Product2();
        p2.Name='TEST';
        p2.IsActive=TRUE;
        p2.CountryCode__c='DE';
        insert p2;
        
        test.startTest();
        Rfleet_C2GDEScheduledBatchable_SCH rcs=new Rfleet_C2GDEScheduledBatchable_SCH();
        Rfleet_C2GProductDetails_BATCH deBatch = new Rfleet_C2GProductDetails_BATCH(label.Rfleet_germanyCountryCode.touppercase());   
        String schedule='0 0 * * * ?';
        System.schedule('TEST C2GDE', schedule, rcs);
        //stem.scheduleBatch('deBatch','TEST C2GDE', 0,1);
        test.stopTest();
    }
}

Here everything is covering except "  ID batchprocessid = Database.executeBatch(frBatch ,1);  "

Can any1 answer it ?
public with sharing class Rfleet_DEListofUnitOrderRPT_TRG {


public static void onAfterUpdate(Map<Id,CST_Carset__c> mcarsets){

    string cstRectype=null;
    string strCodeconcat1to9=null;
    string strCodeconcat10to18=null;
    List<CST_Carset__c> lsupdateCarSet=new list<CST_Carset__c>();
    for (Rfleet_CountryInfo__c setting : Rfleet_CountryInfo__c.getAll().values()){
        if(setting.Name=='DE'){
            cstRectype=setting.Rfleet_CST_RecordType__c;
        }
    }
    system.debug('$##'+cstRectype);
    Id cstrectyprId = Schema.SObjectType.CST_Carset__c.RecordTypeInfosByName.get(cstRectype).RecordTypeId;

    system.debug('$##'+cstrectyprId);
    
    List<CST_Carset__c> listCarSet = new list<CST_Carset__c>([select Id,Optionscodes10_18__c,Optionscodes1_9__c,(select code__c,servicetype__c from services__r) from CST_Carset__c where id =:mcarsets.keySet()]
       );
    
    for(CST_Carset__c cstoption:listCarSet){
        
         system.debug('cstoption .services__r.size()>>>'+cstoption.services__r.size());
            integer j=0;
            integer k=0;
            integer count=0;
             
        for(Integer i=0;i<cstoption.services__r.size();i++) {
            if(cstoption.services__r[i].servicetype__c=='Option' && count<8) {
               if(cstoption.services__r[i].code__c!=null) { 
                    if(j==0){
                        strCodeconcat1to9=cstoption.services__r[i].code__c+' ';
                        j++;
                    }else{
                        
                    strCodeconcat1to9+=cstoption.services__r[i].code__c+' ';    
                    }   
                    
            }
            count++;    
            System.debug('if count:::'+count);  
           }else if(cstoption.services__r[i].servicetype__c=='Option'){
               
            if(cstoption.services__r[i].code__c!=null) { 
                    if(k==0){
                        strCodeconcat10to18=cstoption.services__r[i].code__c+' ';
                        k++;
                    }else{
                        
                    strCodeconcat10to18+=cstoption.services__r[i].code__c+' ';  
                    }   
                    
            }   
               
           }
           cstoption.Optionscodes1_9__c=strCodeconcat1to9;
           cstoption.Optionscodes10_18__c=strCodeconcat10to18;
        }
    System.debug('Codeconcat1to9:::'+strCodeconcat1to9);
    System.debug('Codeconcat10to18'+strCodeconcat10to18);
    lsupdateCarSet.add(cstoption);
    }
    
    try{
      update lsupdateCarSet;
    }catch(Exception ex) {
     system.debug('## Exception occured::'+ ex);
    }
       
}


}
You can observe here, it is executing but not affecting any changes in the records, please help me out?

public class ramsBatchTownName implements Database.Batchable<sObject> {
    public String field;
    public String v1,v2,v3,v4,v5;
    public String query;
    public ramsBatchTownName(String q){
        field='Address__c';
        v1='KKM';
        v2='MDP';
        v3='NAND';
        v4='PLVD';
        v5='NO ADDRESS';
        query=q;
    }
    public Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator(query);
    }
    public void execute(Database.BatchableContext BC, List<Ram__c> batch){
        for(Ram__c rc:batch){
            if(rc.Districts__c=='Anantapur')
                rc.put(field,v1);
            else if(rc.Districts__c=='Chittor')
                rc.put(field,v2);
            else if(rc.Districts__c=='Kurnool')
                   rc.put(field,v3);
            else if(rc.Districts__c=='Kadapa')
                   rc.put(field,v4);
        }
        update batch;
    }
    public void finish(Database.BatchableContext BC){
        
    }
}
I want to keep 4 coloumns as  Name, PhoneNumber, OrderName(oName), PaymentAmount.
Controller:

public class multiwrapper 
{
    public class multiInfo
    {
        public String Name    {get;set;}
        public String phNum   {get;set;}
        public String oName   {get;set;}
        public Decimal payment{get;set;}
    }
    public List<multiInfo> aldata{get;set;}
    public multiwrapper()
    {
        aldata = new List<multiInfo>();
        multiInfo mi;
        for(PersonInfo__c pi:[SELECT Name,Phone_Number__c FROM PersonInfo__c])
        {
            mi=new multiInfo();
            mi.Name    = pi.Name;
            mi.phNum   = pi.Phone_Number__c;
            aldata.add(mi);
        }
        for(Order__c oc:[SELECT Name,Payment_Amount__c FROM Order__c])
        {
            mi=new multiInfo();
            mi.oName   = oc.Name;
            mi.payment = oc.Payment_Amount__c;
            aldata.add(mi);
        }
    }
}


VF Page:

<apex:page sidebar="false" controller="multiwrapper" standardStylesheets="false">
<style>
h1
{
    background-color:pink;font-size:44px;font-family:Mistral;
}
</style>
<center>
    <h1>Multi-Object Wrapper</h1>
</center>
<table>
    <tr>
        <th>Name</th>
        <th>Phone Number</th>
        <th>Order Name</th>
        <th>Payment Amount</th>
    </tr>
    <apex:repeat value="{!aldata}" var="dat">
    <tr>
        <td><apex:outputText value="{!dat.Name}"></apex:outputText></td>
        <td><apex:outputText value="{!dat.phNum}"></apex:outputText></td>
        <td><apex:outputText value=" {!dat.oName}"></apex:outputText></td>
        <td><apex:outputText value=" {!dat.payment}"></apex:outputText></td>
    </tr>
    </apex:repeat>
</table>
</apex:page>
public with sharing class salescontroller 
{
    public string dat='this month';
   public Integer leadcount{ get; set; }
   
    public Integer getCountings()
    {
       Integer counts=[SELECT COUNT() FROM Lead];
       leadcount=counts;
        return counts;
    }
    public List<Lead> getCurrentMonthInfo()
    {
        List<Lead> ll=Database.query('SELECT Id,Name,Division_Name__c,Title,counting__c '+ 'FROM Lead');
        return ll;
    }
}


I need to transfer count value from getCountings() to getCurrentMonthInfo() and retrieve count variable value in this, Could anyone can solve this plz??
public class ContactSearch 
{
    public static List<Contact> searchForContacts(String s1, String s2)
    {
        ContactSearch cs=new ContactSearch();
        List<String> s3=new List<String>{s1,s2};
        s3[0]=s1;
        s3[1]=s2;
        System.debug(s3);
        List<String> sr=new String[]{''+[SELECT LastName FROM Contact],''+[SELECT MailingPostalCode FROM Contact]};
        if(s1==s3[0] && s2==s3[1])
        {
            List<Contact> result=new List<Contact>();
            Contact[] query=[SELECT Id,FirstName,LastName FROM Contact WHERE LastName=:s1 AND MailingPostalCode=:s2];            
            System.debug(query);
        }
        List<Contact> result=new List<Contact>();
        return result;
      }
}


This is the code developed by me, it is running but unable to pass the trailhead challenge? 
In VF Page, I want these three fields ToAddress, Subject and Body.

I want to know how to integrate of this VF Page to the Email class file. 

If anyone have models, kindly let me know.

For HTML we do make file with .html
Like wise for visualforce?

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [ContactField__c]: [ContactField__c]


Getting above error..while submitting an assignment.
Question: Create a rollup summary field that determines the potential value of the opportunities associated with an account.
Initially I copied lead fields into lead custom fields after that I'm trying map Name and Email fields to Opportunity custom fields..

trigger mapping on Lead (after update) 
{
    Opportunity opp=new Opportunity();
    for(Lead ll:Trigger.New)
    {
        if(ll.isconverted==true)
        {
            opp.Client_Name__c=ll.Name;
            opp.Client_Email__c=ll.Email;
        }
        insert opp;
    }
}

This is working but opportunity fields not getting added. 
How can I retrieve object records using dot notation?
Please specify with examples for some standard or custom objects.
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Process failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, missing required field: [nextApproverIds]: [nextApproverIds].

Please help me to get out of it, everything I followed according to the question. But why it is showing like this?
Hi,
I'm uploading an image in Salesforce, where that field datatype is Text Area Rich, and I also gave that API name in Email  Template.

But when I ever send an email, attachment is not sending and only text is passing. So can anybody help regarding this. How to showcase my attachment image in sent email?
You can observe here, it is executing but not affecting any changes in the records, please help me out?

public class ramsBatchTownName implements Database.Batchable<sObject> {
    public String field;
    public String v1,v2,v3,v4,v5;
    public String query;
    public ramsBatchTownName(String q){
        field='Address__c';
        v1='KKM';
        v2='MDP';
        v3='NAND';
        v4='PLVD';
        v5='NO ADDRESS';
        query=q;
    }
    public Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator(query);
    }
    public void execute(Database.BatchableContext BC, List<Ram__c> batch){
        for(Ram__c rc:batch){
            if(rc.Districts__c=='Anantapur')
                rc.put(field,v1);
            else if(rc.Districts__c=='Chittor')
                rc.put(field,v2);
            else if(rc.Districts__c=='Kurnool')
                   rc.put(field,v3);
            else if(rc.Districts__c=='Kadapa')
                   rc.put(field,v4);
        }
        update batch;
    }
    public void finish(Database.BatchableContext BC){
        
    }
}
public with sharing class salescontroller 
{
    public string dat='this month';
   public Integer leadcount{ get; set; }
   
    public Integer getCountings()
    {
       Integer counts=[SELECT COUNT() FROM Lead];
       leadcount=counts;
        return counts;
    }
    public List<Lead> getCurrentMonthInfo()
    {
        List<Lead> ll=Database.query('SELECT Id,Name,Division_Name__c,Title,counting__c '+ 'FROM Lead');
        return ll;
    }
}


I need to transfer count value from getCountings() to getCurrentMonthInfo() and retrieve count variable value in this, Could anyone can solve this plz??
public class ContactSearch 
{
    public static List<Contact> searchForContacts(String s1, String s2)
    {
        ContactSearch cs=new ContactSearch();
        List<String> s3=new List<String>{s1,s2};
        s3[0]=s1;
        s3[1]=s2;
        System.debug(s3);
        List<String> sr=new String[]{''+[SELECT LastName FROM Contact],''+[SELECT MailingPostalCode FROM Contact]};
        if(s1==s3[0] && s2==s3[1])
        {
            List<Contact> result=new List<Contact>();
            Contact[] query=[SELECT Id,FirstName,LastName FROM Contact WHERE LastName=:s1 AND MailingPostalCode=:s2];            
            System.debug(query);
        }
        List<Contact> result=new List<Contact>();
        return result;
      }
}


This is the code developed by me, it is running but unable to pass the trailhead challenge? 

For HTML we do make file with .html
Like wise for visualforce?

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [ContactField__c]: [ContactField__c]


Getting above error..while submitting an assignment.
Question: Create a rollup summary field that determines the potential value of the opportunities associated with an account.
Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Process failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, missing required field: [nextApproverIds]: [nextApproverIds].

Please help me to get out of it, everything I followed according to the question. But why it is showing like this?
I have this very simple class..  
trigger RestrictContactByName on Contact (before insert, before update) {
    //check contacts prior to insert or update for invalid data
    For (Contact c : Trigger.New) {
        if(c.LastName == 'INVALIDNAME') {   //invalidname is invalid
            c.AddError('The Last Name "'+c.LastName+'" is not allowed for DML');
        }
    }
}
.. and the corresponding Test Class:  
@isTest
private class TestRestrictContactByName {

	@isTest static void metodoTest() {
		
		List listaContatti = new List();
		Contact c1 = new Contact(FirstName='Francesco', LastName='Riggio');
		Contact c2 = new Contact(LastName = 'INVALIDNAME');
		listaContatti.add(c1);
		listaContatti.add(c2);
		
		//insert listaContatti;
		
		// Perform test
        Test.startTest();
        Database.SaveResult [] result = Database.insert(listaContatti, false);
        Test.stopTest(); 
		
		c1.LastName = 'INVALIDNAME';
		update c1;
       		
	}
	
}

When I run the Test class from the Developer Console I get 100% of coverage on the RestrictContactByName class but, when I check the challenge on the trailhead it returns the error:

Challenge not yet complete... here's what's wrong: The 'RestrictContactByName' class did not achieve 100% code coverage via your test methods

Has someone had my same issue?