• mh1974
  • NEWBIE
  • 100 Points
  • Member since 2009

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 15
    Replies
We've just switched to the On Demand service for e-2-c.  Previously,  all the emails were assigned to the user used by the java app.  However,  now they're all assigned to me - no good!  Does anyone know why this is and how I can change that?
  • February 19, 2010
  • Like
  • 0

All,  I have a custom object that is is the 'detail' in a Master-Detail relationship with Opportunity. When this custom object is created,  it creates a task for the user which then appears in their My Tasks section on the Home Page. 

 

Because Task objects are not allowed to participate in a Lookup or Master-Detail relationship,  the custom object holds the task ID and if it is deleted it deletes the task too when the custom object delete trigger is fired.

 

All this works fine,  but,  if I delete the Opportunity, the custom object is deleted whilst the task is not.  It looks to me as though the delete trigger does not fire under these cirumstances,  can anyone shed any light on this?

 

Thanks,

 

Matt

  • February 16, 2010
  • Like
  • 0

I'm unable to log in to Apex Explorer.  I'm using my username,  password and security token,  but,  when I hit Login,  the app falls over witht the following message:

 

 Login failed: Client found response content type of 'text/html; charset=UTF-8', but epxected 'text/xml'.

 

, followed by a load of xml/java gibberish.

 

Does anyone have any suggestions?

  • January 22, 2010
  • Like
  • 0

I've written my own Apex web service and downloaded the WSDL file from the site.  My C# app logs into Sf successfully and I have a web reference to my nwely created web service.

 

Seems like I have everything I need,but,  I have no idea how to call the method I wrote.  I've included a Using stsement at the top of my class,  but,  I just can't see the method or how I'm supposed to associate my current session with the new web service (is that right?)

 

Basically,  I'm in all kinds of trouble here and would like a little help please!

  • November 19, 2009
  • Like
  • 0
Is it possible to for the page layout,  e.g. for the Accounts tab,  to differ depending on whether or not the user is offline?  The example here is that our field staff do not want clients to see sensitive data when working with them,  but,  need the information when working at the office.
  • October 06, 2009
  • Like
  • 0

I have a trigger set to fire before update to validate data on Account records.  I get around the SOQL query limit by going through all the records in the trigger,  getting record Id's and running a piece of SOQL to pull back a SET of Account objects and then using a loop to go around those objects and add an error to the update before it is made.

 

However,  this morning,  one of my users ran a mass update on accounts to transfer to them to a different user and I received the dreaded Too many SOQL queries error.  So,  I ran the same process on our full copy dev box with the log running and discovered that instead of firing the trigger once,  the updated records were broken down into odd sized batches (sometimes ones and twos,  sometimes much larger,  e.g 50).  This meant the trigger was fired 24 times,  which caused the error.

 

So,  my question is,  how am I supposed to code for mass updates if I cannot rely on the trigger firing just once?  Has anyone else seen this problem?

  • October 05, 2009
  • Like
  • 0

I'm writing a piece of C# code to reset a date field after a set time period has elapsed,  here's a demo of the code:

 

AccountObject.MyDate__c =  null;

AccountObject.MyDate__cSpecified = true;

 

However,  when I run the update,  nothing happens.  If I assign a date,  I get a result.  I can manually update the record and remove the date,  so,  why can't I do this through code?

 

 

 

  • October 01, 2009
  • Like
  • 0
I'm writing a trigger to determine which fields have changed when an sObject is updated. This code must be future-proof, so, I do not want to hard code any field names - does anyone know of a way of acheiving this?
  • September 09, 2009
  • Like
  • 0

Here's my dilema;  I have a visualforce page that allows a user to select a contact to send an email to.  This email will always be the same .pdf file attached to it.  I've learned how to create and send the email,  but,  I don't see how I can attach the .pdf file.  I thought that I would be able to save the file as a static resource and add it,  but,  that does not seem possible.  I've read lots of material on converting a visualforce page into a pdf and adding that as an attachment,  but,  that doesn't really fit with what I'm doing.  My file will always be the same,  so,  I was really looking for a way to store it in 'the cloud' and then add it to my emails when required.

 

Any advice?

I have written a visualforce page that consists of a data table listing a collection of a custom object.  I added a button that creates a new custom object which is then added to the list as the page is refreshed.

 

An additional  requirement is that the user should only be allowed to push this button once a month,  so,  I added a piece of code to the controller to do just that and it's called like so:

 

 <apex:commandButton action="{!NewRecruit}" value="Recruit DD" id="btnRecruitDD" disabled="!DisableRecruitment}"/>

 

When the form loads,  the button is disabled correctly if the most recent object is less than one month old.

Problem: If there is no object of  less than one month old,  the button is enabled,  the user presses the button and a new object is created.  At this point,  no  page refresh takes place,  so,  the button is still enabled and the new object has not been appended to the list.  If I hit refresh,  the new object is listed and the button is disabled.

 

Does anyone have any idea how I can get the page to refresh in this instance?

 

 

I have created a custom object that is updated through a standard tab.  I have created a trigger that fires when the object is updated and creates and writes to a second custom object.  So far so good,  works without a hitch.

 

The problem:  I don't want to use the standard layout,  so,  I have created a Visualforce page to do the job - it uses the object as the standard controller.  When I change the data and hit the save button,  the update is succesfull,  but,  the trigger does not fire and the second object is not created.

 

Does anyone have any idea why the use of a Visualforce page should make a difference to the firing of a trigger?.

I'm developing a custom button / link for Cases.  The button searches for a custom child object,  which I'll call Bob (refered to in code as Bob__c) for now.  Bob__c holds the value of the Case to which it belongs,  so,  I can search for any Bob__c that holds the current Case.Id.  If it finds the object it gets displayed,  if it does not find the object one gets created and then displayed.

 

It all works except that when I create the Bob__c obect using this code:

 

var objNewBob = new sforce.SObject("Bob__c");

objNewBob.CaseNumber__c = {!Case.Id}; //Store the Case number so it can be referenced later

 

var result = sforce.connection.create([objNewBob]); //Create fails

 

I see the following message:

 

A problem with the OnClick JavaScript for this button or link was encountered:

{faultcode:'sf:INVALID_TYPE', faultstring:'INVALID_TYPE: sObject type 'Bob__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.', detail:{InvalidSObjectFault:{exceptionCode:'INVALID_TYPE', exceptionMessage:'sObject type 'Bob__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.', row:'-1', column:'-1', }, }, }

 

I can't see what I'm doing wrong!  Anyone got any answers please?

Message Edited by mh1974 on 04-28-2009 01:25 AM
Message Edited by mh1974 on 04-28-2009 01:25 AM
Message Edited by mh1974 on 04-28-2009 01:28 AM
  • April 27, 2009
  • Like
  • 0

All,  I have a custom object that is is the 'detail' in a Master-Detail relationship with Opportunity. When this custom object is created,  it creates a task for the user which then appears in their My Tasks section on the Home Page. 

 

Because Task objects are not allowed to participate in a Lookup or Master-Detail relationship,  the custom object holds the task ID and if it is deleted it deletes the task too when the custom object delete trigger is fired.

 

All this works fine,  but,  if I delete the Opportunity, the custom object is deleted whilst the task is not.  It looks to me as though the delete trigger does not fire under these cirumstances,  can anyone shed any light on this?

 

Thanks,

 

Matt

  • February 16, 2010
  • Like
  • 0

I've written my own Apex web service and downloaded the WSDL file from the site.  My C# app logs into Sf successfully and I have a web reference to my nwely created web service.

 

Seems like I have everything I need,but,  I have no idea how to call the method I wrote.  I've included a Using stsement at the top of my class,  but,  I just can't see the method or how I'm supposed to associate my current session with the new web service (is that right?)

 

Basically,  I'm in all kinds of trouble here and would like a little help please!

  • November 19, 2009
  • Like
  • 0

I have a trigger set to fire before update to validate data on Account records.  I get around the SOQL query limit by going through all the records in the trigger,  getting record Id's and running a piece of SOQL to pull back a SET of Account objects and then using a loop to go around those objects and add an error to the update before it is made.

 

However,  this morning,  one of my users ran a mass update on accounts to transfer to them to a different user and I received the dreaded Too many SOQL queries error.  So,  I ran the same process on our full copy dev box with the log running and discovered that instead of firing the trigger once,  the updated records were broken down into odd sized batches (sometimes ones and twos,  sometimes much larger,  e.g 50).  This meant the trigger was fired 24 times,  which caused the error.

 

So,  my question is,  how am I supposed to code for mass updates if I cannot rely on the trigger firing just once?  Has anyone else seen this problem?

  • October 05, 2009
  • Like
  • 0

I'm writing a piece of C# code to reset a date field after a set time period has elapsed,  here's a demo of the code:

 

AccountObject.MyDate__c =  null;

AccountObject.MyDate__cSpecified = true;

 

However,  when I run the update,  nothing happens.  If I assign a date,  I get a result.  I can manually update the record and remove the date,  so,  why can't I do this through code?

 

 

 

  • October 01, 2009
  • Like
  • 0
I'm writing a trigger to determine which fields have changed when an sObject is updated. This code must be future-proof, so, I do not want to hard code any field names - does anyone know of a way of acheiving this?
  • September 09, 2009
  • Like
  • 0

I have a class with two methods.  The main method pulls data from the db and creates a list of Opportunities.  The PageReference method creates a document using a Page that pulls it's data from the main method.  It thens saves this PDF in the Documents folder and as an Attachment on the Opportunity. 

 

I have written test methods for both pieces of code but I'm stuck at 55% coverage.  I'm trying to figure out what I'm missing.  Thank you in advance.


 

    public class ProbeQuote {
        Schema.DescribeFieldResult F = Product2.Family.getDescribe();
        List<Schema.PicklistEntry> P = F.getPicklistValues();

        public Opportunity Probe { get; set; }

        public String pdfName;

        public ID id = ApexPages.CurrentPage().getParameters().get('id');

        public List<Opportunity> ProbeProducts = new List<Opportunity>();

        Integer Counter = 1;

        public ApexPages.StandardController controller;

        public ProbeQuote(ApexPages.StandardController stdController) {
            controller = stdController;
            //quoteid = stdController.getRecord().id;
            //ID id = '0068000000NyTHe';

            for (Schema.PicklistEntry fam:P){
            Integer i = 0;
            String FamilyLabel = fam.GetLabel();

            Probe = [SELECT o.Id, o.Name, o.Amount, o.ProductFamily__c, (SELECT op.Quantity, op.UnitPrice,
op.TotalPrice,op.PricebookEntry.Name, op.OpportunityId, op.PricebookEntry.ProductCode,
            op.PricebookEntry.Product2.Family, op.LineCount__c 
            FROM OpportunityLineItems op WHERE op.PricebookEntry.Product2.Family = :FamilyLabel)
            FROM Opportunity o where Id = :id];

            Probe.Amount = 0;
            Probe.ProductFamily__c = FamilyLabel;

            for(i=0;i<Probe.opportunityLineItems.size();i++) {
                Probe.Amount += Probe.opportunityLineItems[i].TotalPrice;  
                Probe.opportunityLineItems[i].LineCount__c = Counter;
                Counter++;
            }

            ProbeProducts.add(Probe);
            }
        }

        public List<Opportunity> getProbeProducts() {
            return ProbeProducts;
        }

        public PageReference attachQuote() {
            Opportunity Opp = [SELECT o.Id, o.Name, o.Amount, o.ProductFamily__c 
            FROM Opportunity o where Id = :id]; 

            pdfName = Opp.Name + '.pdf';

            /* Get the page definition */
            PageReference pdfPage = new PageReference( '/apex/ProbeQuote' );

            /* set the quote id on the page definition */
            pdfPage.getParameters().put('id',id);

            /* generate the pdf blob */
            Blob pdfBlob = pdfPage.getContent();

            /* create the attachment against the quote */
            Attachment a = new Attachment(parentId = id, name=pdfName, body = pdfBlob);

            /* insert the attachment */
            insert a;

            /* Now create document to show up in Documents Tab in Quotes Folder */

            Folder f = [SELECT Id, Name FROM Folder WHERE Name = 'Quotes'
            AND Type = 'Document'];

            Document d = new Document();

            d.Name = pdfName;

            //d.DeveloperName = pdfName;

            d.ContentType = 'application/pdf';

            d.Body = pdfBlob;

            d.FolderId = f.Id;

            insert d;


            /* send the user back to the quote detail page */
            return controller.view();
        }

        public static testMethod void testProbeQuote() {
            Id id;
            Opportunity testProbe;
            List<Opportunity> testProbeProducts = new List<Opportunity>();
            Integer Counter = 1;

            Schema.DescribeFieldResult F = Product2.Family.getDescribe();
            List<Schema.PicklistEntry> P = F.getPicklistValues();

            Opportunity testOppty = new opportunity (Name = 'Force Monkey 4x4',
            StageName = 'Prospect', Amount = 2000, CloseDate = System.today() );

            insert testOppty;

            id = testOppty.id;

            // Insert test Truck OpportunityLineItem

            OpportunityLineItem testOLI = new OpportunityLineItem (Quantity = 5,
            UnitPrice = 100, OpportunityId = testOppty.id, PricebookEntryId = '01u80000002XFfKAAW');

            insert testOLI;

            for (Schema.PicklistEntry fam:P){
                Integer i = 0;
                String FamilyLabel = fam.GetLabel();

                testProbe = [SELECT o.Id, o.Name, o.Amount, o.ProductFamily__c, (SELECT op.Quantity, op.UnitPrice, op.TotalPrice,op.PricebookEntry.Name, op.OpportunityId, op.PricebookEntry.ProductCode, op.PricebookEntry.Product2.Family, op.LineCount__c 
            FROM OpportunityLineItems op WHERE op.PricebookEntry.Product2.Family = :FamilyLabel)
            FROM Opportunity o where Id = :id];
                testProbe.Amount = 0;
                testProbe.ProductFamily__c = FamilyLabel;

                for(i=0;i<testProbe.opportunityLineItems.size();i++) {
                    testProbe.Amount += testProbe.opportunityLineItems[i].TotalPrice;  
                    testProbe.opportunityLineItems[i].LineCount__c = Counter;
                    Counter++;
                }

                testProbeProducts.add(testProbe);
            }


            PageReference pg = Page.yourVFpageName; Test.setCurrentPage(pg); ApexPages.currentPage().getParameters().put('id', testOppty.id);

            // Instantiate custom ProbeQuote controller

            //testProbeProducts.add(testOppty);

            System.assertEquals (testProbeProducts[0].Name, 'Force Monkey 4x4');

            ApexPages.StandardController stc = new ApexPages.StandardController(testOppty);
            ProbeQuote qe = new ProbeQuote(stc);
        }

        public static testMethod void  testattachQuote() {
            String pdfName;

            Opportunity testOppty = new opportunity (Name = 'Force Monkey 4x4',
            StageName = 'Prospect', Amount = 2000, CloseDate = System.today() );

            insert testOppty;

            ID id = testOppty.id;

            // Insert test Truck OpportunityLineItem

            OpportunityLineItem testOLI = new OpportunityLineItem (Quantity = 5,
            UnitPrice = 100, OpportunityId = testOppty.id, PricebookEntryId = '01u80000002XFfKAAW');

            insert testOLI;

            pdfName = testOppty.Name + '.pdf';

            /* Get the page definition */
            PageReference pdfPage = new PageReference( '/apex/ProbeQuote' );

            /* set the quote id on the page definition */
            pdfPage.getParameters().put('id',id);

            /* generate the pdf blob */
            Blob pdfBlob = pdfPage.getContent();

            /* create the attachment against the quote */
            Attachment a = new Attachment(parentId = id, name=pdfName, body = pdfBlob);

            /* insert the attachment */
            insert a;

            /* Now create document to show up in Documents Tab in Quotes Folder */

            Folder f = new Folder (Name = 'Quotes', Id = '00l80000001DJ2aAAG', Type = 'Document');

            System.assertEquals (f.Name, 'Quotes');

            Document d = new Document(Name = pdfName, ContentType = 'application/pdf',
            Body = pdfBlob, FolderId = f.Id);

            insert d;

            PageReference pg = Page.yourVFpageName; Test.setCurrentPage(pg); ApexPages.currentPage().getParameters().put('id', testOppty.id);

            // Instantiate custom ProbeQuote controller

            ApexPages.StandardController stc = new ApexPages.StandardController(testOppty);
            ProbeQuote qe = new ProbeQuote(stc);

        }

    }

 

Here's my dilema;  I have a visualforce page that allows a user to select a contact to send an email to.  This email will always be the same .pdf file attached to it.  I've learned how to create and send the email,  but,  I don't see how I can attach the .pdf file.  I thought that I would be able to save the file as a static resource and add it,  but,  that does not seem possible.  I've read lots of material on converting a visualforce page into a pdf and adding that as an attachment,  but,  that doesn't really fit with what I'm doing.  My file will always be the same,  so,  I was really looking for a way to store it in 'the cloud' and then add it to my emails when required.

 

Any advice?

I have written a visualforce page that consists of a data table listing a collection of a custom object.  I added a button that creates a new custom object which is then added to the list as the page is refreshed.

 

An additional  requirement is that the user should only be allowed to push this button once a month,  so,  I added a piece of code to the controller to do just that and it's called like so:

 

 <apex:commandButton action="{!NewRecruit}" value="Recruit DD" id="btnRecruitDD" disabled="!DisableRecruitment}"/>

 

When the form loads,  the button is disabled correctly if the most recent object is less than one month old.

Problem: If there is no object of  less than one month old,  the button is enabled,  the user presses the button and a new object is created.  At this point,  no  page refresh takes place,  so,  the button is still enabled and the new object has not been appended to the list.  If I hit refresh,  the new object is listed and the button is disabled.

 

Does anyone have any idea how I can get the page to refresh in this instance?

 

 

I have created a custom object that is updated through a standard tab.  I have created a trigger that fires when the object is updated and creates and writes to a second custom object.  So far so good,  works without a hitch.

 

The problem:  I don't want to use the standard layout,  so,  I have created a Visualforce page to do the job - it uses the object as the standard controller.  When I change the data and hit the save button,  the update is succesfull,  but,  the trigger does not fire and the second object is not created.

 

Does anyone have any idea why the use of a Visualforce page should make a difference to the firing of a trigger?.

I'm developing a custom button / link for Cases.  The button searches for a custom child object,  which I'll call Bob (refered to in code as Bob__c) for now.  Bob__c holds the value of the Case to which it belongs,  so,  I can search for any Bob__c that holds the current Case.Id.  If it finds the object it gets displayed,  if it does not find the object one gets created and then displayed.

 

It all works except that when I create the Bob__c obect using this code:

 

var objNewBob = new sforce.SObject("Bob__c");

objNewBob.CaseNumber__c = {!Case.Id}; //Store the Case number so it can be referenced later

 

var result = sforce.connection.create([objNewBob]); //Create fails

 

I see the following message:

 

A problem with the OnClick JavaScript for this button or link was encountered:

{faultcode:'sf:INVALID_TYPE', faultstring:'INVALID_TYPE: sObject type 'Bob__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.', detail:{InvalidSObjectFault:{exceptionCode:'INVALID_TYPE', exceptionMessage:'sObject type 'Bob__c' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.', row:'-1', column:'-1', }, }, }

 

I can't see what I'm doing wrong!  Anyone got any answers please?

Message Edited by mh1974 on 04-28-2009 01:25 AM
Message Edited by mh1974 on 04-28-2009 01:25 AM
Message Edited by mh1974 on 04-28-2009 01:28 AM
  • April 27, 2009
  • Like
  • 0
Hello all-
 
I've been battling the sf.com Outlook integration module for quite from time now.  When I first open Outlook 2003 I see the Salesforce.com toolbar add in. This is working correctly and is not the problem.  When I open up a email, I do not see the Salesforce.com toolbar anymore.  Nor to I have the option to add this toolbar  to my view.  So the only way I know how to add an email to Salesforce.com is that I have to first scroll to  email I want, highlight it and then click on the Add Email icon.    From reading the tips and trick it states I should be able to access the toolbar from within an email that's been expaned (or opened).  Hope this makes sense.
 
I've tried:
- Uninstalling/installing the Salesforce.com Outlook integration software
- I've ensured that no items are "disabled" in outlook
- I've tried uninstalling the Salesforce.com add-in and reinstalling it into a new directory
 
None of these help.  My thoughts are that I need to manually remove the Salesforce.com Outlook plug-in in order to do a clean installation.  just a hunch.
 
Also BTW, when I close my Outlook for the day I get an error message stating that there is something wrong with my Salesforce.com Outlook Edition module.  When I close this I then get the Outlook Error messaging asking if I want to report this to microsoft, yada, yada, yada.
 
Suggestions?
 
 
Thanks
Brian