• Rajesh_Shah
  • NEWBIE
  • 115 Points
  • Member since 2012

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 14
    Replies

Hi Guys, 

Just wondering if it is possible to create a trigger whereby everytime a Lead is converted and the user is creating a NEW Account and NEW Opportunity (not converting to an existing Account) that the trigger scans all existing Accounts (org-wide) before the records are created and looks for possible matches on the Date of Birth, Name, and Email fields used on the Lead. 

Essentially the spec is; 

  • User is trying to convert a Lead 
  • User is selecting to create a new Account and Opportunity
  • Trigger scans all existing Accounts for matches on the Date of Birth, Name and Email fields
  • Trigger returns a warning when matches are found

Field API names - 

 

  • Name 
  • Date_of_Birth__pc
  • PersonEmail
Hi Experts,

Below trigger is firing for new records as well but i dont want to be fired for new records which i am creating i need only for update. Kindly help me out..

Trigger Trigger_Case on Case(before Update){
    CaseHandler.updateObjectField(Trigger.New, Trigger.oldMap);
}

public class CaseHandler{
    static Map<String, Schema.SObjectField> schemaFieldMap = Schema.SObjectType.Case.fields.getMap();
    static Map<String, Case> queriedFieldValues = new Map<String, Case>();
    public static void updateObjectField(List<Case> lstObject, Map<Id, Case> oldMap){
        for(Case obj : lstObject){
            for (String fieldName: schemaFieldMap.keySet()) {
                if(obj.get(fieldName) != oldMap.get(obj.Id).get(fieldName)){
                    obj.put('Status', 'New');
                }
            }
        }
    }
}

Guys...

 

Has any body faced this issue?

 

integer exponent2 = 2^8;
system.debug('Exponent ' +exponent2);

 

Output is:

10 (Actual value should be 256)

 

 

As per Salesforce Manual:

Math Operator ^  Raises a number to a power of a specified number.

 

HI,

 

           I  Have Create one button like  Done button ( through buttons and links )  and I provide  functionality for that buton , suppose  once Done buttons Clicked on   the edit button  shoild not work  i can i  stop this  ,plz let me  informatiion  Know   how to  implement

 

Thanks,,,,,,

  • September 15, 2012
  • Like
  • 0

I have a CTI adaptor installed (Five9). I updated the softphone layout to pop custom visualforce screens for inbound calls. It is working fine. The issue is for outbound call. The outbound call settings for Softphone layout are the defaults which I haven't changed. However, even for outbound calls, the Custom Visualforce screen gets popped up. 

 

Is this a bug in Salesforce or is there a setting I am missing?

 

 

Hi,

 

I am having an issue related to ContentVersion query which I believe is because of File Settings. A file uploaded to a feed of a record is for me privately Shared and hence the ContentVersion query is not working for it. When I looked at Salesforce help, I found confusing information. Here is the link:

File Sharing Settings and Permissions

 

If you look at the Sharing reason for Privately Shared, one of the reason stated is 'When the file is posted to a feed on a record'. Now this same reason is also mentioned for Your Company. This is confusing. Which one is true?

 

I have an application through which I allow users to upload file or paste data in Text Area which I then upload as an attachment. These attachment then also used for creating or updating the Content File related to the Contact. 

 

When the file is uploaded, the preview in the content comes fine. However, when I paste the content of the file in Text area, and when the Content feed is created or updated, the preview doesn't come. Has anybody faced this issue before? Also attaching the code for the same:

 

// Inserting attachment
Resume.Body = Blob.valueOf(ResumeText);
Resume.ContentType = 'application/msword';
Resume.ParentId = contactId;
insert resume;

// Insert/Update Content
cdl = [SELECT ContentDocumentId 
                       FROM ContentDocumentLink 
                       WHERE LinkedEntityId = :Resume.ParentId 
                       ORDER BY SystemModstamp          
                       limit 1];
ContentVersion cv = new ContentVersion();
cv.ContentDocumentId = cdl.ContentDocumentId;
cv.VersionData = Resume.Body;
cv.PathOnClient = Resume.Name;                  
insert cv;

 

Hi Guys, 

Just wondering if it is possible to create a trigger whereby everytime a Lead is converted and the user is creating a NEW Account and NEW Opportunity (not converting to an existing Account) that the trigger scans all existing Accounts (org-wide) before the records are created and looks for possible matches on the Date of Birth, Name, and Email fields used on the Lead. 

Essentially the spec is; 

  • User is trying to convert a Lead 
  • User is selecting to create a new Account and Opportunity
  • Trigger scans all existing Accounts for matches on the Date of Birth, Name and Email fields
  • Trigger returns a warning when matches are found

Field API names - 

 

  • Name 
  • Date_of_Birth__pc
  • PersonEmail
Hi Experts,

Below trigger is firing for new records as well but i dont want to be fired for new records which i am creating i need only for update. Kindly help me out..

Trigger Trigger_Case on Case(before Update){
    CaseHandler.updateObjectField(Trigger.New, Trigger.oldMap);
}

public class CaseHandler{
    static Map<String, Schema.SObjectField> schemaFieldMap = Schema.SObjectType.Case.fields.getMap();
    static Map<String, Case> queriedFieldValues = new Map<String, Case>();
    public static void updateObjectField(List<Case> lstObject, Map<Id, Case> oldMap){
        for(Case obj : lstObject){
            for (String fieldName: schemaFieldMap.keySet()) {
                if(obj.get(fieldName) != oldMap.get(obj.Id).get(fieldName)){
                    obj.put('Status', 'New');
                }
            }
        }
    }
}

Hi,

I have  custom object in Salesforce name  'Project' and It has a Picklist Field 'Proj Implementation' Type.

and my second custom object is name 'SEC' and it has picklist(Multiselect) field name 'SEC DD'.

I want to compare if  value of 'Proj Implementatuon Type' equals to 'SEC DD' then add some records.

 

How can i do this comparison?

 

also How to retrieve and split the values of multiselect picklist to achieve the result?

 

Can anyone plz send me code?

 

Thanks

Rajashri

Hi,

 

If an email is sent to multiple addresses and these emails are then forwarded to salesforce email service auto generated email address, then is there a  way we can find out which email address is being processed currently?

 

Thanks,

Shruti

Hi,

 

any one can help on the below  issue,

 

i want to update the case field using work flow when  email is sent 

 

my condition is it should check if 

1) Toaddress does not contains @gmail.com (if the To address will have one email address Ex:   test@gmail.com)

Update case field

 

OR

 

2) Toaddress contains @gmail.com and doesnot contains @gmail.com(if To addres contain more than one email address  Ex: test@gmail.com ,test@yahoo.com)

update case field

 

 

Guys...

 

Has any body faced this issue?

 

integer exponent2 = 2^8;
system.debug('Exponent ' +exponent2);

 

Output is:

10 (Actual value should be 256)

 

 

As per Salesforce Manual:

Math Operator ^  Raises a number to a power of a specified number.

 

what are the wrapper classes when are we going to use these warapper.is it neccasary to use everytime when we create a custome controller.

HI,

 

           I  Have Create one button like  Done button ( through buttons and links )  and I provide  functionality for that buton , suppose  once Done buttons Clicked on   the edit button  shoild not work  i can i  stop this  ,plz let me  informatiion  Know   how to  implement

 

Thanks,,,,,,

  • September 15, 2012
  • Like
  • 0

I have an application through which I allow users to upload file or paste data in Text Area which I then upload as an attachment. These attachment then also used for creating or updating the Content File related to the Contact. 

 

When the file is uploaded, the preview in the content comes fine. However, when I paste the content of the file in Text area, and when the Content feed is created or updated, the preview doesn't come. Has anybody faced this issue before? Also attaching the code for the same:

 

// Inserting attachment
Resume.Body = Blob.valueOf(ResumeText);
Resume.ContentType = 'application/msword';
Resume.ParentId = contactId;
insert resume;

// Insert/Update Content
cdl = [SELECT ContentDocumentId 
                       FROM ContentDocumentLink 
                       WHERE LinkedEntityId = :Resume.ParentId 
                       ORDER BY SystemModstamp          
                       limit 1];
ContentVersion cv = new ContentVersion();
cv.ContentDocumentId = cdl.ContentDocumentId;
cv.VersionData = Resume.Body;
cv.PathOnClient = Resume.Name;                  
insert cv;

 

I like using Chatter Files for Attachments because they are prettier and searchable. The downside is that, when you add one to an Opporutunity, you don't see it as an Attachment on the Account like an old-skool Attachment would.

 

So I am working on a trigger where, if a user posts a Chatter File to an Opportunity, it also links it up to the Account. Sample code is below. I am successfully checking for it being a Chatter File (ContentPost) and only running when linked to an Opportunity, but the trigger runs whether I am adding a new file and also if I am associating an existing file to an Opportunity.

 

Any ideas how to determine whether the ContentPost is using a new Chatter File or an Existing one?

 

for (FeedItem f: fis){

    String parentIdString = String.valueOf(f.parentId);

    if (parentIdString.startsWith(Opportunity.sObjectType.getDescribe().getKeyPrefix()) && f.type == 'ContentPost'){
        Opportunity o = [select id, accountId from Opportunity where id = :f.ParentId limit 1][0];
        if(o.AccountId != null){
            FeedItem newFI = new FeedItem();
                newFI.Type = 'ContentPost';
                newFI.RelatedRecordId = f.RelatedRecordId;
                newFI.ParentId = o.AccountId;
                newFI.title = f.title;
            insert newFI;
        }

    }

}

 NOTE: I am already aware of the issue with querying and DML in the loop. I will fix that later. I am mostly concerned with getting the scenario correctly handled.

 

 

  • August 31, 2012
  • Like
  • 0