• Shubham Bansal 45
  • NEWBIE
  • 75 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 55
    Questions
  • 46
    Replies
I need to add "Printable View" Button to the Record page of Account object for only two Record types. If they click Printable view button it navigate to next tab and show the Account Detail Record as well as the related list records. Any suggestion would be helpful to implement this functonality. Thanks! 
Hello,
I have a trigger that if a email-to-case is created without a contact, a contact will be created and associated with that case based on the supplied email info.

I am just not a developer and have tried so hard to write a test class and not getting anywhere close. Please help I will never get this alone.

Here is my trigger:

trigger TriggertoCreateContactformCase on Case (before insert) {
    List<String> UseremailAddresses = new List<String>();
    //First exclude any cases where the contact is set
    for (Case c:Trigger.new) {
        if (c.ContactId==null &&
            c.SuppliedEmail!=''|| c.SuppliedEmail==null)
        {
            UseremailAddresses.add(c.SuppliedEmail);
        }
    }

    //Now we have a nice list of all the email addresses.  Let's query on it and see how many contacts already exist.
    List<Contact> listofallContacts = [Select Id,Email From Contact Where Email in:UseremailAddresses];
    Set<String> ExstingEmails = new Set<String>();
    for (Contact c:listofallContacts) {
        ExstingEmails.add(c.Email);
    }
    
    Map<String,Contact> emailToContactMap = new Map<String,Contact>();
    List<Case> casesToUpdate = new List<Case>();

    for (Case c:Trigger.new) {
        if (c.ContactId==null &&
            c.SuppliedName!=null &&
            c.SuppliedEmail!=null &&
            c.SuppliedName!='' &&
           !c.SuppliedName.contains('@') &&
            c.SuppliedEmail!='' &&
           !ExstingEmails.contains(c.SuppliedEmail))
        {
            //The case was created with a null contact
            //Let's make a contact for it
            String[] Emailheader = c.SuppliedName.split(' ',2);
            if (Emailheader.size() == 2)
            {
                Contact conts = new Contact(FirstName=Emailheader[0],
                                            LastName=Emailheader[1],
                                            Email=c.SuppliedEmail
                                            );
                emailToContactMap.put(c.SuppliedEmail,conts);
                casesToUpdate.add(c);
            }
        }
    }
    
    List<Contact> newContacts = emailToContactMap.values();
    insert newContacts;
    
    for (Case c:casesToUpdate) {
        Contact newContact = emailToContactMap.get(c.SuppliedEmail);
        
        c.ContactId = newContact.Id;
    }
}

My Test Class pitiful, please help:
@isTest
private class CreateContactTest{
    @isTest static void TriggertoCreateContactformCase () {
        Case c = new Case(c.ContactId=='';
            c.SuppliedName= 'Joan Ansderson';
            c.SuppliedEmail= 'Anderson@gmail.com';

         System.assertEquals(True, str.isSuccess());

    }

}
# create a map
chirutha          -     ramcharan
magadheer     -     ramcharan
orange            -     ramcharan
billa                 -     prabhas 
bhahuballi       -     prabhas 
mirchi              -     prabhas 

Data having be like
moviename    -    rating       -       collection 
chirutha          -     3             -       12cr
magadheer     -     4             -       75cr
orange            -     2             -       12cr
billa                 -     3             -       30cr
bhahuballi       -     4             -       1000cr
mirchi              -     4             -       50cr

# output will be like
   
Ramcharan acted in '3' movies .2 movies (chirutha , magadheera) hit with a collection of (12+75)=(87cr). 1 movie(orange) will be flop with the collection of (12cr).
# similar to the second one (prabahas)
hint : here movie rating between 1-2  declare as (flop), 3 will be declare as (average), 4& above will be declare as (hit)

 

 
Tryng to complete this module:

https://trailhead.salesforce.com/content/learn/projects/quick-start-build-a-workplace-command-center-app/set-up-your-developer-org

After create the my own dev org, there is a step:

2. In the Challenge section at the bottom of this page, select Log into a Developer Edition from the picklist.

I cannot fild the "Challenge section" mentioned above.

Can someone help?
Hi all I have a strange requirement of calling a helper method in which an apex method is calling, the trick is that I have to call my helper method with a delay of 30 sec. 

But in some scenarios before the 30 sec, my component  Dom is getting destroyed and in the helper, I face the error of set params of undefined.

I am not sure it is because Dom is destroyed or any other reason.
I have a requirement to run a run when chat with agent does not start successfully or either user cancel chat request.

is there any way to detect that chat is started or not . 
Can we get the object name along with other information of pre-chat form fields?

I have a custom field language present in contact and case both and I want to differentiate between them but the API name is also the same. 

Therefore I want the fields object names so that I can differentiate between them.
Any help is appreciated , Thanks in Advance
I have a package in my dev org and I want to upload that package on app exchange, can anyone help me thi by telling the steps of doing this
I have an email template and my requirement is that on my email there should be a more or less button which shows data.
When the user clicks on more the whole text should appear and when the user clicks on less then the partial text should appear.
I am using vf component in vf email template. but for the mobile view some UI issue occur,I try to use media query but id doesn't work, can anybody help in fixing this. 
Not able to see communities option in salesforce 30 days enterprise/trial version.

Can anybody tell why I am not able to see the communities option in the salesforce trail version?
Hi

I created a component for the Pre chat form and following the examples in the Developer Guide 18, it basically creates the inputs from the custom Pre chat form by collecting them as arrays. It all is inserted just fine in the pre chat form but, the values of the inputs, such as name, are assumed as valid when they are empty which should not be a valid input specially since they are "required" as part of their attributes.

I have been searching for a solution for this and the only solution that makes sence in my mind would be to add an external script that would validate the customer inputs, so in other words that script would be part of the Static Resources and I would call it with this method "embedded_svc.settings.externalScripts = ['validation']", although this script is being ignore for some reason and the custom"prechat.js" from Live agent keep giving me this message: Validation passed, firing chat request event.

Is there a better way to validate the inputs for them not to be empty before starting a live chat? Is there a particular reason as to why my script that is a Static Resource is being ignored?

Hi,

I was wondering where can I find or what is the object name that store all question posted () in community built on the Napili template?

I looked in Salesforce Question and Reply objects, but found nothing. 

User-added image

 

Thank you,

Pairin