• Vinit_Kumar
  • ALL STAR
  • 5524 Points
  • Member since 2013
  • Technical Lead
  • Dell Services


  • Chatter
    Feed
  • 172
    Best Answers
  • 0
    Likes Received
  • 12
    Likes Given
  • 0
    Questions
  • 1531
    Replies
Hi All,


Can we use validation rules to make field available for user when the stage of an opportunity is changed? For example, User needs to enter comments particular to that stage change when they change it from "In discussion" to "WON". Like wise for every stage change they record in salesforce, they have to add some comments in the newly avaiable text area.

Can this be achieved?

  • August 11, 2014
  • Like
  • 0
During deploying my App from sandbox to production environment I have got 1 error message that there is a duplication of Workflow field update data type ( see attached screenshot).

What I should do next? Delete this Change set in production environment and the same on sandbox and start again from the scrutch without adding this one field update? Or is there a way to remowe this component from change sets component list and try again?

Thanks for any help.

LukaszDeployment failure details view.

HI I have following VF page 
<apex:page StandardController="Opportunity" extensions="DeleteOpportunityLIneItems" action="{!Autorun}"  >

</apex:page>

it called controller
public class DeleteOpportunityLIneItems {

    Opportunity oli;

    public DeleteOpportunityLIneItems(ApexPages.StandardController stdController){
    
        this.oli = (Opportunity)stdController.getRecord();

    } 
       
    public PageReference autoRun() {
        
        OpportunityLineItem[] objsToDelete = [SELECT id FROM OpportunityLIneItem WHERE Opportunityid = :this.oli.id];
           


        delete objsToDelete;
            
        PageReference pageRef = new PageReference('/' + Oli.id);
        pageRef.setRedirect(true);
        return pageRef;
        }  
    }

this controller deletes all Opportunity Line items, ti works just fin, is there any way i can add a prompt to ask user Are yo USure you want to delete?
If they say yes then Delete if they say No then go back to the Opportunity page, i tried numebr us thisng but i cna get th eprobpt appear stright away, i moves me to VF page with command button then it prompts me if i'm sure, is ther any way to go directly to prompt and hten execute controller?
Hi,

I have registered a trial version of Enterprise Edition, but I not able to see the sandbox option. Does Salesforce already remove that?

Hi, 

I'm trying to check a checkbox on the parent opportunity when a child record is created. 

When I test the trigger below, the debug log says the checkbox has been updated to true. However when I check the opportunity is has not. I'm quite new to developing in general so apologies if this is something obvious: 

trigger updateOppCb on Bonus_Calculator__c (before insert) {
   
        // Create a set of related opps
        set <id> ids = new set <id>();
        for (Bonus_Calculator__c newSet : Trigger.new)
        ids.add(newSet.opportunity__c);

        // Add child? checkbox to map
        map <id,Opportunity> childMap = new map<id,Opportunity>();
        for (Opportunity o:[select child__c from opportunity where id in :ids])
        childMap.put(o.id, o);
   
     for (Bonus_Calculator__c newBonus : Trigger.new) {
           
            Opportunity o = childMap.get(newBonus.opportunity__c);
            o.child__c = true;
            system.debug('opportunity = '+ o);
   }
}

 

...Thanks a million for any help!

  • July 10, 2014
  • Like
  • 0
Hi ,

I have a requirement to hide a button on pageload based on the value of the field on the samepage which get value from a controller. I have written JS on window load but it is not executing. Any thoughts on how to achieve this? 


Regards
Mohan Krishna
Hey all, 

I have the following rule that works well:

AND(
NOT ISBLANK(MailingState),
LEN(MailingState )<>2
)


However, I need to exclude two record types called 'student' and 'professional' - how can I do that here without breaking the rule?

Thanks!
Hi,

I'm writing a trigger which copies data from the Campaign Member to its Campaign (as cross object workflows don't work from Campaign Members).

I've hit a problem with my test class that I can't get around:

Invalid initial expression type for field Campaign, expecting: SOBJECT:Campaign (or single row query result of that type)

The error is on Line 40, which says:

        CampaignMember cm = new CampaignMember(Campaign = cam.Id, Contact = c.Id, Send_tutor_details_to_client__c = 'First');

This is the whole of the test class:

@isTest 
public class TestUpdateTutor1onCampaign{

        static testMethod void TestUpdateTutor1onCampaign() {
       // create an Account, a Tutor, a Job and a Job Member
  
       Profile p = [SELECT Id FROM Profile WHERE Name='System Administrator']; 
       User u = new User(Alias = 'standt', Email='standarduser@testorg.com', 
       EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', 
       LocaleSidKey='en_US', ProfileId = p.Id, 
       TimeZoneSidKey='America/Los_Angeles', UserName='4323f1a8-2698-44c4-a234-dfcf80fa6a6c@testorg.com');
        
       test.StartTest();
       insert u;
       u = [SELECT Id FROM User WHERE Alias = 'standt' AND Email='standarduser@testorg.com'];
      
       Account acc = new Account(Name = 'Test Account');
       insert acc;

       acc = [SELECT Id FROM Account WHERE Name = 'Test Account'];
       
       //Get the Contact record types
       List<RecordType> listRecordTypes = [Select Name, Id From RecordType where sObjectType='Contact' and isActive=true];
       Map<String,String> mapRecordTypes = new Map<String,String>();
       for(RecordType rt: listRecordTypes) {
           mapRecordTypes.put(rt.Name,rt.Id);
       }      

       Contact c = new Contact(AccountID = acc.Id, FirstName = 'Test', LastName = 'Contact', Main_Profile__c = 'www.google.com',
                               RecordTypeId = mapRecordTypes.Get('Tutor') 
                               );
        insert c;
        c = [SELECT Id FROM Contact WHERE FirstName = 'Test'];
        
        Campaign cam = new Campaign(Name = 'Test Job');
        insert cam;
        cam = [SELECT Id FROM Campaign WHERE Name = 'Test Job'];
            
        // insert a Campaign Member
        CampaignMember cm = new CampaignMember(Campaign = cam.Id, Contact = c.Id, Send_tutor_details_to_client__c = 'First');
        insert cm;
        cm = [SELECT Id FROM CampaignMember WHERE Contact =: c.Id AND Send_tutor_details_to_client__c = 'First' ];
        
        system.assertEquals(cam.Tutor_1__c, cm.Tutor_details_for_email__c);
        
        List<Campaign> camtest = [SELECT Id FROM Campaign WHERE Tutor_1__c =: cm.Tutor_details_for_email__c];
        
        system.assertEquals(1, camtest.size());

       test.StopTest();
    }

}

Any help would be greatly appreciated!

Hi,

I get the following error:

Compile Error: unexpected token: ','
public Integer getNoOfEZR() { Integer NoOfEZR = [SELECT Count() FROM Einzelrisiko__c WHERE Left(Versicherungsscheinnummer__c,7) = 5758199]; return NoOfEZR; }
Where is my mistake?

Thank you,
Sascha

 Is it possible to dynamically select a Static Resource based on a user variable to load an image on a Visualforce page? I know it is not a best practice to use conditional logic on a VF page. I want to change a logo on the top of a VF PDF based on the division of the user genrating the PDF. Thank you.
Trying to alter some SOQL in my environment to filter on Account Owner rather than Contact Owner. Now I'm used to SQL and find SOQL maddening as I am not fully to grips with the syntax to do things I would find matter of fact in SQL. Here is what I have:

allcontacts=[select id, firstname, lastname, speciality__c, account.name, pcm_contact_type__c, account.ownerid, account.shippingpostalcode, account.target_account__c 
                           from contact 
                           where
                           Id not in (select contact__c from PCM_Activity_Attendee__c where PCM_Activity__c=:stdCtrl.getId())
                           and firstname like :'%' + search.firstname + '%'
                           and lastname like :'%' + search.lastname + '%'
                           and (pcm_contact_type__c like :search.pcm_contact_type__c+ '%' )
                           and account.name like :'%' + search.department + '%'           
                           and account.shippingpostalcode like :'%' + search.MailingPostalCode + '%'
                           and account.ownerid not in (select account.ownerid from account where account.ownerid=:search.profession__c)
                           and Account.RecordTypeId = '01230000000Y77V'
                           order by account.name asc, lastname, firstname
                           limit 50];
It is the bolded line that is the issue. 

If anyone can point out the logic to me so I can learn from this, that would be great!

Hi all!
I created vf page and  when I try to save a new record, I get an error: "System.NullPointerException: Attempt to de-reference a null object
Error is in expression '{!Save}' in component <apex:commandButton> in page te_new". 
Can someone tell me, where I'm wrong?
Vf page code:
<apex:page standardController="Travel_Expenses__c" extensions="TE_Object">
    <apex:form >
        <apex:pageBlock title="Travel Information Edit"  mode="edit">
            <apex:pageBlockButtons >
                    <apex:commandButton action="{!Save}" value="Save"/>
                    <apex:commandButton action="{!SaveAndNew}" value="Save & New"/>
                    <apex:commandButton action="{!Cancel}" value="Cancel"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Information" columns="2" >
                <apex:pageBlockSectionItem >
                    Travel Information
                    <apex:inputField value="{!NewTE.Traveler__c}" required="true"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    Expense Type
                    <apex:inputField value="{!NewTE.Expense_Type__c}" required="true"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    Amount
                    <apex:inputField value="{!NewTE.Amount__c}" required="true"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    Country
                    <apex:inputField value="{!NewTE.Country__c}" />
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    Inventory Number
                    <apex:inputField value="{!NewTE.Inventory_Number__c}"/>
                </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                    Description
                    <apex:inputField value="{!NewTE.Description__c}" required="true"/>
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>
apex class:
public class TE_Object 
{
    public Travel_Expenses__c NewTE{get;set;}
    public TE_Object(ApexPages.StandardController controller) {

    }
    
    public pagereference Save()
    {
        try 
        {
            insert NewTE; //Error message on this line
        } 
        catch(System.DMLException e) 
        {
            ApexPages.addMessages(e);
            return null;
        }  
        return null;
    }
    public pagereference SaveAndNew()
    {
        try 
        {  
            insert NewTE; 
        } 
        catch(System.DMLException e) 
        {
            ApexPages.addMessages(e);
            return null;
        }   
        return (new ApexPages.StandardController(new Travel_Expenses__c())).edit();   
    }
    
}



Hi,
I'll apologize ahead of time...

I have some class code that inserts records to a custom object and works fine in anonymouse as long as I comment out the class and method lines at the top.  I have to put this class in a schedule and the schedule runs but the class does NOT execute.  I fear I'm missing something very basic, but at this point, I'm in quicksand.  Here's the code... very simple:

public class Daily_SD_Insert_SVIRA {
    public static void DoSDInsert() {

        date tdy = system.date.today();
        date SvcDate = system.date.today();
        date FirstofLast = date.valueOf(system.date.newInstance(system.today().year(),system.today().month()-1,01));
        date LastofLast = FirstofLast.addMonths(1).toStartofMonth().addDays(-1);
        string IPRecType = '012Z00000004nSCIAY';
        string SDRecType = '012Z00000004nS7IAI';
        string MSRecType = '012F0000000muqTIAQ';
//SD Inserts
        //Create SD Lists
        List<Individual_Programs__c> IPRGSD1 = [select Id, service__c from individual_programs__c where (
        (Status__c = 'Enrolled' and enroll_date__c < today )
        and RecordTypeId = :IPRecType and
            Id NOT IN (Select Individual_Program__c from service_documentation__c where
                       service_date__c = :SvcDate and RecordTypeID = :SDRecType))];
          
        system.debug('IPRGSD1 = '+IPRGSD1);
        List<service_documentation__c> sda = new List<service_documentation__c>();
        //Insert SD
        INTEGER ipcnt = 0;
        for (Individual_Programs__c IPRGSD : IPRGSD1) {
                                    sda.add (new service_documentation__c(
                                    service_Date__c = SvcDate,       
                                    Billable_hours__c = 0,
                                    Billable_minutes__c = 0,
                                    RecordTypeId = SDRecType,
                                    service__c = IPRGSD.service__c,
                                    Individual_Program__c = IPRGSD.Id));
                                system.debug('IPRGSD-Individual_Program__c = '+IPRGSD.Id+ ' |count:'+ipcnt);
                                ipcnt = ipcnt+1;
                            }
                    Database.insert(sda);
                    }
                    }

Thanks ahead of time...

Marty
Hello everyone,

I have installed the app from appexchange "Salesforce for Facebook and Twitter", and every time I create a case from a conversation, it assigns automatically to myself as the owner.
I tried to use an assignment rule to change it to a queue, but that doesn't seem to be working.
Any suggestions on how to change the owner to a desired queue?
Thank you!
Hi all,
I want to migrate my metadata from dev sandbox to devpro sandbox... can someone suggest me what to do ???
Its my first time using any migration technique..
Thanks for help in advance
Trying to Deploy a Trigger from sandbox to production, getting these 3 failed components upon validation of change set:

API NAME: ChatterAnswersEscalationTriggerTest.validateQuestionEscalation()
PROBLEM: Failure Message: "System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []", Failure Stack Trace:


API NAME: MyProfilePageControllerTest.testSave()
PROBLEM: Failure Message: "System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Number needs to be in (999) 999-9999 format.: [Phone]", Failure Stack Trace: "Class.MyProfilePageControllerTest.testSave: line 34, column 1"


API NAME: chatter_answers_question_escalation_to_case_trigger
PROBLEM: Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required


Any suggestions/advice to get this change set to deploy would be EXTREMELY helpful.  Thanks in advance

This is the first time I have used an Apex trigger and I am struggling to get it to work. I took the code used from here https://developer.salesforce.com/forums?id=906F00000008yXUIAY. And then adjusted it so it fit for leads and the names of fields I currently have in my for my leads. I am not getting any errors now, but the code does not seem to be doing anything and is active. The items I changed were changing any opportunity or opp to lead, whatid to id to get rid of errors, and the name of fields. What i want to have happen is the subject of activities to become its own field, and only display the last activity subject. The Last_Activity_Date_c field is a field I created that uses a simple formula that pulls the last activity date through. If anyone has any insight it would be greatly appreciated. Here is my code for reference:

trigger NextTastInfo on Lead (after insert, after update) {
          

  if(Trigger.new.size() == 1 ) {

    Lead tk = Trigger.New[0];
    String str = tk.id;
    if(str != null && str.substring(0,3)== '006')
    {

         Lead lead = [select OwnerId,Last_Activity_Subject__c,Last_Activity_Date__c from Lead where Id = :tk.id ];

        List<Task> tskMin = [Select ActivityDate,Subject From Task where id=:tk.id and  what.type = 'Lead' and isClosed = false order By ActivityDate limit 1];

        if (tskMin.size()>0) {
                lead.Next_Step_Date__c=tskMin[0].ActivityDate;
                lead.Last_Activity_Subject__c=tskMin[0].Subject;
        }
        else {
                lead.Next_Step_Date__c=null;      
                lead.Last_Activity_Subject__c='';
        }
        update lead;
    }
}
}
Hi,

       Is there any option to fetch file extention in ContentVersion SObject. I am trying to fetch the extention to block file.

      So any one know the solution. Please let me know ASAP.

Thanks.
HI,

         Can anyone give me test class for my below trigger, i can't understand how to start the test class for my trigger

     
trigger updatequotestatus on task (after insert, after update){
    set<Id> quoteIds = new set<Id>();
    list<quote__c> quotes = new list<quote__c>();
      for(task t:trigger.new){
   
       if(t.whatId!=null){

        if((t.whatid.getsobjecttype()==quote__c.sobjecttype)){
            quoteIds.add(t.whatId);
        }
      } 
    }
    for(quote__c q:[select StageName__c from quote__c where Id IN : quoteIds]){
        quote__c qt = new quote__c();
        qt.Id = q.Id;
        qt.StageName__c = 'Proposal Sent';
        quotes.add(qt);
    }
    if(quotes.size()>0){
        update quotes;
    }
}

Hello all,

I have a custom relation master/detail  (Qoutes__r) between Quote and QuoteLineItem.
I have a class where i need to get some data from Quote and QuoteLineItem but I'm getting this error:
 
Error: Compile Error: Didn't understand relationship 'Quotes__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 35 column 16

Here my code:

LstQuotes = [SELECT q.id,q.QuoteNumber, q.Ad_Name__c,q.Type__c, q.Size__c,  q.Version__c, q.Bleed_Code__c,
   (Select Quotes__r.Advertiser_Account__c From Quotes__r)
   From Quote q
   where City_Code__c = :theId and q.Media_Name__c =: strMediaID];

The error is on this line (Select Quotes__r.Advertiser_Account__c From Quotes__r)

Thanks.
I created a class as bolew , when I  save it , it has an error:'Error: Compile Error: Method does not exist or incorrect signature: [HttpRequest].setMethod(String) at line 16 column 9'. I think there is nothing wrong in my code , and the same code works in another org. So I want to know why the same code works in one org and does not work in another org.
 User-added image
Hi Developers,

             I came across into a scenario where If i forgot my enterprise edition details which I had created almost 10 months back.And I have assigned it to  one of my employee email ID.Now the email Id has been blocked as he left the company.Is there any way to retrieve the ORG details. If yes please let me know about the procedure.



Thanks in Advance,
Tarun.M
can i have a drop down box on my web site that populates a variable on the page, then use the hidden field setting (like setting the org ID) to set a text field on the case to the selected picklist value
this is so that if i want to add reasons to the web to case without adding the new picklist value in 2 places (web code and salesforce case field)
Hi All,


Can we use validation rules to make field available for user when the stage of an opportunity is changed? For example, User needs to enter comments particular to that stage change when they change it from "In discussion" to "WON". Like wise for every stage change they record in salesforce, they have to add some comments in the newly avaiable text area.

Can this be achieved?

  • August 11, 2014
  • Like
  • 0
I can't update a checkbox field(no error,but the checkbox field doesn't updated),code like this:

Account[] a= new Account[0];
a[0].Id = customer.Id;
a[0].Name = customer.Name;//textbox field is OK
a[0].Anyue_Membership__c = true;//checkbox field not be updated

            LimitInfo[] li;
            SaveResult[] sr;
            try
            {
                DebuggingInfo di = client.update(header, null, null, null, null, null, null, null, null, null, null, a, out li, out sr);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
            if (sr[0].success == false)
            {
                foreach (Error error in sr[0].errors)
                {
                    returnValue += "errormessage:" + error.statusCode + error.message + "\t";
                }
            }
            return returnValue;

could anybody help me?
During deploying my App from sandbox to production environment I have got 1 error message that there is a duplication of Workflow field update data type ( see attached screenshot).

What I should do next? Delete this Change set in production environment and the same on sandbox and start again from the scrutch without adding this one field update? Or is there a way to remowe this component from change sets component list and try again?

Thanks for any help.

LukaszDeployment failure details view.

Hi, I'm building this user-driven input SOQL query (my life's work) and I'm trying to see if it is possible for a picklist to be one of the fields that can be pulled for an input query?  I'm not seeing the apex:inputXXXX command that would do this, but I'm hoping it can be done through some other method.

I have a Inquiry_Status__c field that is a picklist and can only have: "Original", "Inquired" or "Responded" field information, so having the user have to manually type that in the input field is kinda nutty and prone to problems, mistypes, forgetting what the field values CAN be, etc.  Is there a way to do this?

(I presently have the SOQL query working via a <apex:inputText ......> command, but a picklist would be awesome)
Hello,

I have the trigger below set to fire when OpportunityLineItem is updated or inserted.  It's meant to assign a unique number to a custom field called Max_Deliv__c on the OpportunityLineItem object.  The trigger works fine when I add single products, however, when I add multiple products at the same time it assigns the same number to each.  Does anyone know how I can change the trigger to assign a different sequential number to each product added?  Auto number fields will not work because I need the numbering sequence to start over on each new Opportunity.  Thanks,

//Assigns a unique ID to each deliverable in every Opportunity so DyNad can track.
trigger UniqueDelivID on OpportunityLineItem (before insert, before update) {   

if(checkRecursiveBI.runOnceBI()||checkRecursiveBU.runOnceBU())
{
    Set<ID> setOliIds = new Set<ID>();
        for(OpportunityLineItem oli:Trigger.new){
            setOliIds.add(oli.Id);
        }
        Map<ID, OpportunityLineItem> mapOli = new Map<ID, OpportunityLineItem>([SELECT Id, Opportunity.Max_Deliv_Hx__c, Max_Deliv__c
                                                                                FROM OpportunityLineItem
                                                                                WHERE Id in:setOliIds]);
        if(mapOli.size()>0){

/*        List<OpportunityLineItem> oli1 = [SELECT Id, Max_Deliv__c
                                         FROM OpportunityLineItem
                                         WHERE Id IN: Trigger.newMap.keySet()]; 
                                     
            for (OpportunityLineItem oli :oli1){*/
            for(OpportunityLineItem oli1:Trigger.New){
                IF(mapOli.containsKey(oli1.Id) && (oli1.Max_Deliv__c == 0 || oli1.Max_Deliv__c == null)){
                    oli1.Max_Deliv__c = mapOli.get(oli1.Id).Opportunity.Max_Deliv_Hx__c + 1;
                }
            }
        }
}

}


  • July 27, 2014
  • Like
  • 0
Hi,
Can anyone pls help me in solving below task.


Demonstrate your integration skills

a. If you do not have a gmail account create one

b. Create a google spreadsheet and create a google script to

- Show a menu when you open the gdoc with the following

1. Login to SFDC

2. Extract object metadata

c. When you select the Login to SFDC, a popup shows with fields needed to login to your developer

d. When you select “Extract object metadata”

instance (User name, password, security token and anything else). The popup should have 2

options one for login, one for cancel

- If not yet logged in, then show the login popup

- If already logged in

1. A popup shows up with a drop down of all the objects in the SFDC org you just

logged into and 2 buttons (Extract, cancel)

2. Once the user selects a specific object in the drop down and clicks extract.

The google script uses the SFDC Metadata API to extract all the information

exposed about the object, its fields and field properties and writes it to a new

tab (note label the tab with the object name).
Hi,

Can any one tell me the sample code for how to call external webservice function in apex trigger.

I want to pass parameter to Function of that webservice and store in my sql database.

thnx
Hi,

We have a requirement for one of the Telecom companies and they need to have "Loyalty Management" in their application. Could any please let me know how big is the effort and how many days would it take to implement this module.

Also it would be helpful if some light is thrown on the hurdles that might  we might come across while implementing the same. 

Thanks in advance.
Hi there,

I have created a class that stores trigger names to be deactivated during tests (I try to make a lot of unit tests, so I'm not interested in firing all my triggers on every test, and it is better to disable some of them to avoid reaching SOQL limits). So my tests have something like this:

TriggerDisabler.Disable('MyTriggerName');

And my triggers now add something like this as their first lines:
if (TriggerDisabler.IsTriggerDisabled('MyTriggerName')) {
    return;
}

But I would like to make this more generic, using something like a "trigger.Name" or something (without queries) that could return me the trigger's name, or eventually changing that method call in the trigger to "TriggerDisabler.AmIDisabled()" which could handle this itself.

Is this possible? I took a quick look in some forums and examples but couldn't find any way to obtain the trigger's name.

Any other suggestions are also welcome!

Cheers.
We have a client that is implementing a Mirth web service in their office and needs Salesforce data to be sent to it via SOAP web service.

We have the code working without the SSL certificate, but with the sertificate in place we are getting the following error when we call the web service method:

IO Exception: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

We have looked through the root certificates list provided by Salesforce:

     https://developer.salesforce.com/page/Outbound_Messaging_SSL_CA_Certificates#thawteserverca (https://developer.salesforce.com/page/Outbound_Messaging_SSL_CA_Certificates#thawteserverca" target="_blank

It appears our certificate is based on: thawteprimaryrootca (This is based on a comparison of the SHA1 fingerprint).

Our certificate chain looks like this:

SSL Certificate Chain

The URL with the web service and the SSL certificate installed is at https://dev.ws.foundationmedicine.com/services/sfdc (https://dev.ws.foundationmedicine.com/services/sfdc" target="_blank

We are concerned that there is a problem with the root certificate on the Salesforce server, and need to know how to proceed.

If anyone has encountered a similar problem, please reach out.  Thanks in advance.



Hi,

I am trying to add a visualforce page as a home page component , and display it as a link in my home page , but wen i click on the link on the home page , it tries to open in a new window and displays the following error message,

" Id value 00511000000xQ80 is not valid for the Account standard controller "

Do i need to call this home page component in my VF Page , kindly help me on this issue.

Thanks in Advance
This methods are used for Get Same Role and Subordinate Users.

public static Set<ID> getSameRoleSubordinateUsers()
     {
         Set<ID> userIds = new Set<ID>();
     
        // get current user's role id
          Map<Id,User> users = new Map<Id, User>([Select Id, Name From User where UserRoleId=:userinfo.getuserroleid()]);
          userIds.addAll(users.keySet());
         
        // get all of the roles underneath the user
         Set<Id> allSubRoleIds = getAllSubRoleIds(new Set<ID>{userinfo.getuserroleid()});
        
        // get all of the ids for the users in those roles
         Map<Id,User> subUsers = new Map<Id, User>([Select Id, Name From User where
          UserRoleId IN :allSubRoleIds]);
         
          userIds.addAll(Subusers.keySet());
      
        // return the ids as a set so you can do what you want with them
         return userIds;
    }

   private static Set<ID> getAllSubRoleIds(Set<ID> roleIds)
   {

        Set<ID> currentRoleIds = new Set<ID>();
    
        // get all of the roles underneath the passed roles
        for(UserRole userRole :[select Id from UserRole where ParentRoleId IN :roleIds AND ParentRoleID != null])
    
        currentRoleIds.add(userRole.Id);
    
        // go fetch some more rolls!
        if(currentRoleIds.size() > 0)

          currentRoleIds.addAll(getAllSubRoleIds(currentRoleIds));
    
        return currentRoleIds;

    }

Thank's 
Ramakrishnan Ayyanar
+919944112175
Hy evrybody,

Can you help me for make the test for this class :

public with sharing class DispatcherContactNewController {

    public DispatcherContactNewController(ApexPages.StandardController controller) {
        this.controller = controller;
    }

    public PageReference getRedir() {

        PageReference newPage;
        
         String c = ApexPages.currentPage().getParameters().get('RecordType');
         String a = ApexPages.currentPage().getParameters().get('accid');
                   
        if (C == '012F0000000yGsq') {
            newPage = Page.Visual_contact;
            newPage.getParameters().put('RecordType', c);          
            newPage.getParameters().put('accid', a);
           
            return newPage.setRedirect(true);           
                   
        } else {
           
            newPage = new PageReference('/003/e');
            newPage.getParameters().put('accid', a);
            newPage.getParameters().put('RecordType', c);
            newPage.getParameters().put('nooverride', '1');
            return newPage.setRedirect(true);
        }

   
   
    }

    public final ApexPages.StandardController controller;
   
   

}

I'm lost with the test
HI Guys,

i implemented a webservice class,it is going to retrieve records based on autonumber field. for the main class its executed successfully but it was not able to retrieve any records in test classes.

Auto number field is in User object,for this i inserted a user and than am querying on that particular user record but it was showing " System.QueryException: List has no rows for assignment to SObject "

test class :
Profile p = [select id from profile where name='Standard User'];

            User testUser= new User(alias = 'u1', email='u1@swa.com',
              emailencodingkey='UTF-8', lastname='Testing', languagelocalekey='en_US',
              localesidkey='en_US', profileid = p.Id, country='United States',
              timezonesidkey='America/Los_Angeles', username='u1@swa.com');
        
            insert testUser;
rewCls.empid==testUser.Emp_Id__c;--->Am i able to get that autonuber field after inserting the user ?
cls_RecieveAndSend_DatatoSrisys.doPost();


class:
global static MyUserDefinedClass doPost(){

if(rewCls.month==null && rewCls.year!=null && rewCls.empid!=null){
           System.Debug('Users Emp Id is '+rewCls.empid);
           
            User u = [select id,name from user where Emp_Id__c=:rewCls.empid];
            System.Debug('Users Name :'+u.Name);
}
Hi,

Please help me to write the test class for the below class,

/****   Create competitiveinfo records from the corresponding opportunity.
**/

public class AF_OpportunityHandlerController{

   public void createCIRecords(List<Opportunity> oppList)
   {
        Competitive_Info__c ci;
        List<Competitive_Info__c> ciList = new List<Competitive_Info__c>();
        for(Opportunity op: oppList)
        {
            ci = new Competitive_Info__c(Account__c = op.AccountId,Line_Of_Business__c = op.Type,OwnerId = op.ownerId,Competing_Lender__c = op.Competing_Lender__c,Competitions_Rate_Index__c = op.Competing_Rate_Type__c,Competitive_Spread__c = op.Competing_Spread__c,Competitions_Net_Rate__c = op.Competition_Net_Rate__c,Date_Competitive_Info_Obtained__c = op.CloseDate,Loan_Type__c = op.Opportunity_Type__c);
            ciList.add(ci);
        }
       
        if(ciList != null && ciList.size() >0)
        {
            try
            {
                insert ciList;
            }
            catch(system.DMLException e)
            {
                system.debug('DML Exception'+e.getDMLMessage(0));
            }
            finally
            {
                AF_DealerCRM_Utility.IS_CI_CREATED = true; 
            }
        }
   }
 
 
 
 
}

Thanks in advance
Hey there,

I have a trigger. This trigger works fine although i have read in many places that it is in ones best interest to bulkify trigger to prevent it from affecting your system in the long run. i was hoping that I may be able to get a hand in bulkifying my trigger.

I was also hoping someone could assist me in adding some extra functionality to the trigger. The activity with subject 'Upload Authoirty form' 'will awlays be related to an account, I was wondering how I could go about adding lines which will update a picklist field inside a custom object (account status) which is in a one to one relationship with account (account being the master)? 

Any advised steps I should take as well would be appreciated. E.G. Adding fields to lock in one to one relationship, changing picklist to formula field, etc. I currently have a trigger which creates the Account status record and associates it with the account upon Account record creation.

This is my trigger:

Trigger updateFields on Task(before insert){
  for (Task Tas: trigger.new){
  if (Tas.Subject == 'Upload Authority Form') {
    Tas.RecordTypeID = '012N00000008eow';
    Tas.Type = 'Document Upload';
    Tas.Status = 'Awaiting Form';
  }
}
}

Thank you so much ina advance for any help that you may be able to provide me.

Kind regards,

Michael
Hello.  I have an app with several custom controllers.  I have about 200 lines of apex code that are identical between "CustomControllerA" and "CustomControllerB".  For maintenance purpuses, I ideally would NOT like to have identical lines of code in various controllers - so is there any way that I can share this code between the two controllers?  I thought an extension might work...but my initial research is telling me no.

Thanks in advance.
Hi,

I have a trigger which prevents duplicate contacts being entered into Salesforce. When creating the test class, I'm getting this error:
"Initial term of field expression must be a concrete SObject: LIST<Contact>" on this line:
  User-added image

Below is the test class:

@isTest
public class TestContactDupeCatcher {
    static testMethod void testContactDupeCatcher() {    
      // First make sure there are no contacts already in the system
      // that have the email addresses used for testing
      Set<String> testEmailAddress = new Set<String>();
      testEmailAddress.add('test1@duptest.com');
      testEmailAddress.add('test2@duptest.com');
      testEmailAddress.add('test3@duptest.com');
      testEmailAddress.add('test4@duptest.com');
      testEmailAddress.add('test5@duptest.com');
      System.assert([SELECT count() FROM Contact
                     WHERE Email IN :testEmailAddress] == 0);
      // Seed the database with some contact, and make sure they can
      // be bulk inserted successfully.
      Contact contact1 = new Contact(LastName='Test1',
                            Email='test1@duptest.com');
      Contact contact2 = new Contact(LastName='Test2',
                            Email='test4@duptest.com');
      Contact contact3 = new Contact(LastName='Test3',
                            Email='test5@duptest.com');
      Contact[] contact = new Contact[] {contact1, contact2, contact3};
      insert contact;     
      // Now make sure that some of these contacts can be changed and
      // then bulk updated successfully. Note that contact1 is not
      // being changed, but is still being passed to the update
      // call. This should be OK.
      contact2.Email = 'test2@duptest.com';
      contact3.Email = 'test3@duptest.com';
      update contact;
      // Make sure that single row contact duplication prevention works
      // on insert.
      Contact dup1 = new Contact(LastName='Test1Dup',
                           Email='test1@duptest.com');
      try {
         insert dup1;
         System.assert(false);
      } catch (DmlException e) {
         System.assert(e.getNumDml() == 1);
         System.assert(e.getDmlIndex(0) == 0);
         System.assert(e.getDmlFields(0).size() == 1);
         System.assert(e.getDmlFields(0)[0].getDescribe().getName() == 'Email');
         System.assert(e.getDmlMessage(0).indexOf(
            'A contact with this email address already exists.') > -1);
      }
      // Make sure that single row lead duplication prevention works
      // on update.
      dup1 = new Contact(Id = contact1.Id, LastName='Test1Dup',
                      Email='test2@duptest.com');
      try {
         update dup1;
         System.assert(false);
      } catch (DmlException e) {
         System.assert(e.getNumDml() == 1);
         System.assert(e.getDmlIndex(0) == 0);
         System.assert(e.getDmlFields(0).size() == 1);
         System.assert(e.getDmlFields(0)[0].getDescribe().getName() == 'Email');
         System.assert(e.getDmlMessage(0).indexOf(
            'A contact with this email address already exists.') > -1);
        }
      // Make sure that bulk contact duplication prevention works on
      // insert. Note that the first item being inserted is fine,
      // but the second and third items are duplicates. Note also
      // that since at least one record insert fails, the entire
      // transaction will be rolled back.
      dup1 = new Contact(LastName='Test1Dup',
                      Email='test4@duptest.com');
      Contact dup2 = new Contact(LastName='Test2Dup',
                           Email='test2@duptest.com');
      Contact dup3 = new Contact(LastName='Test3Dup',
                           Email='test3@duptest.com');
      Contact[] dups = new Contact[] {dup1, dup2, dup3};
      try {
         insert dups;
         System.assert(false);
      } catch (DmlException e) {
         System.assert(e.getNumDml() == 2);
         System.assert(e.getDmlIndex(0) == 1);
         System.assert(e.getDmlFields(0).size() == 1);
         System.assert(e.getDmlFields(0)[0].getDescribe().getName() == 'Email');
         System.assert(e.getDmlMessage(0).indexOf(
            'A contact with this email address already exists.') > -1);
         System.assert(e.getDmlIndex(1) == 2);
         System.assert(e.getDmlFields(1).size() == 1);
         System.assert(e.getDmlFields(1)[0].getDescribe().getName() == 'Email');
         System.assert(e.getDmlMessage(1).indexOf(
            'A contact with this email address already exists.') > -1);
      }
      // Make sure that bulk contact duplication prevention works on
      // update. Note that the first item being updated is fine,
      // because the email address is new, and the second item is
      // also fine, but in this case it's because the email
      // address doesn't change. The third case is flagged as an
      // error because it is a duplicate of the email address of the
      // first contact's value in the database, even though that value
      // is changing in this same update call. It would be an
      // interesting exercise to rewrite the trigger to allow this
      // case. Note also that since at least one record update
      // fails, the entire transaction will be rolled back.
      dup1 = new Contact(Id=contact1.Id, Email='test4@duptest.com');
      dup2 = new Contact(Id=contact2.Id, Email='test2@duptest.com');
      dup3 = new Contact(Id=contact.Id, Email='test1@duptest.com');
      dups = new Contact[] {dup1, dup2, dup3};
      try {
         update dups;
         System.assert(false);
      } catch (DmlException e) {
         System.debug(e.getNumDml());
         System.debug(e.getDmlMessage(0));
         System.assert(e.getNumDml() == 1);
         System.assert(e.getDmlIndex(0) == 2);
         System.assert(e.getDmlFields(0).size() == 1);
         System.assert(e.getDmlFields(0)[0].getDescribe().getName() == 'Email');
         System.assert(e.getDmlMessage(0).indexOf(
            'A contact with this email address already exists.') > -1);
        }
      // Make sure that duplicates in the submission are caught when
      // inserting contacts. Note that this test also catches an
      // attempt to insert a contact where there is an existing
      // duplicate.
      dup1 = new Contact(LastName='Test1Dup',
                      Email='test4@duptest.com');
      dup2 = new Contact(LastName='Test2Dup',
                      Email='test4@duptest.com');
      dup3 = new Contact(LastName='Test3Dup',
                      Email='test3@duptest.com');
      dups = new Contact[] {dup1, dup2, dup3};
      try {
         insert dups;
         System.assert(false);
      } catch (DmlException e) {
         System.assert(e.getNumDml() == 2);
         System.assert(e.getDmlIndex(0) == 1);
         System.assert(e.getDmlFields(0).size() == 1);
         System.assert(e.getDmlFields(0)[0].getDescribe().getName() == 'Email');
         System.assert(e.getDmlMessage(0).indexOf(
            'Another new contact has the same email address.') > -1);
         System.assert(e.getDmlIndex(1) == 2);
         System.assert(e.getDmlFields(1).size() == 1);
         System.assert(e.getDmlFields(1)[0].getDescribe().getName() == 'Email');
         System.assert(e.getDmlMessage(1).indexOf(
            'A contact with this email address already exists.') > -1);
      }      
      // Make sure that duplicates in the submission are caught when
      // updating contacts. Note that this test also catches an attempt
      // to update a contact where there is an existing duplicate.
      dup1 = new Contact(Id=contact1.Id, Email='test4@duptest.com');
      dup2 = new Contact(Id=contact2.Id, Email='test4@duptest.com');
      dup3 = new Contact(Id=contact3.Id, Email='test2@duptest.com');
      dups = new Contact[] {dup1, dup2, dup3};
      try {
         update dups;
         System.assert(false);
      } catch (DmlException e) {
         System.assert(e.getNumDml() == 2);
         System.assert(e.getDmlIndex(0) == 1);
         System.assert(e.getDmlFields(0).size() == 1);
         System.assert(e.getDmlFields(0)[0].getDescribe().getName() == 'Email');
         System.assert(e.getDmlMessage(0).indexOf(
            'Another new contact has the same email address.') > -1);
         System.assert(e.getDmlIndex(1) == 2);
         System.assert(e.getDmlFields(1).size() == 1);
         System.assert(e.getDmlFields(1)[0].getDescribe().getName() == 'Email');
         System.assert(e.getDmlMessage(1).indexOf(
            'A contact with this email address already exists.') > -1);
      }
   }
}

Can someone help me with this error? Thanks!