• David Catindoy 101
  • NEWBIE
  • 90 Points
  • Member since 2015
  • Technical Consultant
  • N/A


  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 29
    Replies
Trigger createNotification on Account(After insert, After update)
{
list<Notification__c> notifyList = new list<Notification__c>();
list<user> varUser=[select id,name from user ];

for(account acc:Trigger.new)
{
if(varUser[0].name=='Kanaka konathala')
{
Notification__C notify=new Notification__C();
acc.name=notify.name;
notify.Test__C='Outbound';
notifylist.add(notify);
}
}
if(notifylist.size()>0)
{
insert notifylist;
}
}
Suppose there is a trigger where I don't want exceptions to rollback the entire transaction.  Can savepoints help here?  i don't want to suppress any errors by wrapping a try/catch around everything.  if the trigger gets to a certain point, then the transaction should save regardless of downstream exceptions.

Have you encountered this weird issue as well? I have reported this and Salesforce flag it as a known issue: https://success.salesforce.com/issues_view?id=a1p3A00000031xj

There's a workaround provided but it doesn't seem to work for me.

Hi All,

Does anybody here know how to get access token/authenticate a user from Apex code? I am planning to create a custom integration to automatically create a folder and push files from Salesforce to Sharepoint. Any help is appreciated a lot.

Thanks!
Trigger createNotification on Account(After insert, After update)
{
list<Notification__c> notifyList = new list<Notification__c>();
list<user> varUser=[select id,name from user ];

for(account acc:Trigger.new)
{
if(varUser[0].name=='Kanaka konathala')
{
Notification__C notify=new Notification__C();
acc.name=notify.name;
notify.Test__C='Outbound';
notifylist.add(notify);
}
}
if(notifylist.size()>0)
{
insert notifylist;
}
}
I'm stuck on the Modify the NewURLPolicyCondition Apex Class challenge: Modify the NewURLPolicyCondition Apex class you created in an earlier challenge and change its condition from any time in the past two days to the past week.

I completed the previous challenges in this section with ease but don't see any reference to "in the past two days" so I am not sure how to modify the condition "to the past week". 

Please help!
 
An error occurred at element fuSovContact (FlowRecordUpdate).
UPDATE --- UPDATE FAILED --- ERRORS : (ALL_OR_NONE_OPERATION_ROLLED_BACK) Record rolled back because not all records were valid and the request was using AllOrNone header --- for SFDC record with ID :

Autolaunched Flow causing error I am unable to identify a pattern...

Consider the following use case:
When you put a case into a "resolved" status a time-based workflow fires and closes the case after 7 days.
When a case closes an email is sent to the contact, at the same time the contact is updated indicating the last time they were surveyed (eg. at case closure).
ProcessBuilder (detects a change in the case, eg it is closed) and Flow handles the email sending and contact update.

It would seem that the bulkification of Flow is not handling this situation correctly and throws the above mentioned error for no detectable reason.
------------------------------------------------------------------------------------------------------

Consider a simplified Process Builder + Flow created in a pretty bare development org:
ProcessBuilder calls flow everytime a case is updated.
Flow takes the case as input, looks up the contact associated with the case and updates the contact, setting a date/time field.  
(I am guessing the objects involved are not important, but the manner in which the bulkification occurs in salesforce when processing flow is...)


Consider the following data, rows 1-23.  These are cases that when updated will trigger the flow and recreate the exception scenario.  When I say "updated" I mean simply doing an update on the Case Id column to get the flow to fire and not actually changing any data...

Update rows 1-20 = success.
Update rows 1-21 = failure.
Update rows 1-19, 21 = success.
Update rows 1-20, 22 = success.
Update rows 1-20, 22, 23 = failure.
Update rows 1-20, 23 = success.

    CaseId                ContactId            ContactName
1    500i0000005M1gbAAC    003i000000W2jqIAAR    Babara Levy
2    500i0000005M1gaAAC    003i000000W2jqIAAR    Babara Levy
3    500i0000005M1gnAAC    003i000000W2jqPAAR    Edna Frank
4    500i0000005M1gdAAC    003i000000W2jqPAAR    Edna Frank
5    500i0000005M1gqAAC    003i000000W2jqBAAR    Jack Rogers
6    500i0000005M1grAAC    003i000000W2jqBAAR    Jack Rogers
7   500i0000005M1gkAAC    003i000000W2jqFAAR    John Bond
8    500i0000005M1glAAC    003i000000W2jqFAAR    John Bond
9    500i000000d9FFBAA2    003i000003dL7FmAAK    Johnnyt Slick
10    500i000000d9FG9AAM    003i000003dL7FmAAK    Johnnyt Slick
11    500i000000dqVOWAA2    003i000003dL7FmAAK    Johnnyt Slick
12    500i0000005M1gvAAC    003i000000W2jqHAAR    Lauren Boyle
13    500i0000005M1gwAAC    003i000000W2jqHAAR    Lauren Boyle
14    500i0000005M1giAAC    003i000000W2jqOAAR    Liz D'Cruz
15    500i0000005M1gmAAC    003i000000W2jqOAAR    Liz D'Cruz
16    500i0000005M1gpAAC    003i000000W2jqAAAR    Sean Forbes
17    500i0000005M1goAAC    003i000000W2jqAAAR    Sean Forbes
18    500i0000005M1guAAC    003i000000W2jqGAAR    Stella Pavlova
19    500i0000005M1gsAAC    003i000000W2jqGAAR    Stella Pavlova
20    500i0000005M1gtAAC    003i000000W2jqGAAR    Stella Pavlova
21    500i0000005M1gZAAS    003i000000W2jqGAAR    Stella Pavlova
22    500i0000005M1gfAAC    003i000000W2jqEAAR    Tim Barr
23    500i0000005M1geAAC    003i000000W2jqEAAR    Tim Barr

 
Hello Community,

Can I have 2 standard controller on a single visualforce page. If yes, Can someone explain. If not, Can someone explain me what is the use of multiple extensions.
We have an email template that we want to send out to our customer's 7 days after we complete their job. We have all of the settings in place except we can't figure out how to add the customer's email address as a receipient. Does anyone know how can I add the customer's email address? We currently set it to send to our customer service email address but we'd like to change it to our customer's email address. Please advise if anyone knows how to do this.

Email Alerts
Hi Guys,

I have two customized objects called 'Conference' (Parent) and 'Attendee' (Child). In the object of 'Attendee', we only have one field called Name which our SF users can lookup their names and register the conference. Now, i don't want user can register a same conference more than once. How can i do that? This is my first time to write a trigger.  Any help is greatly appreciated.  Thank you.
Hi Friends

I have created a vf page which uplaod file its working fine ,but i am facing problem when file is more than 135KB.i have used transient variable also
but facing same..Is there any other way to achieve this challenge.
public with sharing class CCW_UploadFileController {

    public Purchase_Order__c purchaseOrder{get;set;}
    public  Attachment tAttachment{get{
                                        if(tAttachment== null)
                                          tAttachment= new Attachment();
                                        return tAttachment;
                                     }set;}
    
    public boolean showC1RecordType {get;set;}
    public boolean showC2RecordType {get;set;} 
    
    private Id c1RecordTypeId; 
    private Id c2RecordTypeId;
    
 
    public CCW_UploadFileController(ApexPages.StandardController controller)
    {
 
       
        this.tAttachment = new Attachment();
        c1RecordTypeId = Schema.SObjectType.Purchase_Order__c.getRecordTypeInfosByName().get('C1').getRecordTypeId();
        c2RecordTypeId = Schema.SObjectType.Purchase_Order__c.getRecordTypeInfosByName().get('C2').getRecordTypeId();
        
        purchaseOrder = new Purchase_Order__c();
        purchaseOrder = (Purchase_Order__c)controller.getRecord();
         
        String isButtonClicked = Apexpages.currentPage().getParameters().get('setDefaultValues');
        if(isButtonClicked == 'true'){
            setDefaultValues();
        }
        
        showC1RecordType = false;
        showC2RecordType = false;
        tAttachment= new Attachment();
        
        
        if(purchaseOrder.RecordTypeId == c1RecordTypeId){
            showC1RecordType = true;
            showC2RecordType = false;
        }
        else if(purchaseOrder.RecordTypeId == c2RecordTypeId){
            showC1RecordType = false;
            showC2RecordType = true;
        }
        
    }
    
     public void setDefaultValues(){
        String quoteId = Apexpages.currentPage().getParameters().get('quoteId');
        Quote__c quote = [Select o.id, o.name, o.Quantity_formula__c, o.Opportunity_Product_Detail__r.Opportunity__c,
                    o.Opportunity__c, o.Record_type_name__c,o.Company_Name__c,Opportunity_Product_Detail__r.Opportunity__r.Account__c from Quote__c o WHERE O.id=:quoteId];
        //system.assert(false,quote);     
        purchaseOrder.Opportunity__c = quote.Opportunity_Product_Detail__r.Opportunity__c;
        purchaseOrder.Quote__c = quote.id;
        purchaseOrder.Company__c = quote.Opportunity_Product_Detail__r.Opportunity__r.Account__c;
        
        if(quote.Record_type_name__c == 'C1'){
            purchaseOrder.RecordTypeId = c1RecordTypeId;
        }
        else {
            purchaseOrder.RecordTypeId = c2RecordTypeId;
        }
    }
 
    
 
   
    public PageReference doUploadFile(){
 
        if(tAttachment.Body == null){
            Apexpages.addMessage(new Apexpages.Message(Apexpages.Severity.ERROR, 'Please upload recent Purchase Order  before saving the record'));
            return null;
        }
        else{
            try{
                insert purchaseOrder;
                
              tAttachment.OwnerId = UserInfo.getUserId();
               tAttachment.ParentId = purchaseOrder.id;
              insert tAttachment;
                
                
                return new PageReference('/'+purchaseOrder.id);
            }
            catch(DMLException e){
                ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,e.getMessage()));
                return null;
            }
        }
    }
}

 
I am not giving any color code in record,I need to  get   the color  code dynamically .Please tell me how to acheive tiz
if Color__c = Pink
Color Code =780,

Like this i have  50 Color,How to acheive this
Hi All,

Need your help, curently we have issues when we reply/answer the case will show the notification "Error: You can't reply to this reply because the originating comment not in salesforce".
Need your advice.

Fery
Hello

I have written a simple trigger to convert lead to contact.
It has an error I can't understand:
Error
Reason: Could not process your referral.
common.exception.SfdcSqlException: ORA-20025:
ORA-06512: at "SNEEZY.CACCESS", line 2399
ORA-06512: at "SNEEZY.CACCESS", line 585
ORA-06512: at "SNEEZY.CACCESS", line 656
ORA-06512: at "SNEEZY.CTASK", line 552
ORA-06512: at line 1


{call cTask.insert_tasks(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

{call cTask.insert_tasks(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

I have found several links about this error:
https://developer.salesforce.com/forums/?id=906F0000000An21IAC

https://success.salesforce.com/issues_view?id=a1p30000000Sup5AAC

The scond link suggests the following:
Repro
Conditions that cause this: 
- database.leadConvert is executed for the lead inside Lead after insert trigger. 
- There is workflow associated with the Lead to create a new task as an immediate action.
Workaround
Set the workflows's "new task" task as time-dependent instead of immediate. The problem only manifest itself if the task is created at the same time the lead is converted.

Has anyone done this before? Set the workflows's "new task" task as time-dependent...?

Thank you
I have a batch that's been running for years that started failing because of First error: Access to entity 'MatchingInformation' denied.  I've searched around and can't find anything about this and I can't find any object or class in salesforce called MatchingInformation.  It doesn't happen each time this batch runs, it seems to be arbitrary and can happen with any set of arguments.  The batch is below, simply it updates a list of records with a defined value.
 
global class util_sObjectFieldUpdaterBatch implements Database.Batchable<sobject>, Database.Stateful {

    /**
    Run This Batch

    string query = ;
    string nextBatch = ;
    string sObj = ;
    string field = ;
    object changeTo = ;
    integer batSize = ;
    
    ID idBatch = Database.executeBatch(new util_sObjectFieldUpdaterBatch(query,nextBatch,sObj,field,changeTo), batSize);
    **/

    global string query;
    global string nextBatch;

    global string sObjName;
    global string sObjFieldName;
    global sObjectType sObjType;
    global sObjectField sObjField;

    global object changeTo;

    private Map<String, Schema.SObjectType> smap = Schema.getGlobalDescribe();

    global integer NumBatches;
    
    global util_sObjectFieldUpdaterBatch(String qry, string nextBat, string obj, string field, object changeObj) {

        Query = qry;
        
        nextBatch = nextBat;

        sObjName = obj;
        
        changeTo = changeObj;

        SObjectType sObjType;

        if(smap.get(obj) != null){

            sObjType = smap.get(obj);

            Map<String,Schema.SObjectField> fieldMap = sObjType.getDescribe().fields.getMap(); 

            if(fieldMap.get(field) != null){
                
            	sObjFieldName = field;

            	sObjField = fieldMap.get(field);

            }

        }

    }
    
    global Database.QueryLocator start(Database.BatchableContext bcMain) {
        return Database.getQueryLocator(Query);
    }
    
    global void execute(Database.BatchableContext bcMain, List<sObject> scope) {

        for(sObject s : scope){
        	s.put(sObjField, changeTo);
        }

        if(scope.size() > 0) { 
            update scope; 
        }
    }
    
    global void finish(Database.BatchableContext bcMain) {

    } 
	
}

 
We've been having trouble with lead inserts both via VisualForce pages andvia Web-to-Lead. Here is the error email of the first failed Lead insert of this type.

Please help! This is a huge problem and we havene't found a solution other than removing the most important fields from our forms, including Email address.


From: support@emea.salesforce.com <support@emea.salesforce.com>
Date: Sat, Jul 19, 2014 at 11:50 AM
Subject: Salesforce Could Not Create This Lead
To: ""

Salesforce could not create this lead because of the reason listed below. We will try creating the lead again. For more information about this error or help with Web-to-Lead, please contact Customer Support.

Reason: Your Lead could not be processed.
common.exception.SfdcSqlException: ORA-20025:
ORA-06512: at "HAPPY.CACCESS", line 2258
ORA-06512: at "HAPPY.CACCESS", line 579
ORA-06512: at "HAPPY.CACCESS", line 650
ORA-06512: at "HAPPY.CTASK", line 565
ORA-06512: at line 1


{call cTask.insert_tasks(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}

{call cTask.insert_tasks(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}
    Lead Capture Page: http://www.zzz.php

Record Information:

<LIST OF FIELDS>

To incorporate this lead into salesforce.com you can key in the data above.

If you have any questions, please click on Support at the top right of any page within salesforce.com.

Customer Support
salesforce.com