• Zuinglio Lopes Ribeiro Júnior
  • PRO
  • 2425 Points
  • Member since 2014
  • Mr
  • VASS


  • Chatter
    Feed
  • 75
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 342
    Replies
Help on passing test class.  I just need 5 lines more.  it's at 67%  The class is long I only added what's red and not passing.
 
public void send() {
        try {
            DM_Public_Page_URL__c siteCS = DM_Public_Page_URL__c.getValues('Default');
            String siteURL = siteCS.Site_URL__c;
            String logo = siteCS.Logo__c;
            
            List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
            EmailTemplate emailT = [select Subject, HtmlValue from EmailTemplate where DeveloperName = 'Contact_Form' limit 1];
            
            for(Contact primaryContact : primaryContactList) {
                String body = emailT.HtmlValue.replace('{account_form}', siteURL + '/apex/AccountFormPage?id=' + accountId);
                body = body.replace('{primary_contact_name}', primaryContact.FirstName);
                body = body.replace('{account_name}', accountName);
               body = body.replace('{account_logo}', '<img src="'+siteURL + Logo+'"alt="Logo" height="225px" width="74px"');
                
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                mail.setToAddresses(new String[]{primaryContact.Email});
                mail.setSubject(emailT.Subject);
                mail.setHtmlBody(body);
                mails.add(mail);
            }
            
            List<Messaging.SendEmailResult> results = Messaging.sendEmail(mails);
            if(results[0].isSuccess()) {
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM, 'Contact email successfully sent'));
            } else {
                System.debug('------------------- errors: ' + results[0].getErrors());
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error while sending the contact update email: ' + results[0].getErrors()));
            }
        } catch(Exception e) {
            System.debug('------------------- ERROR: ' + e.getStackTraceString());
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error while sending the contact update email: ' + e.getStackTraceString()));
            
        }
    }
    
    public PageReference cancel() {
        PageReference pref = new PageReference('/' + accountId);
        return pref;
    }
}


This is my test class

@isTest
private class AccountFormControllerTest {

    private static testMethod void test() {
        Account lender = new Account();
        lender.Name = 'Test Account';
        insert lender;
        System.debug('created account');
        
        Contact c = new contact();
        c.FirstName = 'JOhn';
        c.LastName = 'Doe';
        c.email='test@test.com';
        c.primary_contact__c = True;
        insert c;
        System.debug('created account');
                
        ApexPages.currentPage().getParameters().put('id', lender.Id);
        AccountFormController controller = new AccountFormController();
        controller.accountUpdate.Equity_Debt__c = 'Debt';
        controller.save();
        
        string options = controller.getOptions();
    }
    
    private static testMethod void test2() {
        Contact ca = new Contact();
            ca.FirstName = 'John';
            ca.LastName = 'Doe';
            ca.email='test@test.com';
            ca.Primary_Contact__c = true;
    
        ApexPages.currentPage().getParameters().put('id', 'some id');
        AccountFormController controller = new AccountFormController();
        controller.save();
        
        AccountFormController controller2 = new AccountFormController();
        controller2.save();
        
        ApexPages.currentPage().getParameters().put('id', '');
        AccountFormController controller3 = new AccountFormController();
        controller3.save();
        
        try{
        Insert ca;
        }
        catch(Exception ee){
        }   
    }
    
}
This is whats not passing...
 
String body = emailT.HtmlValue.replace('{account_form}', siteURL + '/apex/AccountFormPage?id=' + accountId);
                body = body.replace('{primary_contact_name}', primaryContact.FirstName);
                body = body.replace('{account_name}', accountName);
               body = body.replace('{account_logo}', '<img src="'+siteURL + Logo+'"alt="Logo" height="225px" width="74px"');
                
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                mail.setToAddresses(new String[]{primaryContact.Email});
                mail.setSubject(emailT.Subject);
                mail.setHtmlBody(body);
                mails.add(mail);
            }

 
Hello,

I currently have a Data table that is only taking up half the width of the page. I was wondering how I can extend the width of the table to cover the full width of the vf page

I have tried to add the "slds-size--1-of-1" to the table class but either that is wrong or i am doing something wrong

Below is a photo of the table(s) and my code 

User-added image
 
<apex:page standardcontroller="X2067__c" showHeader="false" standardStylesheets="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0">
<head>
  <!-- Import the Design System style sheet -->
  <apex:slds />
</head>
    <body class="slds-scope">        
        <div class="slds-grid slds-grid_vertical-align-end slds-grid_align-spread" style="height:100px">
            <div class="slds-col slds-p-horizontal_medium">
                <span><apex:image url="/servlet/servlet.FileDownload?file=0152F0000000YbI" width="256" height="150"/> </span>
            </div>
            <div class="slds-col slds-text-heading_large slds-text-align_center">
                <span>Case Information</span>
            </div>
            <div class="slds-col slds-p-horizontal_medium slds-text-heading_medium slds-text-align_right">
                <span>Form 2068<br></br>December 2012-E</span>
        </div>        
    </div>

  <!-- REQUIRED SLDS WRAPPER -->
  <div class="slds-scope" style="float:Left; position:absolute;">
    <!-- MASTHEAD -->
      <br></br>
    <p class="slds-text-heading--label slds-m-bottom--small">
      To:  
        </p>
        <apex:outputField value="{!X2067__c.Payer_Name__c}"/><br/>
    	<apex:outputField value="{!X2067__c.Payer_Fax_Number__c}"/>
      <br></br>  <br></br>  <br></br>
    <div class="slds-scope" style="float:Left; position:absolute;">  
<table class="slds-table slds-table_bordered slds-table_cell-buffer">
  <thead>
    <tr class="slds-text-title_caps">
      <th scope="col">
        <div class="slds-truncate" title="Case Name">Case Name</div>
      </th>
      <th scope="col">
        <div class="slds-truncate" title="Category 1">Category</div>
      </th>
      <th scope="col">
        <div class="slds-truncate" title="Case Number 1">Case Number</div>
      </th>
      <th scope="col">
        <div class="slds-truncate" title="Category 2">Category</div>
      </th>
      <th scope="col">
        <div class="slds-truncate" title="Case Number 2">Case Number</div>
      </th>
    </tr>
  </thead>
    <tbody>
    <tr>
      <td scope="row" data-label="Case Name">
        <div class="slds-truncate" title="Current Case Name"><a>{!x2067__c.Case_Name__c}</a></div>
      </td>
      <td scope="row" data-label="Category 1">
        <div class="slds-truncate" title="Category 1"><a>PERS</a></div>
      </td>
        <td scope="row" data-label="Case Number 1">
        <div class="slds-truncate" title="Case Number 1"><a>1234567</a></div>
      </td>
      <td scope="row" data-label="Category 2">
        <div class="slds-truncate" title="Category 2"><a></a></div>
      </td>
        <td scope="row" data-label="Case Number 2">
        <div class="slds-truncate" title="Case Number 2"><a></a></div>
      </td>
        </tr>
  </tbody>
</table>
<table class="slds-table slds-table_bordered slds-table_cell-buffer">
  <thead>
    <tr class="slds-text-title_caps">
      <th scope="col">
        <div class="slds-truncate" title="Current Address">Adress(Street, City, Zip Code)</div>
      </th>
      <th scope="col">
        <div class="slds-truncate" title="Category 1">Area Code and Telephone No</div>
      </th>
    </tr>
  </thead>
    <tbody>
    <tr>
      <td scope="row" data-label="Current Address">
        <div class="slds-truncate" title="Current Adress"><a>{!x2067__c.Service_User_Address__c}</a></div>
      </td>
        <td scope="row" data-label="Area Code and Telephone No">
        <div class="slds-truncate" title="Area Code and Telephone No"><a>(480)7205699</a></div>
      </td>
        </tr>
  </tbody>
</table>



</div>
    </div>
    <div class="slds-scope" style="float:Right;">
    <p class="slds-text-heading--label slds-m-bottom--small"> <br></br>
      From:  
        </p>
        Alex Waddell<br/>
    	1234 West East Street Tempe, AZ 85281

  </div>
<br></br>


  <!-- / REQUIRED SLDS WRAPPER -->
</body>
</apex:page>



 

Hi there,
Anyone know the best way to get multiple records using the same EXTERNAL_ID?
Our case is that we have more than one Salesforce contact using the same email (external_id) and the follow request is causing 300 Multiple Choices:

```

curl https://yourInstance.salesforce.com/services/data/v20.0/sobjects/Contact/Email/foo@example.com -H "Authorization: Bearer token"

```

 

Thanks for your time.

Juan Ramon Cañizares Gomez.

Hi,

I am facing a strange issue.
I am trying to create a record using lightning:frecordEditForm but not able to create a record.
I have a master detail relationship field "Account" on object "Book". When I have change the relation to lookup it is working. But for master detail relationship it is not working. Please help me.

Below is the code
<aura:component implements="force:hasRecordId,flexipage:availableForAllPageTypes">
     <aura:attribute name="recordId" type="Id"/>
     
    <lightning:recordEditForm  objectApiName="Book__c">
        <lightning:messages />
        <lightning:inputField fieldName="Name" />
        <lightning:inputField fieldName="Account__c"/>
        
        <lightning:button class="slds-m-top_small" type="submit" label="Create" />
    </lightning:recordEditForm>

</aura:component>

This is the error I am getting
User-added image
 
 
It was my understanding after reading a few different posts and articles like this one that custom metadata types could have unlimited SOQL queries in a single Apex transaction. To give you an idea of the code that I'm using, it's designed to find a set of values (stored in custom metadata) to apply to an opportunity based off of some criteria pulled from the opp. When I tried to run this to update opps in bulk, it failed on the SOQL query error. My query:
List<Channel_Discount__mdt> chanSetting = [SELECT Direct__c,Fulfillment__c,Authorized__c,Certified__c,Regions__c,Excluded_Countries__c FROM Channel_Discount__mdt WHERE Discount__c = :w AND Distributor_Type__c = :distType AND Business_Type__c = :bisType];

Am I misunderstanding what is meant by "unlimited" queries?
I have a requirement where i need to merge all accounts if a particular field vendor_code__c value is duplicate.There is also a condition that the account of record type 'A' needs to be the master and record type 'B' needs to be the dupliacte. I have written  a batch code for this fucntionality.I am not getting any errors but the accounts are not getting merged either. Kindly help!

global class BatchVendorAccountMerge implements database.Batchable<sobject>   {

    global  database.QueryLocator start(Database.BatchableContext ctx){
        string query;
        query = 'SELECT Id, Type, RecordTypeId,Record_Type__c, Name, MasterRecordId, Vendor_Code__c FROM Account';
                   
        return database.getQuerylocator(query);
        
    }
    
    global void execute(Database.BatchableContext BC, list<account> scope ){
        
     //create a map with vendor code and its account        
            
        //to store all unique vendor codes
        Set<string> strVC = new Set<string>();
        
         //create a map with vendor code and its account        
        map<string,list<account>> vendoraccmap = new map<string,list<account>>();
        
        
        for(account a:scope){
            
            strVC.add(a.Vendor_Code__c);
                        
            if(vendoraccmap.containskey(a.Vendor_Code__c)) {
              vendoraccmap.get(a.Vendor_Code__c).add(a);
            } else {
                vendoraccmap.put(a.Vendor_Code__c, new List<account> {a});
           
        } 
        }
       system.debug('****Unique vendor codes***'+strVC);
        system.debug('****vendor and acc map***'+vendoraccmap);
        
       Account masteracc = new account();
        list<account> dupacc = new list<account>();
            
        for(string v:vendoraccmap.keySet()){
            if(vendoraccmap.get(v).size() > 1)               
                
            
                system.debug('**vendoraccmapsize**'+vendoraccmap.get(v).size());
            {  
          
                for(Account a:vendoraccmap.get(v)) 
                {
                    if(a.Record_Type__c == 'A'){
                        masteracc.id=a.id;
                    }
                     else  if (a.Record_Type__c == 'B') {
                        dupacc.add(a);
                    }
                    
                     
                }
                
                system.debug('***Master account***'+masteracc);
                system.debug('***Duplicate accounts***'+dupacc);
            }
        }
        
        
        Database.MergeResult[] results = Database.merge(masteracc, dupacc, false);
      
        
        
     system.debug('***results merged**'+results);
        
       for(Database.MergeResult res : results) {
          if (res.isSuccess()) {
              System.debug('Master record ID: ' + res.getId());
        System.assertEquals(masteracc.Id, res.getId());               
        
      
        List<Id> mergedIds = res.getMergedRecordIds();
        System.debug('IDs of merged records: ' + mergedIds);                
        
                   
    }
    else {
        for(Database.Error err : res.getErrors()) {
            
            System.debug(err.getMessage());
        }
       }
    
     }
    }
    
    
     global void finish(Database.BatchableContext BC){
         
    }

    
    
}
BULK API 2.0 is it released and I can used in production? how can I get support in case of any problem?
Hi All,
I've written this simple controller extension for a VF page and am having trouble with the Save method; the changes I make to a record from the page are not saving after I click "save".  Do you see problems with my code?
 
public class Timesheet {
    public ApexPages.StandardController stdCntrlr {get; set;}
    public List<Timesheet_Entry__c> timeentryList {get;set;}
    public TimeSheet__c timesheet;
    public Timesheet(ApexPages.StandardController controller) {
        stdCntrlr = controller;
    
    
    timesheet = (TimeSheet__c)controller.getRecord();
     
    timeentryList = [Select id, Date__c, Time_in_1__c, Time_in_2__c, Time_Out_1__c, Time_Out_2__c, Work_Hours__c, Holiday_Hours__c, Vacation_Hours__c, Personal_Hours__c, Other_Hours__c, Total_Hours__c from Timesheet_Entry__c where TimeSheet__c =: timesheet.ID];
    }
        

 public PageReference SaveTS(){
	upsert timesheet; 
 	upsert timeentryList;
    return (new ApexPages.StandardController(timesheet)).view();
 } 
}
Here is a snippet of the Visualforce page:
 
<apex:page standardController="Timesheet__c" extensions="Timesheet" sidebar="false" showHeader="true" docType="html-5.0">
 <apex:form >		
 		<apex:pageBlock title="Hours Worked" >
    <table>
<apex:repeat var="TSE" value="{!Timesheet__c.Timesheet_Entries__r}">
      <tr>
          <td >
              <apex:outputField value="{!TSE.Date__c}"/>             
     	  </td>
          <td >
              <apex:inputField value="{!TSE.Time_Out_1__c}"/>             
           </td>
     </tr>
-
-
- (other code)
-
               <apex:commandButton value="Save" action="{!saveTS}" />
        	</apex:pageBlockButtons>
       			</table>
     		</apex:pageBlock>
        </apex:form>
</apex:page>
Any help would be appreciated. 

Thanks,
Collen
 
We have a custom Visualforce page that we use to override the "New" action on a custom object.  In the page we need to reference the ID of the parent record when adding a new record from a related list.  In Spring '17 we are able to access from the parameters of the current page reference.  In Summer '17 in the Lightning Experience it seems this parameter is no longer passed and we cannot determine the ID of the parent record.

Is there another way to get the ID of the parent record when overriding the "New" action?  FYI, we also use record types so the full list of steps to reproduce is:
  1. User Navigates to a record in LEX
  2. User clicks the "New" button from a related list
  3. User selects the record type
  4. Visualforce page (overrides "New" button) is displayed
Expected behavior:

ID of parent record is available via the parameter ending in _LKID

Actual result:

ID of parent record is no longer available in Summer '17

Note: In SF Classic this code still works correctly in Summer '17



 
Why do some custom objects show deleted items in SOQL queries and others don't ?
I have two SOQL queries for different custom objects both with deleted items ( as seen in the Recycle bin ) and both including the IsDeleted field. Niether query has any WHERE statement.  For one object the query retrieves records where IsDeleted = 1 or blank.  But for the other object only IsDeleted = blank   records show..  Why is this ?  Is there some object setting that could explain this.  Thanks. 
Hello everyone,

I want to create Opportunity with Quote through REST API, but I met the problem.

I create Opportunity through REST API and I can see it in SalesForce UI. After that I successfully create Quote with following parameters:
{
   "Name" : "NewTest",
   "OpportunityId" : "<OpportunityId>"
}
I can get this Quote through REST API, but I can't see it on UI neither assigned nor not assigned to Opportunity.

Also if I create Quote in SalesForce UI I can't find it in REST API even with direct request:
https://<domain>.salesforce.com/services/data/v39.0/sobjects/Quote/<Quote_ID>

Why the Quotes created through the REST API are not presented in the UI?
Why can not the Quotes created from UI be found from REST API?
How I can create Opportunity with Quote through REST API and see them in SalesForce UI?
Is it necessary to write apex code on the force.com platform or it apex can be injected using API or any other method ?
Hi,
I am using developer edition, I did not set the debuglogs of my account but it's automatically happen for sometime.
I am really scarred, can you please let me know, how it is possible.

Thanks,
KVM
<aura:component controller="SOWManager_CTL" implements="flexipage:availableForAllPageTypes">

      <aura:attribute name="theaters" type="String[]"/>
      <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
      <form>      
           <div class="header">
               <div style="margin-left:15%;float: left; margin-top:0.5%;" >
                 SOW ID : <ui:outputText aura:id="sowID"  value="{!v.Name}" />
             </div>
             <div style="margin-left:50%;float: left;margin-top:0.5%;">
                 SOW Status : <ui:outputText aura:id="sowStatus"   value="{!v.SOW_Status__c}" />
             </div>
         </div>     
        <lightning:tabset >
        <lightning:tab label="General Info">
             <fieldset class="slds-form--compound" style="margin-left:15%;margin-right:15%">
               <div class="slds-form-element__group">
                <div class="slds-form-element__row">
                  <div class="slds-form-element slds-size--1-of-2">
                      <lightning:select  name="theaterGeo"  label="Theater/Geography" required="true">
                          <option value="" text="Select Theater/Org"></option>
                          <aura:iteration items="{!v.theaters}" var="theater">
                            <option value="{!theater}" text="{!theater}"></option>
                        </aura:iteration>
                    </lightning:select>
                  </div>
                  <div class="slds-form-element slds-size--1-of-2">
    
                   </div>
                </div>
              </div>
            </fieldset>
        </lightning:tab>
 
    </lightning:tabset>

        
       
    </form>
</aura:component>
I've added just a few lines of code for time zone handling and the page is now throwing an error on submit.

I added these lines in the submit method:
User-added image

adjustment is a public variable declared in the top of the code. 

Here is my error from the log (screenshot):
User-added image
lightning component iframe only allowed embedded link.. How i access normal website url like google.com?
var field1= component.find('field1');
var field2= component.find('field2');
var isValid = true;

if(!field1 || field1.get('v.value').length === 0) {
            field1.set("v.errors", [{message:"Error message"}]);
            isValid = false;
 } else {
            field1.set("v.errors", null);  //  here seems to be a problem..doesn't go to the nex line of code   
 }
if(!field2 || field2.get('v.value').length === 0) {
            field2.set("v.errors", [{message:"Error message"}]);
            isValid = false;
 } else {
            field2.set("v.errors", null);     
 }

Even both, the red border and error message, are removed doesn't go to the next line.
Someone has any idea?
Hi, need a validation rule to make sure that if a case is new, it can be only created with the "New" Status. However, 3 roles must be able to save them anyway, even with a different status value set. I am trying the following validation rule but is not working [Error: Syntax error. Missing ')']

I hope you can help me. Thank you

AND(
ISNEW() && NOT( ISPICKVAL( Status, "New" ) )
OR(
$UserRole.Name <> "GRP_UK_HR_HR_Customer_Services_Manager",
$UserRole.Name <> "GRP_UK_HR_Customer_Services_Team_Leader",
$UserRole.Name <> "GRPUKHRPeopleServicesTier1Advisor" ) )
I am trying to look at all tasks for a specific time frame, then create a note and set the LinkedEntityId to the whatid or whoid. This code creates the content note, 1 for each task. But then created a contentdocumentlink for each whatid or whoid for every note.
For instance, the query returns 8 tasks, 8 contentnotes are created and then each note is associated to each whatid(opps). So every opp has 8 notes. I have reworked this a million times and I am just not sure how to get it to know that I just want each contentnote associated to the task it "copied".
At this point I think I am over complicating it and the answer is so easy that I am not seeing it. How can I get this to create one note per task, and then associate it to the opp that the task is related? (whatid)
 
global class archiveTasksBatch implements Database.Batchable<SObject>, Schedulable{

public final string query;
date mydate = date.today().addDays(-369);

public archiveTasksBatch() {
    query = 'Select WhoId, WhatId, Subject, Status, OwnerId, Id, Description, CreatedDate, ActivityDate From Task where ActivityDate = :mydate' ;
}
public void execute(SchedulableContext sc){
    Database.executeBatch(this, 100);
}
public Database.QueryLocator start(Database.BatchableContext bc){
    return Database.getQueryLocator(query);
}

public void execute(Database.BatchableContext bc, List<sObject> scope){

    list<ContentNote > newObjects = new list<ContentNote >();
    list<ContentDocumentLink  > newCDL = new list<ContentDocumentLink  >();
    Map<ID, String> taskIdMap = new Map<ID, String>();





    for(Sobject s : scope){
        Task obj = (Task) s;
        String myString = obj.Description + obj.ActivityDate;
        Blob myBlob = Blob.valueof(myString.escapeHtml4());
        newObjects.add(new ContentNote (
        Title = obj.Subject,
        Content = myBlob
        ));

   }

        system.debug('*********************************newObjects' +newObjects.size());
        system.debug('*********************************scope' +scope.size());

        if(!newObjects.isEmpty()){
            Database.SaveResult[] srList = Database.insert(newObjects, false);
            for (Database.SaveResult sr : srList) {
                        for (Sobject sc : scope){
                        Task t = (Task) sc;
                        string tid = t.WhatId;
                        if(tid == null) {
                            tid = t.WhoId;}
                        taskIdMap.put(sr.Id, tid);
                if(sr.isSuccess()) {
                    ContentDocumentLink cdl = new ContentDocumentLink();
                    cdl.ContentDocumentId = sr.getId();
                    cdl.LinkedEntityId = taskIdMap.get(sr.id);
                    cdl.Visibility = 'AllUsers';
                    cdl.ShareType = 'I';
                    newCDL.add(cdl);
        system.debug('*********************************srList' +srList.size());
        system.debug('*********************************newCDL' +newCDL.size());
        system.debug('*********************************LinkedEntityId' +cdl.LinkedEntityId);
        system.debug('*********************************ContentDocumentId' +cdl.ContentDocumentId);

                }
            }
        }
     }
    insert newCDL;
}


public void finish(Database.BatchableContext bc){
    system.debug('JOB IS FINISHED');
}

 
Hi All, I need some help with

Myobject__c c = new MyObject__c();

c.put('carrier__c', 'xyz'); // This works
c.put('Name__r.lastName__c', null); // THIS DOES NOT WORK when I view it through my VF page I get invalid field. For some reason REFERENCE to another field from other object does not work 

In developer console when I run query like Select Name__r.lastName__c From Myobject__c where id..... I can access Name__r.lastName__c
Hello folks,

I've come to you looking for help in finding a solution so let me clarify the big picture here:

A project that I am working in has a special business requirement on pricing. I have 8 PriceBook levels (record types), each level corresponds to a specificity that will be relevant when ordering products. 

For instance, we have the level 1 (less specific) that is a common PriceBook with normal pricing and we have the level 8 (more specific) that has a special discount per client (Account Lookup in PriceBook Entry).

The big problem in having different pricing per client is that I cannot add the same product to a Pricebook even though each record is linked to different clients.

Owing to that, now I have to decide whether, Option 1, to create a custom PriceBookEntry object linked (lookup) to a PriceBook or, Option 2, to create one PriceBook per Client (e.g.). 

Regarding option 2, considering that I have 8 levels that can result in a expressive amount of PriceBook records and that the program will have to manage all that information when ordering products, I am inclined to opt for Option 1 but I am also concerned as it is not a native solution that will require custom development as well.


Any piece of advice on that?

Many thanks in advance.
Hello folks,

Few time ago I was debugging a code and I noticed that using System.debug to put a Map in the log increased the CPU time.

That happened because I was debugging or even when I am not it count against Salesforce limits?

Regards

Hello folks,

I have to create a Report that show records grouped by checkboxes. For instance, I have an object that has 4 flags that can be checked independently. In the Report I have to show each checkbox in a row, showing how many records has each one flagged. The result has to looks like this:

Flag 1      2
Flag 2      2
Flag 3      2
Flag 4      4

Further more, I have show this in a bar chart. I have tried many approaches without success. The bucket field seems the best option, but it's not working properly (or I'm not coding it right). I have created a formula field to use it in the bucket field; it looks like this:

IF(FLG_1__c, "Flag 1" ,"") & " " &
IF(FLG_2__c, "Flag 2" ,"") & " " &
IF(FLG_3__c, "Flag 3" ,"") & " " &
IF(FLG_4__c, "Flag 4" ,"") & " " &

The problem is, when I run the report, it is not counting each flag separately and I'm getting the following result:


Flag 1               1
Flag 2               2
Flag 3               1
Flag 3 Flag 1     1
Flag 4               4

I'm using a matrix report. Does anyone has an idea?

Many thanks in advance!

Hello folks,

I have a need to improve the way I develop triggers - currently I am using more than one trigger per object with all logic within it. I am aware that it is, probably, the worst way to do it.  I have been analysing all the techniques and during my searches, I have come across with the following article: https://developer.salesforce.com/page/Trigger_Frameworks_and_Apex_Trigger_Best_Practices

It would be important and tremendously welcomed, have your opinion to decide which approach I should adopt.
Hello folks,

I have a need to improve the way I develop triggers - currently I am using more than one trigger per object with all logic within it. I am aware that it is, probably, the worst way to do it.  I have been analysing all the techniques and during my searches, I have come across with the following article: https://developer.salesforce.com/page/Trigger_Frameworks_and_Apex_Trigger_Best_Practices

It would be important and tremendously welcomed, have your opinion to decide which approach I should adopt.
Hello folks,

First of all, I'm a newbie on SalesForce, so accept my apologies if my question sounds dumb.

I have to create a trigger that creates a task after an e-mail is sent from Activity History in a custom object. I am trying to use MyCustomObject__History but I'm getting the following error: SObject type does not allow triggers: MyCustomObject__History.

Does anyone can confirm if it is possible to create a trigger for "__History" objects?

Many thanks in advance.
Hi,

I am trying to show the data on jquery data table through js remoting. I am using this because i want to show more than 1k records in table. but my data is not going. one or the other error is coming. 

This is my code:
function rebuildTable_applyFilterTable() {
             
            j$('[id$="applyFilterTable"]').DataTable({
                "data" : JSON.parse('{!JSENCODE(payload)}'),
                "scrollY": "260px",
                "scrollCollapse": true,
                "paging": true,
                "searching": true,
                "ordering": true,
                "info": true,
                "dom": 'Bfrtip',
                "buttons": [
                    'copy',
                    {extend: 'csvHtml5',title: 'Criteria export'},
                    {extend: 'excelHtml5',title: 'Criteria export'},
                    {extend: 'pdfHtml5',title: 'Criteria export'},
                    'print'
                ],
                "columns": [
                            { title: "SID" },
                            { title: "FirstName" },
                            { title: "LastName" },
                            { title: "StudentLog" },
                            { title: "ConsoleView" },
                            { title: "ListOfMajors" },
                            { title: "ListOfMinors" },
                            { title: "GPA" },
                            { title: "CreditHours" },
                            { title: "CurrentCreditHours" },
                            { title: "Privacy" },
                            { title: "CurrentlyEnrolled" }
                        ]
            } );
        }

 Visualforce.remoting.Manager.invokeAction(
                '{!$RemoteAction.adv_CriteriaCreateController.getContacts}',
                 rateOverrideArray[0],
                '{!sortExpression}',
                '{!sortDirection}',
                function(result, event){
                    if (event.status) {
                       
                        // var html = $("#contactTableRowTmpl").render(result);
                        //document.getElementById("#contactTableRowTmpl").innerHTML = result;
                      
                        //replace the table body with rendered html
                        //$("#contactTableBody").html(document.getElementById("#contactTableRowTmpl").innerHTML);
                       
                        rebuildTable_applyFilterTable();
                        
                        
                    } else if (event.type === 'exception') {
                        document.getElementById("responseErrors").innerHTML = 
                            event.message + "<br/>\n<pre>" + event.where + "</pre>";
                    } else {
                        document.getElementById("responseErrors").innerHTML = event.message;
                    }
                }, 
                {escape: true}
            );

This result is getting data , i checked about it.

how do i push it to table?​ I am not saying use the below table but i even tried the js script as well. can you make it work?
<table id="applyFilterTable" />

 
Help on passing test class.  I just need 5 lines more.  it's at 67%  The class is long I only added what's red and not passing.
 
public void send() {
        try {
            DM_Public_Page_URL__c siteCS = DM_Public_Page_URL__c.getValues('Default');
            String siteURL = siteCS.Site_URL__c;
            String logo = siteCS.Logo__c;
            
            List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
            EmailTemplate emailT = [select Subject, HtmlValue from EmailTemplate where DeveloperName = 'Contact_Form' limit 1];
            
            for(Contact primaryContact : primaryContactList) {
                String body = emailT.HtmlValue.replace('{account_form}', siteURL + '/apex/AccountFormPage?id=' + accountId);
                body = body.replace('{primary_contact_name}', primaryContact.FirstName);
                body = body.replace('{account_name}', accountName);
               body = body.replace('{account_logo}', '<img src="'+siteURL + Logo+'"alt="Logo" height="225px" width="74px"');
                
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                mail.setToAddresses(new String[]{primaryContact.Email});
                mail.setSubject(emailT.Subject);
                mail.setHtmlBody(body);
                mails.add(mail);
            }
            
            List<Messaging.SendEmailResult> results = Messaging.sendEmail(mails);
            if(results[0].isSuccess()) {
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM, 'Contact email successfully sent'));
            } else {
                System.debug('------------------- errors: ' + results[0].getErrors());
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error while sending the contact update email: ' + results[0].getErrors()));
            }
        } catch(Exception e) {
            System.debug('------------------- ERROR: ' + e.getStackTraceString());
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Error while sending the contact update email: ' + e.getStackTraceString()));
            
        }
    }
    
    public PageReference cancel() {
        PageReference pref = new PageReference('/' + accountId);
        return pref;
    }
}


This is my test class

@isTest
private class AccountFormControllerTest {

    private static testMethod void test() {
        Account lender = new Account();
        lender.Name = 'Test Account';
        insert lender;
        System.debug('created account');
        
        Contact c = new contact();
        c.FirstName = 'JOhn';
        c.LastName = 'Doe';
        c.email='test@test.com';
        c.primary_contact__c = True;
        insert c;
        System.debug('created account');
                
        ApexPages.currentPage().getParameters().put('id', lender.Id);
        AccountFormController controller = new AccountFormController();
        controller.accountUpdate.Equity_Debt__c = 'Debt';
        controller.save();
        
        string options = controller.getOptions();
    }
    
    private static testMethod void test2() {
        Contact ca = new Contact();
            ca.FirstName = 'John';
            ca.LastName = 'Doe';
            ca.email='test@test.com';
            ca.Primary_Contact__c = true;
    
        ApexPages.currentPage().getParameters().put('id', 'some id');
        AccountFormController controller = new AccountFormController();
        controller.save();
        
        AccountFormController controller2 = new AccountFormController();
        controller2.save();
        
        ApexPages.currentPage().getParameters().put('id', '');
        AccountFormController controller3 = new AccountFormController();
        controller3.save();
        
        try{
        Insert ca;
        }
        catch(Exception ee){
        }   
    }
    
}
This is whats not passing...
 
String body = emailT.HtmlValue.replace('{account_form}', siteURL + '/apex/AccountFormPage?id=' + accountId);
                body = body.replace('{primary_contact_name}', primaryContact.FirstName);
                body = body.replace('{account_name}', accountName);
               body = body.replace('{account_logo}', '<img src="'+siteURL + Logo+'"alt="Logo" height="225px" width="74px"');
                
                Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
                mail.setToAddresses(new String[]{primaryContact.Email});
                mail.setSubject(emailT.Subject);
                mail.setHtmlBody(body);
                mails.add(mail);
            }

 
The instructions given in the second unit of the Company-Wide Org Settings module appear to be inaccurate. To enable Advanced Currency Management I was unable to find Manage Currencies (or anything associated with currencies) on the Settings Quicklist. To get around this, I navigated to Company Information & clicked on Currency Setup (after activating multiple currencies.) Only from there could I enable Advanced Currency Management, and complete the instructions to set the Corporate Currency, and Update Currency Rates. Hopefully this helps someone else if they are stuck like I was!
Hello,

For some reason, all of the values inside my table are blue and clickable as if they had a hyperlink attached to them. But when you click on the values nothing happens

Does anyone know why this happening and how I can make the text black with no hyperlink type functionality?

Below is a photo of the table rendering the values and my code:

User-added image
 
<apex:page standardcontroller="X2067__c" showHeader="false" standardStylesheets="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0">
<head>
  <!-- Import the Design System style sheet -->
  <apex:slds />
</head>
    <body class="slds-scope">        
        <div class="slds-grid slds-grid_vertical-align-end slds-grid_align-spread" style="height:100px">
            <div class="slds-col slds-p-horizontal_medium">
                <span><apex:image url="/servlet/servlet.FileDownload?file=0152F0000000YbI" width="256" height="150"/> </span>
            </div>
            <div class="slds-col slds-text-heading_large slds-text-align_center">
                <span>Case Information</span>
            </div>
            <div class="slds-col slds-p-horizontal_medium slds-text-heading_medium slds-text-align_right">
                <span>Form 2068<br></br>December 2012-E</span>
        </div>        
    </div>

  <!-- REQUIRED SLDS WRAPPER -->
  <div class="slds-scope" style="float:Left; position:absolute; width:100%">
    <!-- MASTHEAD -->
      <br></br>
    <p class="slds-text-heading--label slds-m-bottom--small">
      To:  
        </p>
        <apex:outputField value="{!X2067__c.Payer_Name__c}"/><br/>
    	<apex:outputField value="{!X2067__c.Payer_Fax_Number__c}"/>
      <br></br>  <br></br>  <br></br>
    <div class="slds-scope" style="float:Left; position:absolute; width:100%">  
<table class="slds-table slds-table_bordered slds-table_cell-buffer">
  <thead>
    <tr class="slds-text-title_caps">
      <th scope="col">
        <div class="slds-truncate" title="Case Name">Case Name</div>
      </th>
      <th scope="col">
        <div class="slds-truncate" title="Category 1">Category</div>
      </th>
      <th scope="col">
        <div class="slds-truncate" title="Case Number 1">Case Number</div>
      </th>
      <th scope="col">
        <div class="slds-truncate" title="Category 2">Category</div>
      </th>
      <th scope="col">
        <div class="slds-truncate" title="Case Number 2">Case Number</div>
      </th>
    </tr>
  </thead>
    <tbody>
    <tr>
      <td scope="row" data-label="Case Name">
        <div class="slds-truncate" title="Current Case Name"><a>{!x2067__c.Case_Name__c}</a></div>
      </td>
      <td scope="row" data-label="Category 1">
        <div class="slds-truncate" title="Category 1"><a>PERS</a></div>
      </td>
        <td scope="row" data-label="Case Number 1">
        <div class="slds-truncate" title="Case Number 1"><a>1234567</a></div>
      </td>
      <td scope="row" data-label="Category 2">
        <div class="slds-truncate" title="Category 2"><a></a></div>
      </td>
        <td scope="row" data-label="Case Number 2">
        <div class="slds-truncate" title="Case Number 2"><a></a></div>
      </td>
        </tr>
  </tbody>
</table>
<table class="slds-table slds-table_bordered slds-table_cell-buffer">
  <thead>
    <tr class="slds-text-title_caps">
      <th scope="col">
        <div class="slds-truncate" title="Current Address">Adress(Street, City, Zip Code)</div>
      </th>
      <th scope="col">
        <div class="slds-truncate" title="Category 1">Area Code and Telephone No</div>
      </th>
    </tr>
  </thead>
    <tbody>
    <tr>
      <td scope="row" data-label="Current Address">
        <div class="slds-truncate" title="Current Adress"><a>{!x2067__c.Service_User_Address__c}</a></div>
      </td>
        <td scope="row" data-label="Area Code and Telephone No">
        <div class="slds-truncate" title="Area Code and Telephone No"><a>(480)7205699</a></div>
      </td>
        </tr>
  </tbody>
</table>
    <br></br><br></br>
<Div>
    <apex:outputLabel>Reason for 2067: </apex:outputLabel> <br></br>
    <apex:outputField  label="Reason for 2067" value="{!X2067__c.Reason_for_2067__c}"/>
</Div>
  <br></br>
<div>
    <span>
        <apex:outputLabel>Comments/Response: </apex:outputLabel> <br></br>
    <apex:outputField  label="Comments/Response" value="{!X2067__c.Comment_Response__c}"/>
</span>
</div>
</div>
    </div>
    <div class="slds-scope" style="float:Right;">
    <p class="slds-text-heading--label slds-m-bottom--small"> <br></br>
      From:  
        </p>
        Alex Waddell<br/>
    	1234 West East Street Tempe, AZ 85281

  </div>
<br></br>


  <!-- / REQUIRED SLDS WRAPPER -->
</body>
</apex:page>

 
Hello, 

Has anyone else been able to reduce these error messages through programmatic means? These errors seem to be coming from a managed package which, in my experience, have been very difficult to to intercept or interpret code wise. The npsp class is why I know this is the Non-Profit Success Pack at work. Does anyone have experience specifically with identifying the types of processes which would be causing this? I believe that it is mass data manipulation, or users uploading many records into the system.

Thank You,

Frances Allen 
Hello,

I currently have a Data table that is only taking up half the width of the page. I was wondering how I can extend the width of the table to cover the full width of the vf page

I have tried to add the "slds-size--1-of-1" to the table class but either that is wrong or i am doing something wrong

Below is a photo of the table(s) and my code 

User-added image
 
<apex:page standardcontroller="X2067__c" showHeader="false" standardStylesheets="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0">
<head>
  <!-- Import the Design System style sheet -->
  <apex:slds />
</head>
    <body class="slds-scope">        
        <div class="slds-grid slds-grid_vertical-align-end slds-grid_align-spread" style="height:100px">
            <div class="slds-col slds-p-horizontal_medium">
                <span><apex:image url="/servlet/servlet.FileDownload?file=0152F0000000YbI" width="256" height="150"/> </span>
            </div>
            <div class="slds-col slds-text-heading_large slds-text-align_center">
                <span>Case Information</span>
            </div>
            <div class="slds-col slds-p-horizontal_medium slds-text-heading_medium slds-text-align_right">
                <span>Form 2068<br></br>December 2012-E</span>
        </div>        
    </div>

  <!-- REQUIRED SLDS WRAPPER -->
  <div class="slds-scope" style="float:Left; position:absolute;">
    <!-- MASTHEAD -->
      <br></br>
    <p class="slds-text-heading--label slds-m-bottom--small">
      To:  
        </p>
        <apex:outputField value="{!X2067__c.Payer_Name__c}"/><br/>
    	<apex:outputField value="{!X2067__c.Payer_Fax_Number__c}"/>
      <br></br>  <br></br>  <br></br>
    <div class="slds-scope" style="float:Left; position:absolute;">  
<table class="slds-table slds-table_bordered slds-table_cell-buffer">
  <thead>
    <tr class="slds-text-title_caps">
      <th scope="col">
        <div class="slds-truncate" title="Case Name">Case Name</div>
      </th>
      <th scope="col">
        <div class="slds-truncate" title="Category 1">Category</div>
      </th>
      <th scope="col">
        <div class="slds-truncate" title="Case Number 1">Case Number</div>
      </th>
      <th scope="col">
        <div class="slds-truncate" title="Category 2">Category</div>
      </th>
      <th scope="col">
        <div class="slds-truncate" title="Case Number 2">Case Number</div>
      </th>
    </tr>
  </thead>
    <tbody>
    <tr>
      <td scope="row" data-label="Case Name">
        <div class="slds-truncate" title="Current Case Name"><a>{!x2067__c.Case_Name__c}</a></div>
      </td>
      <td scope="row" data-label="Category 1">
        <div class="slds-truncate" title="Category 1"><a>PERS</a></div>
      </td>
        <td scope="row" data-label="Case Number 1">
        <div class="slds-truncate" title="Case Number 1"><a>1234567</a></div>
      </td>
      <td scope="row" data-label="Category 2">
        <div class="slds-truncate" title="Category 2"><a></a></div>
      </td>
        <td scope="row" data-label="Case Number 2">
        <div class="slds-truncate" title="Case Number 2"><a></a></div>
      </td>
        </tr>
  </tbody>
</table>
<table class="slds-table slds-table_bordered slds-table_cell-buffer">
  <thead>
    <tr class="slds-text-title_caps">
      <th scope="col">
        <div class="slds-truncate" title="Current Address">Adress(Street, City, Zip Code)</div>
      </th>
      <th scope="col">
        <div class="slds-truncate" title="Category 1">Area Code and Telephone No</div>
      </th>
    </tr>
  </thead>
    <tbody>
    <tr>
      <td scope="row" data-label="Current Address">
        <div class="slds-truncate" title="Current Adress"><a>{!x2067__c.Service_User_Address__c}</a></div>
      </td>
        <td scope="row" data-label="Area Code and Telephone No">
        <div class="slds-truncate" title="Area Code and Telephone No"><a>(480)7205699</a></div>
      </td>
        </tr>
  </tbody>
</table>



</div>
    </div>
    <div class="slds-scope" style="float:Right;">
    <p class="slds-text-heading--label slds-m-bottom--small"> <br></br>
      From:  
        </p>
        Alex Waddell<br/>
    	1234 West East Street Tempe, AZ 85281

  </div>
<br></br>


  <!-- / REQUIRED SLDS WRAPPER -->
</body>
</apex:page>



 
Hi All,

I have created 3 Lightning Component Lets say

Component1
Component2
Component3

I am overriding New button of Lead Object and calling Component1.

From Component 1 I am navigating to Component 2 and from Component 2 to Component 3

My Problem is Once I navigate to Component 3 and abort my operation at Component 3 and next Time I click on New button it is directly Jumping to Component 3 with previous prefilled values. Ideally It should reinitate the process and Component 1 should load with blank fields.

Please help me in solving this issue.

Thanks in Advance.

Hi there,
Anyone know the best way to get multiple records using the same EXTERNAL_ID?
Our case is that we have more than one Salesforce contact using the same email (external_id) and the follow request is causing 300 Multiple Choices:

```

curl https://yourInstance.salesforce.com/services/data/v20.0/sobjects/Contact/Email/foo@example.com -H "Authorization: Bearer token"

```

 

Thanks for your time.

Juan Ramon Cañizares Gomez.

I am new to the developer part of Salesforce and am not familiar with code, etc.  I have successfully deleted an Apex Class from my Sandbox environment but don't know how to now delete it from Production. Please can some help?
We are trying to do Bulk Upsert for Contacts and map all the new contacts that are are upserted with an existing Account Id. So while preparing the CSV we are using Account.Id and the value is the actual Id of the account for all CSV records. However I seem to get an error 
INVALID_FIELD:Field name provided, Id is not an External ID or indexed field for Account:--

As per the documentation https://developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/api_asynch/datafiles_csv_rel_field_header_row.htm any indexed fields can be used. And Describe response for account clearly says idLookup property for Id field is set to true. Can anybody help why this is failing?
Hi,

I am facing a strange issue.
I am trying to create a record using lightning:frecordEditForm but not able to create a record.
I have a master detail relationship field "Account" on object "Book". When I have change the relation to lookup it is working. But for master detail relationship it is not working. Please help me.

Below is the code
<aura:component implements="force:hasRecordId,flexipage:availableForAllPageTypes">
     <aura:attribute name="recordId" type="Id"/>
     
    <lightning:recordEditForm  objectApiName="Book__c">
        <lightning:messages />
        <lightning:inputField fieldName="Name" />
        <lightning:inputField fieldName="Account__c"/>
        
        <lightning:button class="slds-m-top_small" type="submit" label="Create" />
    </lightning:recordEditForm>

</aura:component>

This is the error I am getting
User-added image
 
 
It was my understanding after reading a few different posts and articles like this one that custom metadata types could have unlimited SOQL queries in a single Apex transaction. To give you an idea of the code that I'm using, it's designed to find a set of values (stored in custom metadata) to apply to an opportunity based off of some criteria pulled from the opp. When I tried to run this to update opps in bulk, it failed on the SOQL query error. My query:
List<Channel_Discount__mdt> chanSetting = [SELECT Direct__c,Fulfillment__c,Authorized__c,Certified__c,Regions__c,Excluded_Countries__c FROM Channel_Discount__mdt WHERE Discount__c = :w AND Distributor_Type__c = :distType AND Business_Type__c = :bisType];

Am I misunderstanding what is meant by "unlimited" queries?

I am having a really weird issue with apex:InputFile.  I hide it until the user clicks on a button.  When I show it the first time and do a save, nothing goes back to the controller.  The value of my Blobs are null.

If I show it again and pick a file it works fine.

I added a text field to my dialog for testing purposes.  The text box always works.  The inputFile never works on the first call, but works fine after that.  Any suggestions on what I need to change

Here is the markup for my dialog with the Apex:InputFiles 

         <apex:outputPanel id="UploadPicture">
            <apex:outputPanel rendered="{!ShowUploadPicture}" layout="block" styleClass="SaveModal">
                     <div class="dmodal"  id="pictureModal" tabindex="-1" role="dialog" >
                        <div class="modal-dialog modal-dialog-centered"  role="document">
                            <div class="modal-content opaque">
                                
                                <div class="modal-header">
                                    <h1 class="modal-title">Upload Files</h1>
                                  </div>
  
                                <div class="modal-body">
                                    <apex:actionRegion >
                                        <apex:inputText value="{!DummyText}" label="Dummy Text"/>
                                        <apex:outputPanel layout="block" styleclass="panel panel-default" style="margin:20px;" >
                                            <apex:outputpanel layout="block" styleclass="panel-body">
                                                <div class="col-xs-12 col-sm-12 col-md-12 text-center">
                                                    <H4>Inside Store Photo</H4>
                                                    <div class="row" style="height:120px;">
                                                        <apex:outputPanel styleclass="glyphicon glyphicon-ok-circle upOk" html-aria-hidden="true" rendered="{!NOT(ISNULL(InsideStorePhoto.Id))}"></apex:outputPanel>         
                                                        <apex:image url="{!URLFOR($Resource.rvie_img_place)}" height="100" alt="" rendered="{!ISNULL(InsideStorePhoto.Id)}" />
                                                        <apex:image url="{!URLFOR($Action.Attachment.Download, InsideStorePhoto.Id)}" height="100"
                                                                    html-onerror="this.src='{!$Resource.no_preview}'" alt="Preview not supported" rendered="{!NOT(ISNULL(InsideStorePhoto.Id))}"
                                                                    onclick="window.open('{!URLFOR($Action.Attachment.Download, InsideStorePhoto.Id)}','_blank','toolbar=yes, scrollbars=yes, resizable=yes');" />
                                                    </div>
                                                    <apex:outputPanel layout="block" styleclass="row" >
                                                        <label class="btn btn-default btn-file">
                                                             Select a Picture<apex:inputfile value="{!IBody}" contentType="image" filename="{!InsideStoreBody.Name}" onchange="previewFileAll(this)" style="display:none;"/><!----->
                                                           <br/>{!InsideStoreBody.Name}
                                                        </label>
                                                    </apex:outputPanel>
                                                </div>
                                            </apex:outputpanel>
                                        </apex:outputPanel>
                                        <apex:outputPanel layout="block" styleclass="panel panel-default" style="margin:20px;" >
                                            <apex:outputpanel layout="block" styleclass="panel-body">
                                                <div class="col-xs-12 col-sm-12 col-md-12 text-center">
                                                    <H4>Overall Photo</H4>
                                                    <div class="row" style="height:120px;">
                                                        <apex:outputPanel styleclass="glyphicon glyphicon-ok-circle upOk" html-aria-hidden="true" rendered="{!NOT(ISNULL(OverallPhoto.Id))}"></apex:outputPanel>         
                                                        <apex:image url="{!URLFOR($Resource.rvie_img_place)}" height="100" alt="" rendered="{!ISNULL(OverallPhoto.Id)}" />
                                                        <apex:image url="{!URLFOR($Action.Attachment.Download, OverallPhoto.Id)}" height="100"
                                                                    html-onerror="this.src='{!$Resource.no_preview}'" alt="Preview not supported" rendered="{!NOT(ISNULL(OverallPhoto.Id))}"
                                                                    onclick="window.open('{!URLFOR($Action.Attachment.Download, OverallPhoto.Id)}','_blank','toolbar=yes, scrollbars=yes, resizable=yes');" />
                                                    </div>
                                                    <apex:outputPanel layout="block" styleclass="row" >
                                                        <label class="btn btn-default btn-file">
                                                            Select a Picture<apex:inputfile value="{!OBody}" contentType="image" filename="{!OverallBody.Name}" onchange="previewFileAll(this)" style="display:none;" /><!----->
                                                            <br/>{!OverallBody.Name}
                                                       </label>
                                                    </apex:outputPanel>
                                                </div>
                                            </apex:outputpanel>
                                        </apex:outputPanel>
                                        <apex:outputPanel layout="block" styleclass="panel panel-default" style="margin:20px;" >
                                            <apex:outputpanel layout="block" styleclass="panel-body">
                                                <div class="col-xs-12 col-sm-12 col-md-12 text-center">
                                                     <H4>Restroom Photo</H4>
                                                   <div class="row" style="height:120px;">
                                                        <apex:outputPanel styleclass="glyphicon glyphicon-ok-circle upOk" html-aria-hidden="true" rendered="{!NOT(ISNULL(RestroomPhoto.Id))}"></apex:outputPanel>         
                                                        <apex:image url="{!URLFOR($Resource.rvie_img_place)}" height="100" alt="" rendered="{!ISNULL(RestroomPhoto.Id)}" />
                                                       <apex:image url="{!URLFOR($Action.Attachment.Download, RestroomPhoto.Id)}" height="100"
                                                                   html-onerror="this.src='{!$Resource.no_preview}'" alt="Preview not supported" rendered="{!NOT(ISNULL(RestroomPhoto.Id))}"
                                                                   onclick="window.open('{!URLFOR($Action.Attachment.Download, RestroomPhoto.Id)}','_blank','toolbar=yes, scrollbars=yes, resizable=yes');" />
                                                    </div>
                                                    <apex:outputPanel layout="block" styleclass="row" >
                                                        <label class="btn btn-default btn-file">
                                                            Select a Picture<apex:inputfile value="{!RBody}" contentType="image" filename="{!RestroomBody.Name}" onchange="previewFileAll(this)" style="display:none;"/><!----->
                                                            <br/>{!RestroomBody.Name}
                                                        </label>
                                                    </apex:outputPanel>
                                                </div>
                                            </apex:outputpanel>
                                        </apex:outputPanel>
                                    <!-->/div>
                                   <div class="modal-footer"-->
                                        <apex:commandbutton value="Save" action="{!SavePicture}" /> <!--reRender="UploadPicture, pbTable"/-->
                                        <apex:commandbutton immediate="true"  html-data-dismiss="modal" value="Cancel" action="{!HidePicture}"/> <!--reRender="UploadPicture, pbTable"/-->
                                    </apex:actionRegion>  
                                 </div>
 
                             </div>
                        </div>
                    </div>
             </apex:outputPanel>
        </apex:outputPanel>

Is there anything I need to do with my Blob Variables before my first call to make this work on the first time.
 

I have a requirement where i need to merge all accounts if a particular field vendor_code__c value is duplicate.There is also a condition that the account of record type 'A' needs to be the master and record type 'B' needs to be the dupliacte. I have written  a batch code for this fucntionality.I am not getting any errors but the accounts are not getting merged either. Kindly help!

global class BatchVendorAccountMerge implements database.Batchable<sobject>   {

    global  database.QueryLocator start(Database.BatchableContext ctx){
        string query;
        query = 'SELECT Id, Type, RecordTypeId,Record_Type__c, Name, MasterRecordId, Vendor_Code__c FROM Account';
                   
        return database.getQuerylocator(query);
        
    }
    
    global void execute(Database.BatchableContext BC, list<account> scope ){
        
     //create a map with vendor code and its account        
            
        //to store all unique vendor codes
        Set<string> strVC = new Set<string>();
        
         //create a map with vendor code and its account        
        map<string,list<account>> vendoraccmap = new map<string,list<account>>();
        
        
        for(account a:scope){
            
            strVC.add(a.Vendor_Code__c);
                        
            if(vendoraccmap.containskey(a.Vendor_Code__c)) {
              vendoraccmap.get(a.Vendor_Code__c).add(a);
            } else {
                vendoraccmap.put(a.Vendor_Code__c, new List<account> {a});
           
        } 
        }
       system.debug('****Unique vendor codes***'+strVC);
        system.debug('****vendor and acc map***'+vendoraccmap);
        
       Account masteracc = new account();
        list<account> dupacc = new list<account>();
            
        for(string v:vendoraccmap.keySet()){
            if(vendoraccmap.get(v).size() > 1)               
                
            
                system.debug('**vendoraccmapsize**'+vendoraccmap.get(v).size());
            {  
          
                for(Account a:vendoraccmap.get(v)) 
                {
                    if(a.Record_Type__c == 'A'){
                        masteracc.id=a.id;
                    }
                     else  if (a.Record_Type__c == 'B') {
                        dupacc.add(a);
                    }
                    
                     
                }
                
                system.debug('***Master account***'+masteracc);
                system.debug('***Duplicate accounts***'+dupacc);
            }
        }
        
        
        Database.MergeResult[] results = Database.merge(masteracc, dupacc, false);
      
        
        
     system.debug('***results merged**'+results);
        
       for(Database.MergeResult res : results) {
          if (res.isSuccess()) {
              System.debug('Master record ID: ' + res.getId());
        System.assertEquals(masteracc.Id, res.getId());               
        
      
        List<Id> mergedIds = res.getMergedRecordIds();
        System.debug('IDs of merged records: ' + mergedIds);                
        
                   
    }
    else {
        for(Database.Error err : res.getErrors()) {
            
            System.debug(err.getMessage());
        }
       }
    
     }
    }
    
    
     global void finish(Database.BatchableContext BC){
         
    }

    
    
}
Hi,
I ma developing a personal application. In it, my code is doing the following:
- Create a debug log level, if it is not there. If it is there, fetch it
- Create a user trace flag with the above debug log level, if it is not for logged in user. If it is there, reset the start and end time
- use system.debug in many places

So, my expectation is that a user trace flag will be automatically created or reset, when this code is executed.
The first two steps are being executed successfully.

But...

For the first time, that is, when the user trace flag will be created, no debug log will be generated. But for the subsequent executions, debug logs will be created as the user trace flag is already there.

That, I observed that no debug logs will be generated in a transaction for a user trace flag, if that user trace flag is dynamically created in same transaction. Is there any way to overcome this issue?

Thanks in advance.
Shabu
I can use /services/data/v41.0/composite/tree/sObject/ successfully but not /services/data/v41.0/composite/I can use /services/data/v41.0/composite/tree/sObject/ but not /services/data/v41.0/composite/