• Richard Jimenez 9
  • NEWBIE
  • 240 Points
  • Member since 2016
  • Mr


  • Chatter
    Feed
  • 7
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 71
    Replies
I have Picklist called Fuel_Type__c with five values. Once the record saves with value 'Petrol' , This value should never get changed in further updates of the record(Remaining fields can be updated).I tried with validation rule and it is fine.But Could anybody let me know how to do this in Controller? 

So here is my situation. I recently began to realize I need to async more of our code, and learned all about @future (WEEE!) but have quickly come to realize that because we have many moving pieces that @future has limitations (specifically when one @future might trigger another @future).

In queueable, which seems to be the silver knight I have wanted but, I'm having a misunderstanding as to how to go about this (most examples I find show the queuable apex class which I understand but, not understanding how to pass it the values of triggering ID's).

So here is my simple code:

Trigger

 

trigger SalesAreaRelatedOpportunityUpdate on Sales_Area__c (after insert,after update) {
    SalesAreaRelatedOpportunityUpdateClass.processOpportunities(Trigger.newMap.keySet());

}

 

Class

global class SalesAreaRelatedOpportunityUpdateClass {
@future
    public static void processOpportunities(Set<ID> salesAreaId){

    List <Opportunity> updateOps = [SELECT Id FROM Opportunity WHERE IsClosed = False AND (Sales_Area__c in :salesAreaId OR Secondary_Sales_Area__c in :salesAreaId)];
    if(!updateOps.isEmpty()) {
        update updateOps;   
        
    }
                                                                
}
}

What this code does is merely update the related opportunities from a custom object which in turn, triggers other code. Some of that other code due to load needs to be async (and currently is @future, although once I figure out this queueable business I may change it as well).

My question is this---how would I change this pretty basic code to something queable? I'm having some troubles understnading how to pass the keySet in particular. 

now i have this VFP
 
<apex:repeat value="{!Quote.QuoteLineItems}" var="qli">
<tr class = "stdstyle" >
<td>{!FLOOR(count)} </td> 
<td>{!qli.Product2.Name}</td>
<td >                                
<apex:outputPanel rendered="{!IF(qli.Quote_PDS_Description__c == 'Summary Only',true,false)}">
{!qli.Product_Description__c} 
</apex:outputPanel>

<apex:outputPanel rendered="{!IF(qli.Quote_PDS_Description__c == 'Summary & Long Details',true,false)}">
<apex:OutputText value="{!qli.Product_Description__c}" rendered="{!IF(qli.Product_Description__c ==''  ,false,true)}"></apex:OutputText> 
<apex:OutputText value="{!qli.Quote_attribute_1__c}" rendered="{!IF(qli.Quote_attribute_1__c ==''  ,false,true)}"><br/><br/></apex:OutputText> 
<apex:OutputText value="{!qli.Quote_attribute_2__c}" rendered="{!IF(qli.Quote_attribute_2__c ==''  ,false,true)}"><br/> </apex:OutputText> 
<apex:OutputText value="{!qli.Quote_attribute_3__c}" rendered="{!IF(qli.Quote_attribute_3__c ==''  ,false,true)}"><br/> </apex:OutputText> 
<apex:OutputText value="{!qli.Quote_attribute_4__c}" rendered="{!IF(qli.Quote_attribute_4__c ==''  ,false,true)}"><br/> </apex:OutputText> 
<apex:OutputText value="{!qli.Quote_attribute_5__c}" rendered="{!IF(qli.Quote_attribute_5__c ==''  ,false,true)}"><br/> </apex:OutputText> 
<apex:OutputText value="{!qli.Quote_attribute_6__c}" rendered="{!IF(qli.Quote_attribute_6__c ==''  ,false,true)}"><br/> </apex:OutputText> 
<apex:OutputText value="{!qli.PDS_Tag_Line__c}" rendered="{!IF(qli.PDS_Tag_Line__c ==''  ,false,true)}"> <br/><br/></apex:OutputText> 
<apex:OutputText value="{!qli.Benefit_Headline_1__c}" rendered="{!IF(qli.Benefit_Headline_1__c ==''  ,false,true)}"><br/> </apex:OutputText> 
<apex:OutputText value="{!qli.Benefit_Text_1__c}" rendered="{!IF(qli.Benefit_Text_1__c ==''  ,false,true)}"><br/> </apex:OutputText> 
<apex:OutputText value="{!qli.Benefit_Headline_2__c}" rendered="{!IF(qli.Benefit_Headline_2__c ==''  ,false,true)}"><br/> </apex:OutputText> 
<apex:OutputText value="{!qli.Benefit_Text_2__c}" rendered="{!IF(qli.Benefit_Text_2__c ==''  ,false,true)}"><br/> </apex:OutputText> 
<apex:OutputText value="{!qli.Benefit_Headline_3__c}" rendered="{!IF(qli.Benefit_Headline_3__c ==''  ,false,true)}"><br/> </apex:OutputText> 
<apex:OutputText value="{!qli.Benefit_Text_3__c}" rendered="{!IF(qli.Benefit_Text_3__c ==''  ,false,true)}"><br/> </apex:OutputText> 
<apex:OutputText value="{!qli.PDS_URL_Alias__c}" rendered="{!IF(qli.PDS_URL_Alias__c ==''  ,false,true)}"><br/> </apex:OutputText>                                    
</apex:outputPanel>
</td>
<td>{!qli.UnitPrice}</td>                                                 
<apex:variable var="count" value="{!count+ 1}"/>
</tr>
</apex:repeat>
and it render like this :-
User-added image

how do i make the description highlighted in red to strech from column 1 - column 3?

Thanks.
Hi

Issue is that certain symbols/letters appear broken on the CSV file that has been exported, as by default the encoding is ISO-8859-1.
However forcing it to export in UTF-8 seems to have zero effect - meaning the exported file will still have broken symbols, even though the symbols/letters are displayed correctly in SF itself.

The export function VS page code piece is like this :
 
<apex:page controller="TestPage" cache="true" contentType="text/csv#filename.csv; charset=UTF-8">

Tried the solutions offered in ..

https://developer.salesforce.com/forums/?id=906F0000000962nIAA
http://salesforce.stackexchange.com/questions/16157/attachment-utf-8-character-set
http://salesforce.stackexchange.com/questions/18546/unable-to-display-utf-8-character-in-a-csv-file-generated-from-apex-code
 

Hi all,
while glancing at Governor Limits documentation, I can find  the Maximum size of callout request or response ( 6MB / 12 MB based on context type), but I'm wondering if there are also limits for callin request/response (from external service to Salesforce). I guess that the only limits for a callin response are those about heap size, aren't they? 

Hi,

I have two fields, let’s say A and B, of type Lookup Relationships and they are of cardinality 1-to-n (A could have more than one values of field B).
The business request is to have a new field which lists all the values of of B once A is selected. Both objects are Accounts and they are related to opportunities.
The aim is to have a report which visualizes the results…
 
Thanks in advance,
Skender
 
Hi 
I am havig a user whsoe Licence is Company Communities. I need to add a permission set called Reporter to Company Community licenced user. Reporter permission set is having permission "Edit Report" permission.
I am unable to add this Reporter PS to the user.
Profile for the user is custom profile

Can't assign permission set Reporter to user Demand Manager Europe. The user license doesn't allow the permission: Edit My Reports

please suggest me how to achieve this

-Bala  
Can anyone explain the concept of wrapperclass?

Anyhelpis appreciated!
Thanks
Sujan
I want to get the contacts related to a particular account.So how I write a query for that?
List <Contact> contacts= [Select Name,Id from Contact where (What needs to be written here?)];


Please help.
Thanks inadvance.

i have three text field called first name,middle name,last name.i want to make them unique using admin.how?
I have Picklist called Fuel_Type__c with five values. Once the record saves with value 'Petrol' , This value should never get changed in further updates of the record(Remaining fields can be updated).I tried with validation rule and it is fine.But Could anybody let me know how to do this in Controller? 

So here is my situation. I recently began to realize I need to async more of our code, and learned all about @future (WEEE!) but have quickly come to realize that because we have many moving pieces that @future has limitations (specifically when one @future might trigger another @future).

In queueable, which seems to be the silver knight I have wanted but, I'm having a misunderstanding as to how to go about this (most examples I find show the queuable apex class which I understand but, not understanding how to pass it the values of triggering ID's).

So here is my simple code:

Trigger

 

trigger SalesAreaRelatedOpportunityUpdate on Sales_Area__c (after insert,after update) {
    SalesAreaRelatedOpportunityUpdateClass.processOpportunities(Trigger.newMap.keySet());

}

 

Class

global class SalesAreaRelatedOpportunityUpdateClass {
@future
    public static void processOpportunities(Set<ID> salesAreaId){

    List <Opportunity> updateOps = [SELECT Id FROM Opportunity WHERE IsClosed = False AND (Sales_Area__c in :salesAreaId OR Secondary_Sales_Area__c in :salesAreaId)];
    if(!updateOps.isEmpty()) {
        update updateOps;   
        
    }
                                                                
}
}

What this code does is merely update the related opportunities from a custom object which in turn, triggers other code. Some of that other code due to load needs to be async (and currently is @future, although once I figure out this queueable business I may change it as well).

My question is this---how would I change this pretty basic code to something queable? I'm having some troubles understnading how to pass the keySet in particular. 

Each nght, we run a DOS batch process which uses the Batch Apex Data Loader to query an iSeries database and upload the data to Salesforce. This is a multi-step process, with each step dependent on the previous steps completing correctly. Most times this rus fine. However, recently the process failed when the connection timed out. The job continued, but the data loaded was incomplete, so I had to rerun the process manually the next day.

My question is: Is there some way of detecting the error in the .bat file so that we can stop at the point where the error occurs, rather than proceeding with the rest of the process. SOmething along the lines of using ERRORLEVEL in the bat file. It doesn't have to be sophisticated, I just want to stop processing.

Thanks

Ron Ventura
  • March 23, 2016
  • Like
  • 0

Hi everyone, I am new here and I hope that you could help me !

I want to create a field of a revenue for example, and I want it to increment each year: the revenue of this year is the of this year +( n-1) years. And also have the capability to compare the different values of the same field in different years, to know how it increases...

Thanks a lot.

  • March 23, 2016
  • Like
  • 0
Is there a way to create unit tests for Salesforce to Salesforce without setting SeeAllData=true? 

I can't seem to create test objects for PartnerNetworkRecordConnection and PartnerNetworkConnection. Is there a way to create unit test cases without using live test data for Salesforce to Salesforce? 
I am trying to delete api acCore, however ehom ever set this up has linked it to everything, so i will not delete. How do i override and delete it
Hi guys,
I am need of Test classes.  Here is the trigger.

trigger opportunitycountevent on Event (after insert, after delete) {
    map<id,integer> mopportunityCount = new map<id,integer>();
         integer Countevent =0;
  if (Trigger.isafter){
       if(Trigger.isinsert){

  for(event e :trigger.new) {


    if(e.whatId != null) {
      if(string.valueOf(e.WhatId).left(3) == '006') {
         
         
         if(mopportunityCount.containsKey(e.WhatId)) {
           Countevent  = mopportunityCount.get(e.WhatId);
            }
         
         Countevent  = Countevent   + 1;
      
         mopportunityCount.put(e.whatid,Countevent);
      }
    }
  }
}
 

if(Trigger.isdelete){
  for(event e1 :trigger.old) {
    if(e1.WhatId != null) {
     if(string.valueOf(e1.WhatId).left(3) == '006') {
         
         
         if(mopportunityCount.containsKey(e1.WhatId)) {
           Countevent   = mopportunityCount.get(e1.WhatId);
         }
         Countevent = Countevent - 1;
         mopportunityCount.put(e1.WhatId,Countevent);
      }
    }
  }
}


  if(mopportunityCount.keyset().size()>0) {
    list<opportunity> opportunityToUpdate = new list<opportunity>([SELECT id,Count_of_Activity__c FROM opportunity WHERE Id IN :mopportunityCount.keyset()]);
     for(opportunity o :opportunityToUpdate ) {
     o.Count_of_Activity__c = o.Count_of_Activity__c + mopportunityCount.get(o.id);
    }
   if(opportunityToUpdate.size()>0) {
      update opportunityToUpdate;
    }
   }
  }
  }
 
Hi ,

Why salesforce standard phone is not formating properly in the contact object .If i will enter 10 digits like 8126578954 it should be
(812) 657-8954.But still it is saving as it is.Can you please help me on this.I tried the same thing in internet explorer as well.But no use


Regards,
Isha


 
Can any one help me out with this ?The overall code coverage is displaying  a constant value in production as 74% only, i have written and modiifed 'n' no of test classes and deployed ,but still it displays the constant value.Any suggestion or alternatives where i can get the code coverage increased and can do a deployment successfully.
Hi All,

I have created an email service on opportunity,i got an email address for that email service as 'opportunity_mail@t-14g4wh9lxqs27f99urhsvnojcc6gufofjq3jbl394x9sjsxsdy.28-1ginoeas.ap2.apex.salesforce.com'.when i am adding this email address in Forwarding and POP/IMAP in gmail, i got a message saying ''confirmatio code is sent to opportunity_mail@t-14g4wh9lxqs27f99urhsvnojcc6gufofjq3jbl394x9sjsxsdy.28-1ginoeas.ap2.apex.salesforce.com".Now where can i get that confirmation code?
Hello Everyone,

I want to export knowledge Articles but i am not getting option "Export Articles for Translation" from setup.
System Admin profile is assigned to me which has all the access, where as I created a permission set too and assigned to me. But No luck :(

Permission set has all the setting required like "“Manage Knowledge Article Import/Export”", "Manage Salesforce Knowledge" and “Manage Articles”.

Can anyone help me to resolve this.

Thanks,
Amit Singh
Both approaches have its pros and cons. What do you prefer and why ?
 
Hello!

I found the script below to create a Clone button on Opportunity Product but I am curious if anyone knows how to set values to specific fields like this from a regular Custom Button: "00N36000006vcDW={!IF(MONTH(Opportunity.CloseDate) + 1 == 13, DATE(YEAR( Opportunity.Start_Date__c ) + 1, 01, 01), DATE(YEAR(Opportunity.Start_Date__c ), MONTH(Opportunity.Start_Date__c ) + 1, 01))}& "

Typically it is prety straight forward but just not clear on the syntax to use for setting a few fields.


This script does the job after getting errors with the URL hack but I'm not clear on editing the script to set new field values:

{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")} 
var metadata = sforce.connection.describeSObject('OpportunityLineItem'); 
var dontdo = ['TotalPrice']; //Add fields to blank here. Total price or Unit price is needed at minimum 
var fields = []; 
for (var i = 0; i < metadata.fields.length; i++) { 
if (metadata.fields[i].createable == "true" && dontdo.indexOf(metadata.fields[i].name) == -1){ 
fields.push(metadata.fields[i].name) 


fieldlist = fields.join([separator = ',']) 
var cloner = sforce.connection.query("SELECT " + fieldlist + " from OpportunityLineItem where id ='{!OpportunityLineItem.Id}' limit 1"); 

records = cloner.getArray("records"); 

delete records[0].Id; 
//records[0].Product_Stage__c = 'Closed Won'; // Manually override any fields down here 

result = sforce.connection.create(records); 
var editparams = ''; 
//var editparams = "&00N34000004DVHD=Closed%20Won&00X64000002DBDS=&00N24000006XBDp=&ServiceDate=&VT00S53000003CFSA=&DW00D52000002FXGs="; // Any url hacking style parameters you want added to the edit window when we open the cloned object. Can be used to blank a field that was required forcing the agent to override the default. 
window.location = '/' + result[0]['id'] + "/e?&retURL=" + result[0]['id'] + editparams;
I had a trigger flow that used the field Owner:User.Email as a variable.  When trying to set up the parallel in Process Builder, I found that I couldn't access any owner fields other than OwnerID for a flow variable.  When I tried using update records instead of flows, I couldn't access any owner fields.  

What this meant for me is that I was unable to replicate in Process Builder what I had set up as a flow trigger originally because of reduced functionality.  This is one example that I caught, but I'm sure there are others.

In workflows, it is quite easy to reference field from the record owner.  

Is this intentional?  If not, when can we anticipate a fix?  Thanks!

Workflow owner fields:
Owner fields in workflow

Process Builder owner fields:
Process Builder cannot reference owner fields.