• Temoc Munoz
  • SMARTIE
  • 545 Points
  • Member since 2016
  • Levementum LLC


  • Chatter
    Feed
  • 16
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 109
    Replies
The error "The content of elements must consist of well-formed character data or markup" is pointing to this line of Visualforce Page code: 
<!– <apex:commandButton value="Cancel" action="{!Cancel}"/> –>

Some one can help me?
Hello folks,

Could someone guide me with this issue. I created a JSON file to use it as a Static resource for one of my VF page. I've uploaded it into my Sandbox as a .json file but after upload it's not showing as a json file. Instead it is showing as an octet-stream. 
​Can some help me with this. Am I missing something here?
Thanks
I'm trying to update the Task Helper record with the Related Event ID and keep getting this error.

Any help would be appreciated.
Thank you,

trigger UpdatedRelatedEventField on Task_Helper__c (before insert, before update) {
    for(Task Helper record: Trigger.new) {
        try {
            record.Related_Event__c = Id.valueOf(record.Related_Event__c);
        } catch(Exception e) {
            
        }
    }
}
Really simple question. We have a button that launches
http://google.com?q={!Contact.Name}
but it doesn't actually execute the search, so the user has to hit enter or click the search button on the google page. Is there syntax I can add that will 'hit enter' on the target page?

Hey SF Dev Community,

I created a trigger that has one error in it. I need to disable it as I've already created a new change set with the fix, what's the best method to do this?

Thank you

I have a new test class that covers the apex controller code, all in sandboxe. I have old test class and old apex controllers. when i deploy new test class i get an error: method doesn't exist in the controller (of course it doesn't because it is an old controller. When i deploy apex controller the test coverage does not pass.
Question how to deploy/update the test class in production?
Thank you.
  • April 12, 2016
  • Like
  • 0
Hi,

I am new to apex and I need a little help with an error that will not go away.
 
public class ClientRelationshipController {
 Public List<Prospect__c> getProspects() {
        List<Prospect__c> Prospects=[Select Name,Property__c,Property_Name__c,Phone__c,Mobile__c,Prospect_Score__c,Email__c
                                     From Prospect__c 
                                     Where Created_Date__c = Today And Relationship_Lead__c != :Relationship_lead_ID__c
                                     And RecordType__c = 'Prospect'];
        return Prospects;
    }
}

Thank you,
Bryan

Hi,
I have 10000+ records on my mysql database. Using php tool kit I am trying to  insert them in salesforce,
How ever while doing so I am getting api Limit Exceed error. How can I optimise it, I am not using any batch job.  just simple create function

Hello 

Can any one help me how to implement the destructive changes using the ANT migration tool., I want to achieve doing the multiple deployments at same time while moving my changes to production. basically I need to delete some componenrts during the same deployment using ANT while I do actual deployment. I am not clear with documentation I refered about 'destructionChanges.xml'...Can anyone explain in detail with example if possible 

 
I have created an after insert trigger for Case object that creates a corresponding lead when it is accepted from a Salesforce to Salesforce Connection. However, when I try to retrieve the field values after the insert they are null except for the ID. Can you please take a look at my code to see what I am doing wrong.

trigger createCaseLead on Case (after insert) {
    List<Case> updatedCases = Trigger.new;
    system.debug('Number of cases =' + updatedCases.size());
    List<Lead> caseLead = new List<Lead>();
     //Loops Through all of the new Cases and Creates
    //a corresponding lead
    for (Case c : updatedCases){
        system.debug('ID = ' + c.ID);
        system.debug('LastName = ' + c.Contact_Name_Copy__c); //This is returning null
        system.debug('Company = '+ c.Org_Name__c); //This is returning null
        caseLead.add(new Lead(Company = c.Org_Name__c,
                              Street = c.Org_Street__c,
                              City = c.Org_City__c,
                              State = c.Org_State__c,
                              Country = c.Org_Country__c,
                              email = c.Copy_Contact_Email__c,
                              LastName = c.Contact_Name_Copy__c,
                              LeadSource = 'Department of Commerce Customers',
                              Case_ID__c = c.Id,
                             How_did_you_find_this_Company1__c = 'DOC - ' + c.Fee_Based_Service__c
                             ));

    }
    insert caseLead;
 
}
I have this class I am using to assign leads via process builder. When the class tries to run in bulk, I get the following error:
Error Occurred: An Apex error occurred: System.QueryException: List has more than 1 row for assignment to SObject​

Any thoughts on how to resolve this error?
Here is the class I an using to assign leads:
public class AssignLeadsUsingAssignmentRules
{
    @InvocableMethod
    public static void LeadAssign(List<Id> LeadIds)
    {
            Database.DMLOptions dmo = new Database.DMLOptions();
            dmo.assignmentRuleHeader.useDefaultRule= true;          
            Lead Leads=[select id from lead where lead.id in :LeadIds];
            Leads.setOptions(dmo);
            update Leads;
   }
}

 
  • April 04, 2016
  • Like
  • 0
Hi team,

I tried insert a new zip about lightning design system, but when I try the format MIME format is application/octet-stream and not application/zip, someone help me about this?

Thanks.
Hello - I'm using this java script on my button to make sure the address is filled out... But since i started using window.open it opens this new page in a new tab.
I want it to be the same tab and just go to the new page like before. Is there a different function i should be using to open this?
 
{!REQUIRESCRIPT("/soap/ajax/21.0/connection.js")} 

var leadAddress = '{!Lead.Street}'; 
var leadCity = '{!Lead.City}'; 
var leadState = '{!Lead.State}'; 
var leadCountry = '{!Lead.Country}'; 
var leadZip = '{!Lead.PostalCode}'; 

if(leadAddress == null || leadAddress == ''){ 
alert('Please enter a valid Street Address along with the City, State/Province, Zip/Postal Code and Country before clicking on this button.'); 
} 
else if(leadCity == null || leadCity == ''){ 
alert('Please enter a valid Street Address along with the City, State/Province, Zip/Postal Code and Country before clicking on this button.'); 
} 
else if(leadState == null || leadState == ''){ 
alert('Please enter a valid Street Address along with the City, State/Province, Zip/Postal Code and Country before clicking on this button.'); 
} 
else if(leadCountry == null || leadCountry == ''){ 
alert('Please enter a valid Street Address along with the City, State/Province, Zip/Postal Code and Country before clicking on this button.'); 
} 
else if(leadZip == null || leadZip == ''){ 
alert('Please enter a valid Street Address along with the City, State/Province, Zip/Postal Code and Country before clicking on this button.'); 
} 
else{ 
var urlStr = '/a0J/e?' 
+ 'CF00Nj00000091TUH={!Lead.FirstName &" "& Lead.LastName }' 
+ '&CF00Nj00000091TUH_lkid={!Lead.Id}' 
+ '&retURL=%2F{!Lead.Id}' 
+ '&saveURL=%2F{!Lead.Id}' 
+ '&RecordType=012j0000000pfbL' 
+ '&ent=01Ij0000001EVex' 
+ '&00Nj00000091TU6={!Lead.Company}' 
+ '&00Nj00000091TUQ=Pending'; 

window.open(urlStr); 

}



Thanks!
Hi Team, Having troubles sorting my visualforce page by name, Im a bit playful with my demo org so please bear with me. 

Here is my VF 
<apex:page standardController="Lead" showHeader="false" sidebar="false" tabStyle="lead" >
<link href='https://fonts.googleapis.com/css?family=Ravie' rel='stylesheet' type='text/css' />
    
  <style>
      .alef1 {
        font-family: 'Alef', serif;
        font-size: 24px;
      }
      
      .alef2 {
        font-family: 'Alef', serif;
        font-size: 14px;
      }
         
   
       .activeTab {background-color: #1798c1 ; font-family: 'Alef';font-style: Italic; color:white; width: 100px; height: 23px; padding-top:2px; font-size: 15px; font-style:'Alef'; border:0px;
         background-image:none; border-radius: 10px;}

      .inactiveTab {background-color: #1798c1 ; font-family: 'Alef'; font-style: Italic; color:white; width: 100px; height: 15px; padding-top:2px; font-size: 15px; font-style:bold; border:0px;
         background-image:none; border-radius: 10px;}
    </style>
    
    <div class="alef1"><i>Attach your favorite Music using the attach file button</i></div><br/>
    <div class="alef2"><i><marquee>***Note: Only .mp3 format are supported</marquee></i></div><br/>
<apex:tabPanel switchType="client" selectedTab=" tabdetails" id="LeadTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab" contentStyle="font-family: Poiret One;">  
 
<apex:tab label="Play Here" name="LeadDetails">
<apex:page standardController="Lead">
</apex:page>
<apex:page standardController="Lead" id="pg" extensions="PlayAudio" sidebar="true">
<apex:includeScript value="{!URLFOR($Resource.AudioPlayer, 'audio-player/audio-player.js')}"/>
<script type="text/javascript">  
     AudioPlayer.setup("{!URLFOR($Resource.AudioPlayer, 'audio-player/player.swf')}", {  
         width: 400  
     });  
</script> 

<script type="text/javascript">  
    function playAudio(LeadObj)
        {
            AudioPlayer.embed("audioplayer_1", {soundFile: LeadObj});
        }  
</script>
<apex:form id="frm">
    <apex:pageBlock id="pb">
        <apex:variable value="{!0}" var="count" />
        <apex:pageBlockTable value="{!listAttachment}" var="item" id="pbt">
            <apex:column headerValue="Title">
            
                {!item.Name}
            </apex:column>
            
            <apex:column id="colPlayer" rendered="{!CONTAINS(item.ContentType, 'audio')}">
                <p id="{!count}.audioplayer"></p>
                <script type="text/javascript">
                    AudioPlayer.embed("{!count}.audioplayer", {soundFile: 'https://trialdemo.my.salesforce.com/servlet/servlet.FileDownload?file={!item.Id}'});
                </script>
                <apex:variable value="{!count+1}" var="count" />
            </apex:column>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:form>
</apex:page>
</apex:tab>
<apex:tab label="Attach Here" name="NotesAndAttachments" id="tabNoteAtt">

         <apex:relatedList subject="{!Lead}" list="CombinedAttachments" />

      </apex:tab>
</apex:tabPanel>
</apex:page>


and here is my class

//extensions to take care all the lead and activity related attachments and 
public without sharing class PlayAudio {
    
    public List<Attachment> listAttachment {get;set;}
    public Lead lead {get;set;}
    
    //constructor
    public PlayAudio(ApexPages.StandardController controller) {
        
        //get the controller instance
        lead = (Lead)controller.getRecord();
        
        //initialize the attachments list
        listAttachment = new List<Attachment>();
        
        //get all the lead related attachments
        listAttachment = [Select Id, ContentType, Name from Attachment where ParentId = :lead.Id];
        
        //get all the related tasks attachments
        List<Task> listTask = [Select WhatId from Task where WhoId =: lead.Id ];
        listAttachment.addAll([Select Id, ContentType, Name from Attachment where ParentId IN :listTask]);
        
        //get all the related events attachments
        List<Event> listEvent = [Select WhatId from Event where WhoId =: lead.Id ];
        listAttachment.addAll([Select Id, ContentType, Name from Attachment where ParentId IN :listEvent]);
        
    }
    
    @isTest
    private static void testPlayAudio()
        {
            //create a lead record
            Lead lead = new Lead(LastName='test', Company='test');
            insert lead;
            
            //start test from here 
            Test.startTest();
            
            PlayAudio controller = new PlayAudio(new ApexPages.StandardController(lead));
            
            System.assert(lead != null);
            //stop test here
            Test.stopTest();
        }

}

So this gets the attachments from Leads attachments related list to play audio mostly used with voicemails. Id really like to sort by name
Hello,

I have created a custom button on the Quote layout that selects a certain template automatically. Except I'm receiving this error when clicked: 

A problem with the OnClick JavaScript for this button or link was encountered:

Unexpected token ILLEGAL

Here is the code:
var pdfOverlay = QuotePDFPreview.quotePDFObjs['quotePDFOverlay'];
pdfOverlay.dialog.buttonContents='<input value="Save to Quote" class="btn" name="save"
onclick="QuotePDFPreview.getQuotePDFObject(\'quotePDFOverlay\').SavePDF(\'0,\'0\');"
title="Save to Quote" type="button"/><input value="Save and Email Quote" class="btn" name="saveAndEmail"
onclick="QuotePDFPreview.getQuotePDFObject(\'quotePDFOverlay\').savePDF(\'1\');"
title="Save and Email Quote" type="button" /><input value="Cancel" class="btn" name="cancel" onclick="QuotePDFPreview.getQuotePDFObject(\'quotePDFOverlay\').close();"
title="Cancel" type="button"/>;
pdfOverlay.summlid="0EHo0000001E982";
pdfOverlay.setSavable(true);
pdfOverlay.setContents('\quoteTemplateDataViewer.apexp?id={!(Quote.Id)}','/quote/quoteTemplateHeaderData.apexp?id={!(Quote.Id)}');
pdfOverlay.display();

 
I have a trigger that successully fires upon the system receiving an inbound email related to a Case record. This trigger's purpose is to stamp the inbound email's body into a text field on the Case object. The working code is as follows:
trigger CopyEmailReplyBody on EmailMessage (after insert) {
    Set<ID> caseSet = new Set<ID>();
    Map<Id, String> emailBodyMap = new Map<Id, String>{};
        for (EmailMessage so : Trigger.new) {
            if(so.ParentId.getSObjectType() == Case.sObjectType && so.Incoming){
                caseSet.add(so.parentid);
                emailBodyMap.put(so.ParentId, so.TextBody);
            } 
        }
        Map<Id,case> caseMAP = new Map<Id,case>([SELECT Latest_Email_Reply__c FROM Case WHERE id in:caseSet]);  
        for(Case c:caseMAP.values()){
        
            c.Latest_Email_Reply__c = emailBodyMap.get(c.Id);
        
        update c;
        }
}
My users just asked for a new requirement in that the values stamped into the text field "[FromAddres] + BR() + [FromName] + BR() + [Subject] + BR() + BR() + [Body]". Sounded simple enough, but I ran into a silly issue: 

I received the error "Error: Compile Error: unexpected token: '<' at line 34 column 67". I have tried to play around with different ways of adding in <BR/>'s into this field, but continue to run into this same error code. Please see below for the updated work in progress code:
trigger CopyEmailReplyBody on EmailMessage (after insert) {
    Set<ID> caseSet = new Set<ID>();
    Map<Id, String> emailBodyMap = new Map<Id, String>{};
        for (EmailMessage so : Trigger.new) {
            if(so.ParentId.getSObjectType() == Case.sObjectType && so.Incoming){
                caseSet.add(so.parentid);
                emailBodyMap.put(so.ParentId, so.TextBody);
            } 
        }
    Map<Id, String> emailSubjectMap = new Map<Id, String>{};
        for (EmailMessage so : Trigger.new) {
            if(so.ParentId.getSObjectType() == Case.sObjectType && so.Incoming){
                caseSet.add(so.parentid);
                emailSubjectMap.put(so.ParentId, so.Subject);
            } 
        }
    Map<Id, String> emailFromAddressMap = new Map<Id, String>{};
        for (EmailMessage so : Trigger.new) {
            if(so.ParentId.getSObjectType() == Case.sObjectType && so.Incoming){
                caseSet.add(so.parentid);
                emailFromAddressMap.put(so.ParentId, so.FromAddress);
            } 
        }       
    Map<Id, String> emailFromNameMap = new Map<Id, String>{};
        for (EmailMessage so : Trigger.new) {
            if(so.ParentId.getSObjectType() == Case.sObjectType && so.Incoming){
                caseSet.add(so.parentid);
                emailFromNameMap.put(so.ParentId, so.FromName);
            } 
        }  
        Map<Id,case> caseMAP = new Map<Id,case>([SELECT Latest_Email_Reply__c FROM Case WHERE id in:caseSet]);  
        for(Case c:caseMAP.values()){
        
            c.Latest_Email_Reply__c = emailFromNameMap.get(c.Id) + <br /> + emailFromAddressMap.get(c.Id) + <br /> + <br /> + emailSubjectMap.get(c.Id) + <br /> + <br /> + emailBodyMap.get(c.Id);
        
        update c;
        }
}
Thoughts?  
This is driving me crazy. I've checked the API name, and tried toying with it in any possible way(I can think of) . Im a very new SF developer, so i would not be suprised if i made a novice mistake. If anyone can scrutinize this snippet of code and give me a hand, it would be much appreciated. Im just adding objects to a list, so i would imagine once i get this issue resolved, i can use the same method to fix the rest.
AEXP_Dynamic_Data_Capture__c objDDC = new AEXP_Dynamic_Data_Capture__c();	  
    
    objDDC.Display_When__c = '';
    objDDC.Element_Id__c = '49';
    objDDC.Element_Label__c = 'Legal Company Name';
    objDDC.Element_Type__c = 'Text';
    objDDC.Element_Value__c = 'Dreamforce';
    objDDC.Enrollement__c = 'a694B00000003wdQAA';
    objDDC.Field_Sort_Id__c = '1';
    objDDC.isRequired__c = 'True';
    objDDC.Max_Length__c = '100';
    objDDC.Section_Name__c = 'Legal Company Information';
    objDDC.Section_Sort_Id__c = '';
    
   
        lstobjDDC.add(objDDC);

0down votefavoriteI have a wrapper class variable as -
map<String,wrapperOrder> workOrderNameToSumMap = new map<String,wrapperOrder>();
When i am trying to assign to a string variable i am getting error
String maxKey = workOrderNameToSumMap.isEmpty()?null:new List<String>(workOrderNameToSumMap.keyset())[0]; for(String s1:workOrderNameToSumMap.keySet()) { maxKey = workOrderNameToSumMap.get(s1)>workOrderNameToSumMap.get(maxKey)?s1:maxKey; }

Error -
Inequality operator not allowed for this type: wrapperOrder

 
Hi,

I want to open a dialogbox oncick of a textbox.But I get the error dialog is not a function in jquery.

<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css" />
$(function() {
$('.quantityColumn input[type=text]').click(function() { alert('Hello'); $( "#dialog-form" ).dialog({ autoOpen: false }); $( "#dialog-form" ).dialog({ autoOpen: true }); }); });


But I get an error as typeerror $(...).dialog is not a function. I used jquery files from same version and also initializes dialog(), but still get the error. Where I am doing the mistake. Any help will be appreciated.
Regards, Aditya
Hello, 

I am trying to deploy an apex class and corresponding test class, but I am recieving a code coverage error during deployment. 

Before deployment, the "Estimate my Org's Code Coverage" link says I am 75% covered, and when I "run all tests" every test that is not part of a managed package passes. 

However, when I go to deploy my latest class and test class, I get an error saying that my code coverage is only at 73%.  Here is what I am trying to deploy: 

Class
public with sharing class CloseQTRController
{

public List <Buyer__c> Buyer {get;set;}
public list<String> salesqtrs {get;set;}

public void load() 
{
  salesqtrs= new List<String>();
  Buyer = [Select id, name, Routing_Status__c, Sales_Quarter__c, Funds_Collected_All_Time__c, Sales_Origination_Date__c, Sales_LN__c from Buyer__c WHERE Current_FQ_Buyer__c = FALSE ORDER BY Sales_Origination_Date__c ASC]; 
  
  Set<String> salesqtrSet = new Set<String>();
  for (Buyer__c j : Buyer)
      salesqtrSet.add(j.Sales_Quarter__c);
      
      for (String salesqtr : salesqtrSet) 
      {
            salesqtrs.add(salesqtr);
      }
      salesqtrs.sort();
    }
}

Test Class
@isTest(seeAllData = false)
public class CloseQTRControllerTest{
    // Unit test Method
    static testmethod void UnitTest() {
        //Create your buyer__c record with required field
        //Buyer__c b = new Buyer(Current_FQ_Buyer__c = TRUE);
        //insert b;
        test.startTest();
            CloseQTRControllerTest qt = new CloseQTRControllerTest();
        test.stopTest();
    }   
}

What can/should I do to get this to pass?  Why is this one class bringing my code coverage down 2%?  I am not an expert by any means, so I would really appreciate the help!

Thanks in advance!

John
The error "The content of elements must consist of well-formed character data or markup" is pointing to this line of Visualforce Page code: 
<!– <apex:commandButton value="Cancel" action="{!Cancel}"/> –>

Some one can help me?
Hi All,

Getting the Governor limit Too many Soql queries 101 hit on vf page. But it's occured in rare conditions only. How to avoid it.

may i know the best practice to write the trigger.

Regards,
Siv.
  • April 22, 2016
  • Like
  • 0
I'm trying to update the Task Helper record with the Related Event ID and keep getting this error.

Any help would be appreciated.
Thank you,

trigger UpdatedRelatedEventField on Task_Helper__c (before insert, before update) {
    for(Task Helper record: Trigger.new) {
        try {
            record.Related_Event__c = Id.valueOf(record.Related_Event__c);
        } catch(Exception e) {
            
        }
    }
}

Quick question...

Does anyone know how to add "does not contain" to an Apex trigger (if that's a possibility - if not, I may need a second trigger)?

For example, I have the following code:
trigger TaskTrigger on Task (before insert, before update) {
    for(Task ta: Trigger.new) {
        if(ta.Task_Results__c != null && ta.Subject != ta.Task_Results__c) {
            ta.Subject += ' ('+ta.Task_Results__c + ')';
        }
    }
}

What's happening is every time a user "Edits" and "Saves" on a Task, it's duplicating the Task Result value in the Subject line. I only want this to happen once. Is there a way to add "and ta.Subject DOES NOT CONTAIN ta.Task_Results_c" or ONLY UPDATE ONCE?

In other words, I don't want the Task Results to be added to the Subject if it's already there.
Ex:
Subject - Call
Task Result - (Inbound)
Save
Final Subject = Call (Inbound)

If a user edits and saves, then what happens is this:
Subject = Call (Inbound) (Inbound)
and it keeps adding the Task Result (Inbound) to the end of the Subject.

This is more of an FYI, as i did seem to find any where else this was posted.  Hopefully this saves someone from a headache.

I was getting an error message "Duplicate id in list: false" from the following statements.  The exception itself was from the upsert statement.

    List<Chat_Transcript__c> allTranscripts;

    ...
    for ( ... ){
        Chat_Transcript__c currChat = new Chat_Transcript__c();

        ....

        allTranscripts.add(currChat);
    }
    ...
    upsert allTranscripts Chat_Number__c;
 
The records in the allTranscripts had an externalId put into the Chat_Number__c field and all Chat_Transcript__c records in the list were created programmatically with a new Chat_Transcript() statement.  I double checked to make sure that the records within the list did not have duplicate Chat_Number__c values.

Not sure when this bug seemed to show up, but upserting like this caused the error message to appear.  I fixed this by adding the following to the code.
 
 
    List<Chat_Transcript__c> allTranscripts;

    ...
    for ( ... ){
        Chat_Transcript__c currChat = new Chat_Transcript__c();

        currChat.Id = null;
        ....

        allTranscripts.add(currChat);
    }
    ...
    upsert allTranscripts Chat_Number__c;



Don't know if anyone else was having this problem, but hopefully this fix helps you.