• Sunny S
  • NEWBIE
  • 35 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 8
    Replies
Hi community friends, need some help please !

Overview:
We are getting some Person Accounts to flow into SalesCloud from one of the external systems (Dynamics 365).

We are than using Process Builder to auto create “Leads” for these accounts (for reporting and marketing perspective) – PB seems to be working correctly fine here;

Requirement:
1: We want to automate these Leads (just these ones) to close as  ‘Converted’ upon creation; plus if possible

2: Have the opportunities to get auto created and close as ‘Closed – Won’ upon creation  – without creating an account (as the account already exists)

I am been trying to use a combination of the following Apex class and Trigger, but seems is not working as desired…. Would anyone be able to help me with this issue please ?

Apex Trigger:
Trigger AutoConvertLead on Lead(After Insert)
{
   For(Lead ld : trigger.new){
        //  calling apex class method to convert this lead
  AutoConvertLead.leadconversion(ld.id)
 }
    }

Apex Class:
Public class AutoConvertLead(){
     public static void leadConversion(string leadid){
        Database.LeadConvert Leadconvert = new Database.LeadConvert();
           // pass the leadId which need to be converted
        Leadconvert.setLeadId(leadid);
   LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
       Leadconvert.setConvertedStatus(convertStatus.MasterLabel);
        Leadconvert.setCreateOpportunity(True);
Database.LeadConvertResult Leadconverts = Database.convertLead(Leadconvert);
System.assert(Leadconverts.isSuccess());
}
}


Thanks and regards,
Sunny


 
Hi dear members, need some advice please!

We are sending out a survey to our customers through Marketing Cloud system. (survey was itself created in SFMC)
Once a customer submits a survey, response gets recorded in SalesCloud Survey object 'Survey_Submission__c'. An auto Email then goes out to these customer from SalesCloud containing the same 'Survey URL' allowing them to change their responses if they wish to do so. 
Below is the Visualforce email template that we are using.

Issuse: How can i pass the customer name / Custome ID within this email template, so that if a customer clicks on the survey url, the system recognises the contact and makes the changes for that specific record in SalesCloud.


<messaging:emailTemplate subject="Survey Submission Email Notification : {!recipient.Firstname} {!recipient.Lastname}" recipientType="Contact" relatedToType="Survey_Submission__c">
<messaging:htmlEmailBody >

<img src= "https://companyname--uat--c.cs104.content.force.com/servlet/servlet.ImageServer?id=015200000HS2h&oid=00DN00008qOQ&lastMod=15827213900"/> <br/> <br/> <br/>

<p style="color:#2325C5">
Dear <b>{!recipient.Firstname} {!recipient.Lastname}</b>, <br/> <br/>

Congratulations, you have successfully submitted your survey
Please click on the below URL if you wish to change any of your survey responses.

<a href="https://www.survey_url_would_be_added_here.com/331578514d47s.pub.s.10.sfmc.content.com/i34gdhup?" > SURVEY_ID= "{!Survey_Submission__c.ContactId__c}" Change your submission here </a>

Regards, <br/>
Team XYZ
</p>
</messaging:htmlEmailBody>
</messaging:emailTemplate>

Kind regards!
Hi members, need help !

I am trying to create a Trigger (on Lead object) for Email Alert based on the Username. In the sense-  whenever a user deletes a lead record, an email should go out the the manager.... but getting across the below error. 
Can someone please rectify my Trigger and suggest that wrong am i doing here ?

*** TRIGGER***

trigger EmailAfterDeleteLead on Lead(after delete) {
    Messaging.reserveSingleEmailCapacity(trigger.size);
        List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();
            for (Lead lead : Trigger.old) { 
                Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
                    if (userInfo.LastName=='Event Catering' && userInfo.LastName=='General Catering'){
                        email.setToAddresses(new String[] {'Manager@Functions.com'});
                        }
                        Else {
                    email.setToAddresses(new String[] {'Administrator@Functions.com'});
                email.setSubject('Deleted Lead Alert');
            email.setPlainTextBody('Dear Manager,' +'\n'+ 'This message is an alert that the following lead has been deleted from Salesforce by *** ' + UserInfo.getFirstName() + ' ' + UserInfo.getLastName() + '***. You can restore the deleted lead from recycle bin within 15 days ' + '\n \n'
        + 'Lead Name: ' + lead.FirstName + ' ' + lead.LastName + '\n'
        + 'Lead Email: ' + lead.Email + '\n'
        + 'Lead Status: ' + lead.Status + '\n'       
        + 'Lead Id: ' + lead.Id + '\n\n'
        + 'Current Salesforce User Name: ' + UserInfo.getFirstName() + ' ' + UserInfo.getLastName() +  '\n\n\n\n\n'
        );
        emails.add(email);
        }
        
    }
    Messaging.sendEmail(emails);

}

============================

User-added image
Hi Members, need help !

We have 3 objects as : 1- Event , 2- Invite and 3- Contacts (standard). 'Invite' is the Junction object between 'Event' and 'Contacts'.

Once and Event is created, we need to send out the Invites to our customer. For that we are building a Visualforce Page on 'Invite' object in order to capture this VFP inside the Invitation email.

Requiremrnt 1: How can we include a VFP inside a Visualforve Email template?
Requiremrnt 2: How can we send multiple Invites for an Event with a Single email, single click?
Requiremrnt 3: Is it possible to capture the customer response as 'Yes, No' directly onto the Invite object (for the particular event) on the basis of their input on the attached Visualforce page (inside the email)

Its like: An Event is created, an Invite email goes out to the customers, customer replies on the Invite email as: Yes, No and the response gets recorded against the respective event for that customer?

My visual page is also throwing an error !!

I am falling short of ideas here. Any help would be greatly appreciated... Thanks !

User-added image

 
Hi friends, need very very urgent help please !

Requirement: 
Is there a way to automate email notification alert to get triggered for user who have not logged in for past 20 days?

Basically, an email should automatically get fired to notify users about being not logging in for XYZ days.

I tried working with WFR and PB but failed to get over, as there won't be any action on these user accounts to trigger the automation.

I am sure that this could be acheived using Apex, but my lack of experince with coding is the biggest hurdle. 

Can anyone please please help me in getting this sorted step by step please, as this has come up as a very urgent piece of work, and failing to do this could get me fired.

Thanks in advance !
Hi all,
Need help. I am still a novice with Development, hence would need someone to please help me with the below query.

Background: We are having a custom object as 'Survey', which is having around 10-12 fields (combination of Text and picklist field).

Use of the Object: The fields in this object 'Survey' are getting populated dynamically - through AMP Script from Marketing Cloud. As these surveys are sent to customers through Marketing Cloud emails, and whatever input the customer add on the Survey Cloud Page, it automatically gets recorded under same name fields in Sales Cloud object.

Requirement: We want to send an 'Email Notification' to the Manager, each time a survey gets recorded in the Sales Cloud Object 'Survey' object.
Also, the Notification Email should display the 'Customer Name' 'Email' &  'Answers to all the questions of the Survey'.

I am not too sure how to achieve this using Apex and Trigger ?
Can someone please help me with this and explain the steps in basic language.

Thanks in advance !
Hi community friends, need some help please !

Overview:
We are getting some Person Accounts to flow into SalesCloud from one of the external systems (Dynamics 365).

We are than using Process Builder to auto create “Leads” for these accounts (for reporting and marketing perspective) – PB seems to be working correctly fine here;

Requirement:
1: We want to automate these Leads (just these ones) to close as  ‘Converted’ upon creation; plus if possible

2: Have the opportunities to get auto created and close as ‘Closed – Won’ upon creation  – without creating an account (as the account already exists)

I am been trying to use a combination of the following Apex class and Trigger, but seems is not working as desired…. Would anyone be able to help me with this issue please ?

Apex Trigger:
Trigger AutoConvertLead on Lead(After Insert)
{
   For(Lead ld : trigger.new){
        //  calling apex class method to convert this lead
  AutoConvertLead.leadconversion(ld.id)
 }
    }

Apex Class:
Public class AutoConvertLead(){
     public static void leadConversion(string leadid){
        Database.LeadConvert Leadconvert = new Database.LeadConvert();
           // pass the leadId which need to be converted
        Leadconvert.setLeadId(leadid);
   LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
       Leadconvert.setConvertedStatus(convertStatus.MasterLabel);
        Leadconvert.setCreateOpportunity(True);
Database.LeadConvertResult Leadconverts = Database.convertLead(Leadconvert);
System.assert(Leadconverts.isSuccess());
}
}


Thanks and regards,
Sunny


 
Hi members, need help !

I am trying to create a Trigger (on Lead object) for Email Alert based on the Username. In the sense-  whenever a user deletes a lead record, an email should go out the the manager.... but getting across the below error. 
Can someone please rectify my Trigger and suggest that wrong am i doing here ?

*** TRIGGER***

trigger EmailAfterDeleteLead on Lead(after delete) {
    Messaging.reserveSingleEmailCapacity(trigger.size);
        List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();
            for (Lead lead : Trigger.old) { 
                Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
                    if (userInfo.LastName=='Event Catering' && userInfo.LastName=='General Catering'){
                        email.setToAddresses(new String[] {'Manager@Functions.com'});
                        }
                        Else {
                    email.setToAddresses(new String[] {'Administrator@Functions.com'});
                email.setSubject('Deleted Lead Alert');
            email.setPlainTextBody('Dear Manager,' +'\n'+ 'This message is an alert that the following lead has been deleted from Salesforce by *** ' + UserInfo.getFirstName() + ' ' + UserInfo.getLastName() + '***. You can restore the deleted lead from recycle bin within 15 days ' + '\n \n'
        + 'Lead Name: ' + lead.FirstName + ' ' + lead.LastName + '\n'
        + 'Lead Email: ' + lead.Email + '\n'
        + 'Lead Status: ' + lead.Status + '\n'       
        + 'Lead Id: ' + lead.Id + '\n\n'
        + 'Current Salesforce User Name: ' + UserInfo.getFirstName() + ' ' + UserInfo.getLastName() +  '\n\n\n\n\n'
        );
        emails.add(email);
        }
        
    }
    Messaging.sendEmail(emails);

}

============================

User-added image
Hi friends, need very very urgent help please !

Requirement: 
Is there a way to automate email notification alert to get triggered for user who have not logged in for past 20 days?

Basically, an email should automatically get fired to notify users about being not logging in for XYZ days.

I tried working with WFR and PB but failed to get over, as there won't be any action on these user accounts to trigger the automation.

I am sure that this could be acheived using Apex, but my lack of experince with coding is the biggest hurdle. 

Can anyone please please help me in getting this sorted step by step please, as this has come up as a very urgent piece of work, and failing to do this could get me fired.

Thanks in advance !
Hi all,
Need help. I am still a novice with Development, hence would need someone to please help me with the below query.

Background: We are having a custom object as 'Survey', which is having around 10-12 fields (combination of Text and picklist field).

Use of the Object: The fields in this object 'Survey' are getting populated dynamically - through AMP Script from Marketing Cloud. As these surveys are sent to customers through Marketing Cloud emails, and whatever input the customer add on the Survey Cloud Page, it automatically gets recorded under same name fields in Sales Cloud object.

Requirement: We want to send an 'Email Notification' to the Manager, each time a survey gets recorded in the Sales Cloud Object 'Survey' object.
Also, the Notification Email should display the 'Customer Name' 'Email' &  'Answers to all the questions of the Survey'.

I am not too sure how to achieve this using Apex and Trigger ?
Can someone please help me with this and explain the steps in basic language.

Thanks in advance !