• 20041 Points
  • Member since 

  • Chatter
  • 611
    Best Answers
  • 0
    Likes Received
  • 18
    Likes Given
  • 0
  • 5806
Hi All,
In Salesforce Lightning, do we have any option to remove/disable the Drilldown/View report hyper link on Dashboard?.

I have in place a custom preference / profile center built using a CloudPage. At the moment I am adding the link to the preference center using a AMPScript in the email template. This is what the AMPScript looks like and is entered into the 'href' attribute of the 'a' tag:

The main functionality I would like to achieve is to be able to provide link to an individual's preference cente via a link on a website. I already have in place a API connection to Marketing Cloud. I am be able to provide the respective subscriber key via the API.

My question is there a way to generate the full URL based on the AMPScript CloudPageURL somehow in Marketing Cloud without the need to send an email?
I have a error for finish excersice.

There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: ETLSLWHV

Can someone help me
Mirian Pilli


We are making the switch to Salesforce (from GoldMine) and we are working to implement a system that will automatically route phone calls to the appropriate trip adviser based on their destination specialization and phone availability status. This system will be looking at a custom field on a custom object we have (User Setting.user_status__c) to determine who is available. 

I have been searching to try and find anything that gives me an idea of how best to accomplish this, and I feel like all the pieces are there for me to do so (the UserPresence status, accessed by the embeddable widget, maybe using Salesforce's streaming api to push changes to RC widget and desktop application to update the HUD) but I don't know where to start in regards to having the RC embeddable listen to changes on a custom field in Salesforce. 

Is this possible? 

I am stuck in this step. My tests are running and I have 100% coverage, but there is something Trailhead is not liking. Do you know what can it be?

Here is my OrderTests class:
private class OrderTests {
    @testSetup static void SetupTestData(){

    @isTest static void OrderUpdate_UnitTest(){
        //retrieve the orders saved by TestDataFactory
        Map<Id, Order> orders= new Map<Id, Order>([SELECT Id, Status FROM Order]);
        //save the original Product2 record in a map
        Map<Id, Product2> originalProductMap = new Map<Id, Product2>();
        //Loop through a query of OrderItems related to the orders
        List<OrderItem> items = [SELECT Id, Product2Id, Product2.Quantity_Ordered__c, Quantity
                                 FROM OrderItem
                                 WHERE OrderId IN :orders.keySet()];
        //ToDo: Populate the map with the Id of the related Product2 as the key and Product2 record as the value
        for ( OrderItem oi : items){
            Product2 p = oi.Product2;
            if (!originalProductMap.containsKey(p.Id)) {
                originalProductMap.put(p.Id, p);
        //update the Status of the orders
        List<Order> updatedOrders = new List<Order>();
        for (Order order : orders.values()) {
            order.Status = Constants.ACTIVATED_ORDER_STATUS;
        //get the amounts to be order for each Product
        //declare a map to save the Amounts for each product
        Map<Id, Integer> prodAmounts = new Map<Id, Integer>();
        //get the aggregated amounts by product id
        AggregateResult[] groupedResults  = [SELECT Product2Id, SUM(Quantity) FROM OrderItem
                                             WHERE Product2Id IN :originalProductMap.keySet() 
                                             GROUP BY Product2Id];
        for (AggregateResult ar : groupedResults)  {
        //update the orders in the DB
        update updatedOrders;
        //retrieve the products affected by the orders update
        Map<Id, Product2> updatedProductMap = new Map<Id, Product2>([SELECT id, Quantity_Ordered__c 
                                                                     FROM Product2 WHERE
                                                                     id IN :originalProductMap.keySet()]);
        for (Product2 origProd : originalProductMap.values()) {
            TestDataFactory.VerifyQuantityOrdered(origProd,updatedProductMap.get(origProd.Id), prodAmounts.get(origProd.Id));


and my TestDataFactory
 * @name TestDataFactory
 * @description Contains methods to construct and/or validate commonly used records
public with sharing class TestDataFactory {

     * @name ConstructCollaborationGroup
     * @description
    public static CollaborationGroup ConstructCollaborationGroup(){
        //ToDo: Ensure this method returns a single Chatter CollaborationGroup
        //    whose Name starts with 'TEST' followed by the INVENTORY_ANNOUNCEMENTS constant
        //    and configured so anyone can join, see and post updates.
        return (new CollaborationGroup(Name = 'TEST' + Constants.INVENTORY_ANNOUNCEMENTS,
                                       CollaborationType = 'Public'));        

     * @name CreateProducts
     * @description Constructs a list of Product2 records for unit tests
    public static List<Product2> ConstructProducts(Integer cnt){
        for (Schema.PicklistEntry fam : Constants.PRODUCT_FAMILY){

        //ToDo: Ensure this method returns a list, of size cnt, of uniquely named Product2 records
        //  with all the required fields populated
        //  and IsActive = true
        //  an Initial Inventory set to 10
        //  and iterating through the product family picklist values throughout the list.
        List<Product2> products = new List<Product2>();
        Integer i = 0;
        for (Integer x = 0; x < cnt; x++ ){
            if (i > Constants.PRODUCT_FAMILY.size() -1 ) i = 0;            
            Product2 p = new Product2(Name = 'product' + x,
                                      Initial_Inventory__c = 10,
                                      IsActive = true,
                                      Family = Constants.PRODUCT_FAMILY[i].getLabel());
        return products;

     * @name CreatePricebookEntries
     * @description Constructs a list of PricebookEntry records for unit tests
    public static List<PricebookEntry> ConstructPricebookEntries(List<Product2> prods){

        //ToDo: Ensure this method returns a corresponding list of PricebookEntries records
        //  related to the provided Products
        //  with all the required fields populated
        //  and IsActive = true
        //  and belonging to the standard Pricebook
        List<PricebookEntry> pbentries = new List<PricebookEntry>();
        for (Product2 p : prods){
            PricebookEntry pb = new PricebookEntry(IsActive = true,
                                       UnitPrice = 10,
                                       Pricebook2Id = Constants.STANDARD_PRICEBOOK_ID,
                                       Product2Id = p.Id);
        return pbentries;

     * @name CreateAccounts
     * @description Constructs a list of Account records for unit tests
    public static List<Account> ConstructAccounts(Integer cnt){
        //ToDo: Ensure this method returns a list of size cnt of uniquely named Account records
        //  with all of the required fields populated.
        List<Account> accounts = new List<Account>();
        for (Integer x=0; x<cnt; x++) {
            Account acc = new Account(Name = 'account ' + x);
        return accounts;

     * @name CreateContacts
     * @description Constructs a list of Contacxt records for unit tests
    public static List<Contact> ConstructContacts(Integer cnt, List<Account> accts){
        //ToDo: Ensure this method returns a list, of size cnt, of uniquely named Contact records
        //  related to the provided Accounts
        //  with all of the required fields populated.
        List<Contact> contacts = new List<Contact>();
        Integer y = 0;
        for (Integer x = 0; x < cnt; x++){
            if (y > accts.size() - 1) y = 0;
            Contact c = new Contact(FirstName = 'cont'+y,
                                    LastName = 'Last ' + y,
                                    AccountId = accts[y].Id );
        return contacts;

     * @name CreateOrders
     * @description Constructs a list of Order records for unit tests
    public static List<Order> ConstructOrders(Integer cnt, List<Account> accts){
        //ToDo: Ensure this method returns a list of size cnt of uniquely named Order records
        //  related to the provided Accounts
        //  with all of the required fields populated.
        Integer y = 0;
        List<Order> orders = new List<Order>();
        for (Integer x = 0; x < cnt; x++) {
            if (! (y < accts.size())) y = 0;
            Order ord = new Order(AccountId = accts[y].Id,
                                  PriceBook2Id = Constants.STANDARD_PRICEBOOK_ID,
									Name = 'order '+ x,
                                    Status = Constants.DRAFT_ORDER_STATUS,
                                    EffectiveDate = date.today());
        return orders;

     * @name CreateOrderItems
     * @description Constructs a list of OrderItem records for unit tests
    public static List<OrderItem> ConstructOrderItems(integer cnt, list<pricebookentry> pbes, list<order> ords){
        //ToDo: Ensure this method returns a list of size cnt of OrderItem records
        //  related to the provided Pricebook Entries
        //  and related to the provided Orders
        //  with all of the required fields populated.
        //  Hint: Use the DEFAULT_ROWS constant for Quantity as it will be used in the next challenge
        List<OrderItem> orditems = new List<OrderItem>();
        Integer y = 0;
        for (Integer x = 0; x < cnt; x++) {
            if (y > pbes.size() - 1) y = 0;
            OrderItem oi = new OrderItem(OrderId = ords[y].Id,
                                            PricebookEntryId = pbes[y].Id,
                                            Quantity = Constants.DEFAULT_ROWS,
                                            UnitPrice = 1);
        return orditems;

     * @name SetupTestData
     * @description Inserts accounts, contacts, Products, PricebookEntries, Orders, and OrderItems.
    public static void InsertTestData(Integer cnt){
        //ToDo: Ensure this method calls each of the construct methods
        //  and inserts the results for use as test data.
        CollaborationGroup cg = ConstructCollaborationGroup();
        insert cg;
        system.debug('inserted CollaborationGroup');
        List<Product2> prods = ConstructProducts(cnt);
        insert prods;
        system.debug('inserted products');
        List<PricebookEntry> pbes = ConstructPricebookEntries(prods);
        try {
            insert pbes;
            system.debug('inserted PriceBookEntries');
        } catch (Exception e) {
            system.debug('exception: ' + e.getMessage());
        List<Account> accts = ConstructAccounts(cnt);
        insert accts;
        system.debug('inserted Accounts');
        List<Contact> conts = ConstructContacts(cnt, accts);
        insert conts;
        system.debug('inserted Contacts');
        List<Order> orders = ConstructOrders(cnt,accts);
        insert orders;
        system.debug('inserted orders');
        List<OrderItem> ordItems = ConstructOrderItems(cnt, pbes, orders);
        insert ordItems;
        system.debug('inserted OrderItems');
    public static void VerifyQuantityOrdered(Product2 originalProduct, Product2 updatedProduct, Integer qtyOrdered) {
        system.debug('Original Product.quantity = ' + originalProduct.Quantity_Ordered__c);
        system.debug('qtyOrdered = '+ qtyOrdered);
        system.debug('updated product.quantity = ' + updatedProduct.Quantity_Ordered__c);
        system.assertEquals(qtyOrdered, updatedProduct.Quantity_Ordered__c - originalProduct.Quantity_Ordered__c );


I am having issues with the week 1 Trailhead training ->Quick Start: Lightning Experience for Closers -> Hunt Your Prospect Project.  I am unable to convert the Lead to an Opportunity.  I keep getting the following message when I click Convert:
User-added imageIs anyone else having this issue?  I have gone through the steps as indicated in the directions and keep getting the same error message.  Please advise.
How to run a schedulable class every 1 min?
  • June 10, 2019
  • Like
  • 0
I'm using a lightning-datatable in LWC, and hooking into 'oncellchange' to ensure that any inline editing is automatically included in the underlying javascript data model immediately.

I then have another button 'Recalculate' that is not in the data-table, and this button will 'action' the change and perform some calculations elsewhere on page.

On click of the 'Recalculate' button, I would like the yellow highlights on the inline edited cells of the data-table to be cleared, but I can't work out how.  This is so the user can see that their changes have been applied.

Does anyone have any idea?
I am trying to verify my changes for the in the project  Create Reports and Dashboards for Sales and Marketing Managers (Visualize Your Data). I see the below error instead, the other challenges in the project worked fine. 

There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: VVGCJZDP
Please help! Hours of work doing this superbadge - then I get this error after successful completing about 30% of the challenge.

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: NGHFSZXZ
Hi Team, i'm doing the module Build a Discount Calculator in Step 4 and when I try to verify my challenge with a Trailhead playground I receive the next error:

There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: GJODIZOO
Error ID: RPAFOKOJ , Tried completing Visualize Your Data lesson from Create Reports and Dashboards for Sales and Marketing Managers Modules  in several different new enviroments. still getting the following error message with a changing error ID everytime: 

There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: FNJYPQBK
I have one too. I'm trying to complete the challenge for "Map Your Workflow Criteria to Process Criteria"

"There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: ZCMXATUO"

I can't move onto my next challenge without completeing this one:(
When are validation rules applied when using Salesforce for
Outlook? While saving the record or Every time data is synchronized with the server?


I can't add a field in work order report "Service Report language", Even it's added into report type layout.

Can anyone advise me how can i enable it's in report.

Hi all, 

Still get the error message of the challenge 3) Create Seed Bank Agencies: 
Challenge Not yet complete... here's what's wrong: 
We can't find Agency records in the Account object.

Tried to follow all the steps of other earlier questions, no success sofar. And start from scratch again Am i missing a step? 

Please help me! 
I'm getting an error on the Prepare Your Salesforce Org for Users badge in the Create Chatter Groups section.

I'm following the directions down to a T but I keep getting this: "Ensure that you are following all the instructions for posting to a Chatter group."

While trying to complete che challenge, the following message appear:

Step not yet complete in [my personal developer edition]
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: IZYHXZTM.

Can someone help me?Thanks.

Created a button under the contact object, while it appears in SF and works as expected, it does not appear in the partner community.

/{!$ObjectType.Account}/e?retURL= {!Account.Id}=RecordType=0121N000000qrnM&en)}
Step not yet complete in testpruthvi@gmail.com
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: KJQLXWTL
Hi All,

I am stuck with this code coverag issue for last 4 days. Its continuously flashing as :
User-added image
This coverage is of Sandbox org. In Production coverage is 86%.

Please help.
Hi all,

I am still stuck in this part of the module Aura Components Basics. I can not pass the challenge yet.
I have changed the code in campingList.cmp many times. This is the current version:
<aura:component controller="CampingListController">
    <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    <aura:handler name="addItem" event="c:addItemEvent" action="{!c.handleAddItem}"/>
    <div class="slds-page-header" role="banner">

      <div class="slds-grid">

        <div class="slds-col">

          <p class="slds-text-heading--label">Camping Items</p>

          <h1 class="slds-text-heading--medium">My Camping Items</h1>




  <div aria-labelledby="newitemform">

      <fieldset class="slds-box slds-theme--default slds-container--small">
        <c:campingListForm />

     <aura:attribute name="items" type="Camping_Item__c[]"/>

    <div class="slds-card slds-p-top--medium">
        <header class="slds-card__header">
            <h3 class="slds-text-heading--small">Camping List Items</h3>
        <section class="slds-card__body">
            <div id="list" class="row">
                <aura:iteration items="{!v.items}" var="campItem">
                    <c:campingListItem item="{!campItem}"/>


But I am getting the error:
The campingList component doesn't appear to have a Quantity input field in the form using a Lightning Base component

Did somebody pass currently this challenge?
Is it possible to get back the metadat of a deleted scratch org?
Guys I really need help with this.. I installed the security specialist package on my trailhead playground but when I go to test it in apex test execution it's not there
User-added image
I am not aware of the method how to permanently embed the subtitles in a video like they appear as its part. I don't want to create a separate SRT file and then import it to video. The subtitles should display along with the video, without adding any extra file. Is there any tool available that can create the subtitles. I also look for some specific subtitle builders and found this tool, but not fully aware of it. Please suggest a solution.

Hi! I am trying to upload an Atttachments based on the selection and criteria from Lightning Component that will be saved to Custom Setting.

For example, the criteria is Opportunity - Stage - Closed Won, I need to query to get all attachments from Closed Won Opportunity and upload them to AWS.

But I don't know how to do it dynamically, please help me.

User-added image

global class UploadAttachments implements Database.Batchable<sObject> {
    global Database.QueryLocator start(Database.BatchableContext BC) {
        String query = 'SELECT Id, Objects__c, Fields__c, Field_Value__c FROM ForUploadCustomSettings__c';
        return Database.getQueryLocator(query);

       global void execute(Database.BatchableContext BC, List<sObject> scope) {
        String formattedDateString = Datetime.now().format('EEE, dd MMM yyyy HH:mm:ss z');   
        String host = 's3.amazonaws.com';
        String method = 'PUT';
        HttpRequest req = new HttpRequest();
        Http http = new Http();
        Set<Id> Ids = new Set<Id>();
        for (sObject so : scope) {
        List<Attachment> att = [SELECT Id, Name, Body, ContentType FROM Attachment WHERE ParentId IN :Ids];
        List<AWScredentialsSettings__c> values = [SELECT Id, ClientKey__c, SecretKey__c, BucketName__c FROM AWScredentialsSettings__c LIMIT 1];
        if (!att.isEmpty() && !values.isEmpty()) {
            String bucketname = values[0].BucketName__c;
            String key = values[0].ClientKey__c;
            String secret = values[0].SecretKey__c;
            String attachmentBody = EncodingUtil.base64Encode(att[0].Body);
            String filename = att[0].Name;
            req.setEndpoint('https://' + host + '/' + bucketname + '/' + filename); // The file should be uploaded to this path in AWS -- ObjectName/Salesforce Id/Secret Files/filename
            req.setHeader('Content-Length', String.valueOf(attachmentBody.length()));
            req.setHeader('Content-Encoding', 'UTF-8');
            req.setHeader('Content-type', att[0].ContentType);
            req.setHeader('Connection', 'keep-alive');
            req.setHeader('Date', formattedDateString);
            req.setHeader('ACL', 'public-read');
            String stringToSign = method+'\n\n\n'+ att[0].ContentType + '\n' + formattedDateString +'\n/'+ bucketname +'/' + filename;
            Blob mac = Crypto.generateMac('HMACSHA1', blob.valueof(stringToSign),blob.valueof(secret));
            String signed  = EncodingUtil.base64Encode(mac);
            String authHeader = 'AWS' + ' ' + secret + ':' + signed;
            HTTPResponse res = http.send(req);
            System.debug('*Resp:' + String.ValueOF(res.getBody()));
            System.debug('RESPONSE STRING: ' + res.toString());
            System.debug('RESPONSE STATUS: ' + res.getStatus());
            System.debug('STATUS_CODE: ' + res.getStatusCode());
    global void finish(Database.BatchableContext BC) {

How can we make inline edit form features for relational record in the lightning datatable?
Below is the current code, and I would like to you to correct this code to achive inline edit for relational reocrd.

<lightning:datatable columns="{!v.columns}"

var columns = [
            {label:'product code', fieldName:'prod_code', type:'STRING', editable:true},
            {label:'product name', fieldName:'prod_name', type:'STRING'}, editable:true},
            {label:'employee name', fieldName:'emp_name', type:'url', editable:true, typeAttributes:{label:{fieldName: "emp_name"}}}
//please assume that employee name is the relational record with a parent object.
//and other two records are the normal records.
component.set("v.columns", columns);

 var data = [
            {prod_code:"001K89", prod_name:"product A", emp_name:{Name:"employee A"}}
component.set("v.data", data);

By this code something like this picture is shown and cannot edit relational record.
User-added image

I would like to make inline edit like attached.

User-added imageThnak you in advance.

Can anyone pls help me with this
I have the following requirment and not sure how to write the formula(criteria):
email alert should be sent to the opp owner when the Opp is in the Feature Fit Stage, or subsequent stages when Feature Fit stage is skipped; but NOT firing multiple times (multiple times meaning: email alert should not be triggered again when the owner recieved it already on feature/ fit stage, if the feature/fit stage us skipped then the rule should fire for any subsequent stages)

Hi All,
In Salesforce Lightning, do we have any option to remove/disable the Drilldown/View report hyper link on Dashboard?.

I have a Batch class that I am trying to debug and everytime I place a line of
System.Debug('Last Run Date'+LRDate);
System.Debug('query'+ qry);
I get the following errors:
Invalid constructor name: System.debug

Please help me with what I a missing. Never run into this problem before.
I have a Apex Trigger on creation of a record that calls an Apex class. The point of a method in the class is to check the current time of user and see if it is within business hours.

However, I want to display a toast (Either a warning or danger) if the user tries to input time outside of business hours. Is this possible?

Apex Code:
if (userTime > endTime && userTime < startTime)
    System.debug('YOU ARE OUT OF HOURS');
    //This is where I would like to call a toast

I have created toasts within lightning components and javascript controllers, but is it possible to do call the toast here? If so, how?
I have a scenario, where when case is created and auto-generated email is sent to customer that our agent will get back to in some time. Now if customer replies to email , those emails are not coming to salesforce and hence not getting attached to the respective case. Please help in capturing customer's reply as this is important.
Hello all,

I am in the process of migrating from desk.com to service cloud and had a question.  During the migration the desk migration wizard stopped working.  My team and I think it is becase of custom domain we started to roll out but have not yet applied to all users.  I was wondering two things,
1. How is the desk migration wizard related to my salesforce org?

2. Will changing the username of the account associated with the org break everything?

Thanks for any help.
I have an invoice payment child object related to the parent invoice object. I created a trigger on the child, that updates the payment date on the invoice when the full payment is posted. There is a status formula field on the invoice that updates to "PAID" when the balance on the invoice is equal to zero. It doesn't get updated to "PAID" until after the invoice payment record is saved so I think that is causing my trigger to not work and update the payment field. Does anyone have any suggestions on how I can go about this? Thanks!
trigger Update_Payment_Date on gii__ARInvoicePayment__c (after insert, after update) {
    List<gii__OrderInvoice__c>lstInvoiceToUpdate = new List<gii__OrderInvoice__c>();
    for(gii__ARInvoicePayment__c pmt:trigger.new)
        if (pmt.gii__PaymentDate__c != null && pmt.Invoice_Status__c == 'PAID')
            lstInvoiceToUpdate.add(new gii__OrderInvoice__c(Id = pmt.gii__Invoice__c, Paid_Date__c = pmt.gii__PaymentDate__c, gii__PaymentDate__c = pmt.gii__PaymentDate__c));
    update lstInvoiceToUpdate;

Hello Friends,

I have a requirement to get child records and display in VF page and update all records when they click save button, could you please send me the link or sample code if there is one?

VF page
checkbox   Field1   Field2   Field3 Field4
  -                      -       -           -          -
  -                      -        -          -          -
                 Save Button

If they click save button all selected checkbox records should be updated via Apex controller or Javascript function.

I am able to get the records to VF page but I couldnt get the selected record ID and pass it to controller

Any help on this really appreciate.

I created a "contacted" custom field that will say yes or no if a call is more than/less than 2 minutes. However, this field is in the Activities since call duration is there and call duration was the basis of the formula field for "contacted." The challenge is I need to bring this "contacted" field under Lead details but I cannot create a custom field since it will have syntax error: check spelling because call duration is not a field in Lead. How can I achieve this? Any ideas? 
I have a lookup relationship between Order Line and Contact Objects where Contact is the parent. I am writing a batch class which looks for certain criteria on Order Line and send email to Contacts excluding the duplicates. 

Right now I have  2 duplicate Order Lines for the Contact and the batch is supposed to send 1 email. But in this code, there are 3 emails sent out. Can someone help with this?
global class BatchSendEmails implements Database.Batchable<SObject>
global Database.QueryLocator start(Database.BatchableContext BC){
	return Database.getQueryLocator([select id,Contact__r.Email,Contact__c,Account__c from Order_Line__c 
                                     where Order__r.OrderApi__Date__c = LAST_N_DAYS:3]);
    global void execute (Database.BatchableContext BC, List<Order_Line__c> scope){
         List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
                                 List<String> email = new List<String>(); 
       List<Order_Line__c> sollist = [SELECT Id, Item__c, Contact__c,Order__c ,Contact__r.Email FROM Order_Line__c
        WHERE Order__r.Date__c = LAST_N_DAYS:3 AND Item__r.Name = 'Test'];
        Set<Id> solids = new Set<Id>();
        for(Order_Line__c ol : ollist){
            if(ol.id != null){
                system.debug('Added Contacts'+olids);
        AggregateResult[] groupedResults = [
        SELECT COUNT(Id) dups, Item__c, Contact__c,Order__c,Contact__r.Email
        FROM Order_Line__c
        WHERE Contact__c =:solids and Sales_Order__r.Date__c = LAST_N_DAYS:3 
        AND Item__r.Name = 'Test'    
        GROUP BY Item__c,Contact__c,Contact__r.Email,Order__c
         HAVING COUNT(Id) = 1];

        for(AggregateResult ar:groupedResults){
            String custid = (ID)ar.get('OrderApi__Contact__c');
          //	email.add(custid);
        List<Order_Line__c> sollist1 = [select id, Contact__r.Email,Order__c from Order_Line__c where id=: ar.Id limit 1];
                email.add(ollist[0].OrderApi__Contact__r.Email); */
                                 List<String> ccemail = new List<String>();                                 
    							 Contact c = [select id, Email from Contact where email <> null limit 1];
EmailTemplate templateId = [Select id from EmailTemplate where name = 'Email'];                                                   
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                 OrgWideEmailAddress owa = [select id, DisplayName, Address from OrgWideEmailAddress where address = 'testing@test.org' limit 1];
            }catch(Exception e){
                system.debug('Exception occured' +e);
    global void finish(Database.BatchableContext BC){

  • November 28, 2018
  • Like
  • 1

I previously had a Developer Account where I added an app (+- 6 months ago)

Now, when I try to log in on that account, it does not recognize me.
I tried to change my password. Salesforce says it sent me an email but it never arrives
I need to get the account back because all the work has already been done

It was a connected app

I had to create a new account under a different name just to be able to post here

Please help!

Apex class :-

    global class BlockIEPolicyCondition implements TxnSecurity.PolicyCondition {
     public boolean evaluate(TxnSecurity.Event e) {
      List<User> users = [SELECT ProfileId FROM User WHERE Id = :e.UserId];
            String profileId = (String)users.get(0).get('ProfileId');
            List<Profile> profiles = [SELECT Name FROM Profile WHERE Id = :profileId];
            String profileName = (String)profiles.get(0).get('Name');
            LoginHistory eObj = [SELECT Browser FROM LoginHistory WHERE Id = :e.data.get('LoginHistoryId')];
            string profileName1 = '"' +profileName + '"';
            String P=system.label.BlockIEPolicyProfile;
    Boolean ismatch = p.contains(profileName1);
      if(eObj.Browser == 'IE 11' || eObj.Browser == 'IE 10' || eObj.Browser == 'IE 9' || eObj.Browser == 'IE 8') {
       return true;
     return false; 
I want to achieve one requirement that when Manager A logs in to his Org, then he should see only employees under him not under any other manager using lookup. Can someone help me to achieve it?
Trying to test the App in Salesforce1 - When I click "App Launcher" and then Salesforce.com I get this error message: Python 2.5 is no longer available. Please refer to https://goo.gl/aESk5L for more information. 

Please help so I can move forward. Thank you!
I would like to connect my org to the external data using OData 4.0. I have been configured the External Data Source and automatically create External Object.
But there is a problem when creating record in the external object. After save button clicked, then error dialog appears, see image below:
User-added image
Actually the data that I inserted was successfully created, but I still meet this error.
FYI, I have been configured the primary key on OData configuration and MySQL database.
  • September 18, 2017
  • Like
  • 1
I have a custom object called 'Class_Allocation__c' and have a lookup field on this object called 'Related_Contact__c.  I need expert help to write a trigger on Class_Allocation__c to auto copy the contact Id into this field based on 'Student__Name__c' field on Class_Allocation__C and Student_id_from_Student_object__c (on contact)
  • September 15, 2017
  • Like
  • 1
Hello All,
I need to be able to update an Azure database from Salesforce.  Mainly for Cases and Lawyers, when cases or lawyers get updated I need to update the Azure DB as well.
I have seen the examples that talk about Azure to Salesforce, but I have not seen anything talking about Salesforce to Azure.
I have looked at both the Salesforce WCF and RestAPI https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/
But again these go from Azure to Salesforce.

Is it possible to go the other way?  What would be the best approch to this as I have seen many differnt approches to connecting.
We don't want any syncing of data, just to make a .NET call when Salesforce records get updates ect.. to update our Azure DB.
I am a brand new admin and I know nothing about the admin side of SalesForce.  Can someone explain to me how I can check if my org is using a single sign-on or HTTPS call outs?   I need to know if the default certificate retirement on 8/7/17 will affect my org before 8/7/17.   I've been reading about it but none of it makes sense to me.
when I was installing an app from appexchange, I got the oauth error. My account is the type of 30-day-free. 

Error code : 1800。

who can help me?
  • May 17, 2017
  • Like
  • 1
I have following scenario and want to set up partner community license.

1. Have profile Customer service rep.
2. He has access to only Order object.

i know we need to set Account as partner and then contacts need to be enabled as partner and then create user and assign the partner community profile.
But if i have no.of users and want to assign them Partner Community License  and Customer service repprofile, how i should proceed to implement this?

Could you please suggest?
I found an error in a Trailhead, thought I'd help anyone else with the same problem. While trying to solve the Using Events to Add Markers to the Map section of the Build an Account Geolocation App trailhead I kept receiving an error about a null value. Debugging the code I found that the map variable in AccountMapController.js was null. This is because the accounts were loading faster than the Leaflet.js libraries. To get around this I changed the accountsLoaded function to recursively check if the map existed only add markers once the map was an object:

   if(component.get("v.map") != null){
            var map = component.get("v.map");

            var accounts = event.getParam("accounts");
            for (var i=0; i<accounts.length; i++) {
                var account = accounts[i];
                var latLng = [account.Location__Latitude__s, account.Location__Longitude__s];
                L.marker(latLng, {account: account}).addTo(map);
            accountsLoaded(component, event, null); 


I am creating my first visualforce email. 

I am trying to list the Opportuntiy; owner, contact roles, and  opportuntiy team all on email template. I been able to figure out how to add the opportunity contact roles but I can't figure out how to add the Opportuntiy Owner and Opportuntiy team through the email code. 

Please see my visualforce code below. Thanks in Advance! 

<messaging:emailTemplate subject="Testing VF" recipientType="User" relatedToType="Opportunity">
<messaging:plainTextEmailBody >
This is testing the text section....
Opportunity Name: {!Relatedto.name}
Account: {!Relatedto.account.name}
Amount: {!Relatedto.amount}
Contact Roles for this Opportunity:
<apex:repeat value="{!RelatedTo.OpportunityContactRoles}" var="ContactRole">
{!ContactRole.Contact.Name} {!ContactRole.Contact.Email}
<apex:repeat var="team" value="{!relatedTo.opportunityteammembers}">


Hello Experts,

I have created excel workbook with help of VF page & XML Spreadsheet Reference. However I am not able to insert the company's logo in the first sheet. Can any one please suggest me how to insert an image in the sheet. Below is the VF code :

<apex:page controller="XYZ_controller" sidebar="false" showHeader="false"  contentType="application/vnd.ms-excel#{!object.Name__c}_Bid_Preview.xls" cache="true" action="{!changeProposalStatus}">
    <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
        <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
        <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">

<Worksheet ss:Name="Cover">
  <Column ss:Width="70" ss:StyleId="s_plain"/>
  <Column ss:Width="100" ss:StyleId="s_plain"/>
  <Column ss:Width="100" ss:StyleId="s_plain"/>
  <Column ss:Width="250" ss:StyleId="s_plain"/>

        <Cell  ss:Index="2" ss:StyleID="s9_confidential" ss:MergeAcross="3"><Data ss:Type="String">CONFIDENTIAL</Data></Cell>
<I NEED TO INSERT AN IMAGE HERE i.e COMPANY'S LOGO> (For testing, any logo will do)

<Row ss:AutoFitHeight="1">
        <Cell  ss:Index="2" ss:StyleID="s_cover_heading" ss:MergeAcross="3"><Data ss:Type="String">Test Data</Data></Cell>
        <Cell  ss:Index="2" ss:StyleID="s_cover_heading_lab" ss:MergeAcross="3"><Data ss:Type="String">Test Data</Data></Cell>
I request your swift support and help on this. Your efforts would be greatly appreciated. Thanks in advance...!!
  • July 21, 2016
  • Like
  • 1