• D.M.
  • NEWBIE
  • 25 Points
  • Member since 2012

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 23
    Replies

I want to update the account object, but the value of the fields involved depends on the results of an IF statement. However, I don't seem to be able to put IF statements in the update record and I couldn't find any good examples to give me a clue.

 

Below is a sample of what I want to do conceptually, but can someone help with the correct syntax?

 

Thank you very much.

 

for(integer i=0; i < trigger.new.size();i++){

ac.add(new Account(
ID = trigger.new[i].AccountID, 

Date_Daily_Demo__c = if(trigger.new[i].Date_Daily_Demo__c > trigger.old[i].Account_Daily_Demo__c){trigger.new[i].Date_Daily_Demo__c}; {trigger.old[i].Account_Daily_Demo__c})

update ac;

 

I have just realised, installing on a new PC, that Force.Com for eclipse has actually gone and this Micro$oft stuff really is being "forced" upon me.

Is there an easy guide to converting? I read a lot of long winded stuff.

All I want to do is edit files in a sandbox. Like a normal developer.

  • June 23, 2020
  • Like
  • 0

There is a list of "named" remote site URLs.

The endpoint for an HTTP callout has to be in that list.

 

Is there anyway to define a "remote site URL" named "XYZ" and then in code either use "XYZ" alone or to retrieve the URL for "XYZ" so that one uses the one that is valid.

 

Rather than hard coding it (which is basic rubbish) or having it in a system setting (which is rubbish because it multiply defines the data)

?

  • August 28, 2012
  • Like
  • 0

I have created some email templates for custom objects.

Mostly I click "Send test and Verify Merge Fields" and it pops up a contact+relatedTo dialog and this has a Contact chooser and an ID field and has a relatedTo object chooser and an ID field.

All fine.

 

Except for one custom object. There is no relatedTo object chooser, only an ID field.

I can manually enter an ID and it all works but this is Highly Undesirable for general practice.

I have tried a basic default template for the same custom object and it is the same, so I assum the issue is with the object and not the template.

 

Why do I not get a chooser for my relatedTo object?

  • July 06, 2012
  • Like
  • 0

I have just realised, installing on a new PC, that Force.Com for eclipse has actually gone and this Micro$oft stuff really is being "forced" upon me.

Is there an easy guide to converting? I read a lot of long winded stuff.

All I want to do is edit files in a sandbox. Like a normal developer.

  • June 23, 2020
  • Like
  • 0

Hello,

I have a Core i5 8th Gen PC with 8Gigs of RAM, and had been struggling quite hard while developing on APEX. i was earlier using the Developer Console, and as the Project i am working is quite dense, we have to test Batch Classes, and Aura Components.

When we load any Aura page, there are muliple logs of Aura or Batch Class in case of running the batch, are created, and this makes the PC to hang.

To solve the issue we started to work on VS Code, but that made the situation worse. 

Also we guys are using Ubuntu 18.04 LTE.

What do you guys suggest? Should we move to Windows or simply increase our RAM? 

It would be great if you guys can help with your experiance with AURA, APEX, and dealing with lots of LOGS in Dev Console according to your current configuration of PC. 

Hi all,
I am sending a single email from Apex code. Although I do not have any erros, the email doesn't get sent. As you can see from the code snippet, it is pretty uncomplicated. Wanted to do a test send before I get to the complicated stuff. There are not error messages but the email doesn't get sent. Any ideas???

Messaging.Singleemailmessage mail = new Messaging.Singleemailmessage();
mail.setToAddresses(new String[] {'terence1122@gmail.com'});
mail.setReplyTo('noreply@privatebudget.com');
mail.setSenderDisplayName('Private Budget App');
mail.setSubject('Private Budget records for ' + Date.today().month() + ' ' + Date.today().year());
mail.setBccSender(false);
mail.setUseSignature(false);
mail.setPlainTextBody('This is a test');
system.debug('@@@@ sendEmail - mail : ' + mail);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

The sytem debug produces the following
@@@@ sendEmail - mail : Messaging.SingleEmailMessage[getBccAddresses=null;getCcAddresses=null;getCharset=null;getDocumentAttachments=null;getFileAttachments=null;getHtmlBody=null;getInReplyTo=null;getOrgWideEmailAddressId=null;getPlainTextBody=This is a test;getReferences=null;getTargetObjectId=null;getTemplateId=null;getToAddresses=(terence1122@gmail.com);getWhatId=null;isUserMail=false;]

I am working on the dev org and executing the class which sends the mail from execute anonymous. 
Thanks

I want to update the account object, but the value of the fields involved depends on the results of an IF statement. However, I don't seem to be able to put IF statements in the update record and I couldn't find any good examples to give me a clue.

 

Below is a sample of what I want to do conceptually, but can someone help with the correct syntax?

 

Thank you very much.

 

for(integer i=0; i < trigger.new.size();i++){

ac.add(new Account(
ID = trigger.new[i].AccountID, 

Date_Daily_Demo__c = if(trigger.new[i].Date_Daily_Demo__c > trigger.old[i].Account_Daily_Demo__c){trigger.new[i].Date_Daily_Demo__c}; {trigger.old[i].Account_Daily_Demo__c})

update ac;

 

Its painful trying to use the standard reporting.  Something as easy as sorting a summary report by the totals metric is just not possible.

 

I have heard some people say you can use Apex/VF to create more flexible reporting but I have never seen an example and I'm not even sure if that is accurate.

 

Does anyone have any sample reporting that was builty using apex/vf ? 

 

Thanks!!

 

Fred

Hello,

 

I am trying to update records using apex from a .csv that is uploaded from a VF page.  I have the page working correctly, allowing the file to be selected and then passing the .csv through a reader/parser and returning it as a List<List<String>>.  However, I am having trouble a getting a specific IF() statement to evaluate correctly.  Here is the code:

public

classROIUploadController {

 

public Blob contentFile { get; set; } 

public String nameFile { get; set; } 

public Integer rowCount { get; set; } 

public Integer colCount { get; set; }

 

publicvoidupdateRecordsWithROICSV(){

     List<List<String>> attachedCSV = getResults();  <---- getResults() is standard CSV method that passes back the uploaded .csv as a List<List<String>>

    if(attachedCSV != null){

 

          //get and update Opportunity Data

              Id oppID = (ApexPages.currentPage().getParameters().get('id'));

 

           Opportunity Opp = [Select Id FromOpportunityWHEREId = :oppID];

               List<String> oppDataRow = attachedCSV.get(2);

               If(oppDataRow.get(0) == Opp.ID){ 

                Opp.amount = decimal.ValueOf(oppDataRow.get(8)); 

                database.update(Opp);

            

      } 

}

 

 

I have tested the assignment of the "amount" and update outside of the IF() and it works just fine.  I have also made sure that I am referencing the correct cell and it is the cell that contains the ID of the Opp in question.  However, when I test the above no update is made (meaing the IF = False).  What am I doing wrong, what do I need to do to get this to evaluate to true (when the correct ID is in that cell in the .csv)

 

Thanks in advance for the help.

 

Jeremy Stender

Hi Friends,

 

I have custom object with the name BB and I have written extension class named classic and I have visual force page seaside_ classic.

 

I want to bind this custom object and class to the visual force page so when somebody clicks on the object on the tab seaside_classic should become visible.

 

What is the way to write it,does somebody have some example?

 

Thanks,

Trick

 

 

 

Hi,

 

i am developing an application that is comparable to a email client.  I have a pageblocktable with the emails and various field of the single mail.

I have a formula field too. I use this field to call some images and use it to create the "outlook flag follow up"(on a object "Email__c" there is a field "flagstatus__c" and formula field "flag__c" ):

  1. If the flagstatus__c is  "NULL" -> GRAY FLAG 
  2. If the flagstatus__c is  "TO_DO"-> RED FLAG
  3. If the flagstatus__c is "COMPLETE" -> CHECK FLAG
CASE(FlagStatus__c , "TO_DO",IMAGE("/resource/FlagRed",""), "COMPLETE", IMAGE("/resource/FlagCompleted",""),IMAGE("/resource/FlagNull",""))

 

 

I have no button to rerender the value of this field but i call a remoteaction after click on the flag(now is in outputtext, but i think that with an outputfield i have the same result). The remote action update the value but this it is not rendered on the table in the page.

How i can render the value without using a button (with the option "rerender=")? The problem is that the remote action is asynchronous?

 

This is a part of the table :

 

<apex:pageBlockTable id="maintable" style="cursor:pointer" value="{!Emails}" var="e" columns="5" cellspacing="5"  onRowClick="show(this)" >


 <apex:column onclick="setRemoteFlagState('{!e.Id}');"   headerValue="State" width="4%"  >
				    	
				    	
				    	 <apex:outputText escape="false" value="{!e.Flag__c}"/>
				    	  	
				    </apex:column>



</apex:pageBlockTable>

 This is the remote action

 @RemoteAction
    global static String setFlagState(String emailId) {
    	List<E2C_Email__c> emails = [select FlagStatus__c from E2C_Email__c where Id = :emailId];
    	
    	if (emails.size() > 0) {
    		
    		if (emails.get(0).FlagStatus__c=='NULL'){
    		
    		emails.get(0).FlagStatus__c='TO_DO';
    		
    		update(emails.get(0));
    		
    		return emails.get(0).FlagStatus__c;
    		
    		}
    		
    		else if (emails.get(0).FlagStatus__c=='TO_DO'){
    		
    		emails.get(0).FlagStatus__c='COMPLETE';
    		
    		update(emails.get(0));
    		
    		return emails.get(0).FlagStatus__c;
    		
    		}
    		
    		else{
    		
    		emails.get(0).FlagStatus__c='NULL';
    		
    		update(emails.get(0));
    		
    		return emails.get(0).FlagStatus__c;
    		
    		}
    		
    		
    		System.debug('stato email '+emails[0].read__c);
    		return emails[0].Read__c;
    	} else {
    		System.debug('Nessuna Email corrispondente');
    		return null;
    	}
    }

 This is the javascript code:

		function setRemoteFlagState(emailId) {
				    Visualforce.remoting.Manager.invokeAction(
				        '{!$RemoteAction.E2CViewEmail_ProvaController4.setFlagState}',
				        emailId, 
				        function(result, event){
				            if (event.status)
				                if (result.replace != null) {
				      
				      alert(result);
				      
				            } else if (event.type === 'exception') {
				                document.getElementById("responseErrors").innerHTML = event.message;
				            } else {
				                document.getElementById("responseErrors").innerHTML = event.message;
				            }
				            
				           
				        }, 
				        {escape: true}
				    );
		}   
        

 

Hi,

 

 

i am using the Email Services to create my application. Now i have a question, is possible to open an outlook email from apex?

I would to click on a button and open a mail in outlook.

 

 

Thanks to all,

 

F.P.

I installed the standalone Force.com IDE.  I have Java 6 update 33.  Force.com IDE installs and opens.  However, it does not have the options displayed on most of the screen shots I have seen of force.com.  There is no File > New option.  There is no Window > Open Perspective.  It appears that I do not have the complete force.com ide.

 

Do I have to install Eclipse first and the Force.com plugin instead?

 

 

  • July 25, 2012
  • Like
  • 0

Hello,

 

A site page is accessed by Guest User with Guest Profile and a Guest User wants to perform update operation on Standard Object (Campaign, Contact, Campaign Member).

 

Will that be possible using Guest Profile? If not then what would be the workaround?

 

Thanks,
Devendra

I have created some email templates for custom objects.

Mostly I click "Send test and Verify Merge Fields" and it pops up a contact+relatedTo dialog and this has a Contact chooser and an ID field and has a relatedTo object chooser and an ID field.

All fine.

 

Except for one custom object. There is no relatedTo object chooser, only an ID field.

I can manually enter an ID and it all works but this is Highly Undesirable for general practice.

I have tried a basic default template for the same custom object and it is the same, so I assum the issue is with the object and not the template.

 

Why do I not get a chooser for my relatedTo object?

  • July 06, 2012
  • Like
  • 0

Good Afternoon -

 

I am attempting to set up a customer portal which would allow clients we certify to log in, update their contact file and register for courses using custom objects. I would like them to only have access to their file and ideally, logging in would take you directly to their contact file.

 

Contacts have been enabled for this user group, however the contact tab is not appearing. It is for Customer Portal Manager Custom, though.

 

I have been through the Sites and Customer Portal Implementation Guides and have not seen an answer to this.

 

Thank you in advance.

Does anyone know how to access the raw post data sent to a visualforce page I've exposed through Salesforce Sites?

I need to parse XML that has been posted to the page.

Thanks,