• aqueller
  • NEWBIE
  • 24 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 22
    Questions
  • 32
    Replies

Hi,

 

This may not be quite the best discussion board for my question, but I couldn't find a better one.

 

I am meeting with a customer who currently uses ACT 2011, regarding deployment of Salesforce.

Does anyone have material that compares the Salesforce with ACT?

 

        Thank you in advance.

 

                   aqueller

I am looking for help on the following issue.

 

I have a trigger that is supposed to delete certain types of opportunities, identified

by a custom field   PDS__Document_Type__c  as a 'Sales Order'.

 

My code is as follows:

 

trigger DeleteSO on Opportunity(after update)
{
   // Create a list of Opportunities, newOpps, to make it bulk fiendly
   List<Opportunity> newOpps = new List<Opportunity>();

   for(Opportunity o : Trigger.new)
   {
      // If it is a sales order, delete it
      if(o.PDS__Document_Type__c == 'Sales Order')
      {
          delete o;
      }
   }

   update newOpps;
}
      

 When I run it, I get an error:   DML statement cannot operate on trigger.new or trigger.old

 

Why do I get this error?

How can I fix it?



           Thx,

 

                      aqueller

 

 

 

 

I have an opportunity with a number of product line items.

I want to find the name of a product in a given line item (oldProdList[i] is an OpportunityLineItem).

 

I use the following query:

 

String ProdName = [SELECT Name FROM Product2 WHERE (id = :[SELECT Product2Id FROM PriceBookEntry WHERE ID = :oldProdList[i].PricebookEntryId].Id)];

 I get the error: Illegal assignment from LIST<Product2> to String .

 

I have the following questions:

 

1. Name is defined as a string field in Product2. Why am I getting this error?

2. Is it the right query structure for obtaining the product name?

 

            Thanks,

 

                       aqueller

I am setting an opportunity closing date as being 90 days from today ( date.today( ) ).

 

At a later point I create a string with the month name of the closing date, using the following code:

if (NewOpp.CloseDate.month() == 1) {monthName = 'Jan';}
 174	   // else if (NewOpp.CloseDate.month() == 2) {monthName = 'Feb';}
 175	   // else if (NewOpp.CloseDate.month() == 3) {monthName = 'Mar';}
 176	   // else if (NewOpp.CloseDate.month() == 4) {monthName = 'Apr';}
 177	   // else if (NewOpp.CloseDate.month() == 5) {monthName = 'May';}
 178	   // else if (NewOpp.CloseDate.month() == 6) {monthName = 'Jun';}
 179	   // else if (NewOpp.CloseDate.month() == 7) {monthName = 'Jul';}
 180	   // else if (NewOpp.CloseDate.month() == 8) {monthName = 'Aug';}
 181	   // else if (NewOpp.CloseDate.month() == 9) {monthName = 'Sep';}
 182	   // else if (NewOpp.CloseDate.month() == 10) {monthName = 'Oct';}
 183	   // else if (NewOpp.CloseDate.month() == 11) {monthName = 'Nov';}
 184	   // else {monthName = 'Dec';}

 The problem is that when I test the code it comes below 75% coverage,

given that we are in October and the close date of the next opportunity is in January.

 

How can I modify the test program to get full coverage? Is there a way to simulate

a system time for test purposes?

 

       Thank you

I am looking for help.

 

I have written a test program for an Apex trigger. The program creates a test account and an opportunity

that is associated with it. The code is shown below:

        // Create a test account for 'Corp Admin'
        Account testAccount = new Account
        (
            Name = 'Test Account',
            Owner = [select username from user where username = 'Corp Admin']
        );
        
        insert testAccount;
        
        // Create a forecast opportunity
        Opportunity testOpp = new Opportunity
        (
            AccountId = testAccount.ID,
            Name = 'testOpportunity' + date.today(),
            CloseDate = date.today() + 1,                    
            StageName = 'Contract signed; waiting for P.O',
            Type = 'Existing Business',
            Pricebook2Id = [select Id from Pricebook2 where name = 'Standard Price Book'],
            OwnerId = testAccount.OwnerId
         );
         
         insert testOpp;
         

 In the program, I want to set the appropriate Price Book, so that I can later enter line items from a specific price book.

The line:

Pricebook2Id = [select Id from Pricebook2 where name = 'Standard Price Book']

is used for this purpose.

 

When compiling, I get the error:

Invalid initial expression type for field Opportunity.Pricebook2Id, expecting: Id.

 

How would I get the Id for the price book?

 

In the same way, I am using the following, to enter a line item (OpportunityLineItem) for the opportunity:

PricebookEntryId = [select Id from Product2 where name = 'AC02'],

 

I get the same kind of error.

 

         Thanks,

 

                aqueller

 

I need help with the following:

 

I have a trigger on a record update. The record is uploaded with the owner being 'admin'.

I want to change it to the true owner of the account:

 

trigger ChangeOwner on Opportunity(before update)
{
   // Create a list of Opportunities, newOpps, to make it bulk fiendly
   List<Opportunity> newOpps = new List<Opportunity>();

   for(Opportunity o : Trigger.new)
   {
      if(o.ForecastCategoryName == 'Closed')
      {
         // This query retrieves the account associated with the Opportunity
         Account myAcct = [select id, name, AccountNumber, owner from account where id = :o.AccountId];


         // Change owner

         o.OwnerId = myAcct.owner;

 

         update o;

 

   }

}

 

This code returns an (understandable) error that it contains illegal recursion.

 

How can I get around this problem and change a field just before the record is updated?

 

      Thx,

 

            aqueller

 

I have an opportunity, ExOp that I receive through a query.

 

Opportunity ExOp = [SELECT name from opportunity

                                    WHERE (AccountId = :o.AccountId and ForecastCategoryName !='Closed')

                                    ORDER BY CloseDate ASC NULLS last LIMIT 1];

 

I am trying to access the list of product in it. (is it OpportunityLineItem?)

Specifically, I want to get to the 'Product2' and 'quantity' fields.



Can someone suggest code to access it?

 

I have an administrator account.

 

I can't edit the opportunity category of opportunities that are not mine,

although I can change the owner to myself, at which point I can edit

the opportunity category.

 

Is there a configuration setting that will allow me to edit the category

without changing owners?

This question is related to a previous question that I have posted.

 

My customers would like to see a single opportunity, for which they may receive several partial P.Os.

For example:

  • The opportunity is for 10 pens and 10 pencils
  • A week later they receive a P.O for 10 pens. They would like to show this sale as actual revenue and the remaining 10 pencils are still shown in the forecast
  • A week later they receive a P.O for the remaining pencils, at which point they close the opportunity

Is there a way to handle single opportunities with partial orders?

 

       Thx

Hi,

 

I have created two price books and want to set the system up such that some users

see Price Book 1, others see Price Book 2 and a third group sees Price Books 1 & 2 (selectable)

 

How do I configure the system to do that?

 

      Thx,

 

           aqueller

Hi,

 

I have a problem with permissions and perhaps someone can help me.

 

I have two managers, MGR A and MGR B.

 

Sales A reports to MGR A (MGR A is defined as his manager, MGR A is the direct manager of Sales A in the role hierarchy as well as the forecast hierarchy)

 

Sales B reports to MGR B in the same way.

 

To allow the managers to override the quota of their subordinates, I have configured them 'modify all data'. The problem is that by doing so, now MGR A can see the forecast for Sales B and MGR B can see the forecast of Sales A.

 

How would I enable the managers to overided their subordinates, yet only see the forecast of their group?

 

        Thx

Does the Apex Data Loader work on a developer sandbox?

- I am able to log into the production site, using its login, password and security token

  but am unable to do so in the sandbox that we have created for this site.

 

       Thx.

Hi,

 

I have an issue with seeing/editing another user's data.

 

1. I have 'edit quota' enabled in my profile

2. I am able to 'Manage Users'

3. The other users's profile shows that I am his manager

4. The other user has 'edit quota' enabled

5. In the forecasting hierarchy I show as being "above" the other user

6. Both of us have forecasting enabled.

7. Our site is configured for 'customizable forecasting'

 

I am able to see and modify my quota (from the user profile screen) but am unable

to see the 'Quotas' area in his profile.

 

Can someone tell me what is missing in the configuration?

 

         Thx,

 

                  aqueller

I am trying to write a trigger that will create a new opportunity when one is closed.

The code that I use is as follows:

 

trigger Recurring on Opportunity (after update)
{
    if (Opportunity.StageName == 'Closed Won')
    {
        Opportunity newOpp = new Opportunity (
                                    Account = 'TEST',
                                    StageName = 'Prospecting',
                                    Type = 'Existing Business');
        insert newOpp;
    }
}

I get two errors, one related to the IF statement and the other

related to setting the account.

 

Can someone suggest what are my mistakes and how I can correct them?

 

       Thx

I have an account, for which a contract was negotiated for a one-year period.

During this period, I expect to receive recurring orders, at approximately two months intervals.

 

Can you suggest what relationship should I create between the account/contract and opportunities,

so that I can show proper values in the sales pipeline?

 

1. Should I create individual opportunities for each expected P.O?

    (advantage: shows correctly in pipeline. Disadvantage: n:1 relationship with contract)

2. Should I create a single opportunity? (benefit: 1:1 relationship with contract.

    Disadvantage: how do I show it correctly in the pipeline?)

3. Another method?

I have created a custom object. The tab view (all records) list comes with three system assigned buttons:

- New $object

- Change owner

- Refresh.

 

I want to add another custom button for multi-record delete, as mass delete works only with standard objects.

When editing the page layout, it only allows modifying the displayed fields, but no custom buttons.

 

Where would I find the definition of the buttons that are being displayed?

Can I add a custom 'delete' button?

 

      Thanks,

 

               aqueller

Hello,

 

I have a formula field that produces text.

When I export the object, it doesn't export formula fields.

I would like to export the literal value of the formula field (i.e.: if it produces 'ABCD',

this value should be exported in the *.CVS file).

 

Is there a way to do it?

Is there perhaps an administrative utility that converts the data to text?

 

       Thanks,

 

                aqueller

I am trying to create a custom object which, similar to 'Contacts' has a composite field 'Name'

that consists of Salutation - First Name - Last Name.

 

The data type shown for the 'Name' field is 'Name'. When I try to create a name field in my custom object,

'Name' is not available as a data type.

 

Can someone tell me how do I:

 

1. Have the 'New custom field' page show the 'Name' data type

 

or alternatively:

 

2. Create custom data types which are composite, and allow to select them from

     the 'New custom field' page

 

               Thanks,

 

                           aqueller

I want to fully customize a standard object, such as Contacts: add delete fields and change their attributes.

How do I go about doing it?

 

- Do I need to duplicate the object? - if so, is there a way to clone it?

 

       Thank you,

 

                Abe Queller

Hi,

 

I have a developer edition and want to practice creation and management of forecasts.

When I enter the 'Forecasts' tab, I see an introductory page with no links that allow me

any actions.

 

I have checked my profile, and the 'allow forecasting' box is checked.

I have also checked the configuration of the 'customize->forecast' page and can't see anything wrong.

 

Can someone tell me what additional setting/configuration do I need to have, so that I am allowed to

create and view my own forecasts?

 

      Thank you.

 

 

Hi,

 

This may not be quite the best discussion board for my question, but I couldn't find a better one.

 

I am meeting with a customer who currently uses ACT 2011, regarding deployment of Salesforce.

Does anyone have material that compares the Salesforce with ACT?

 

        Thank you in advance.

 

                   aqueller

I am looking for help on the following issue.

 

I have a trigger that is supposed to delete certain types of opportunities, identified

by a custom field   PDS__Document_Type__c  as a 'Sales Order'.

 

My code is as follows:

 

trigger DeleteSO on Opportunity(after update)
{
   // Create a list of Opportunities, newOpps, to make it bulk fiendly
   List<Opportunity> newOpps = new List<Opportunity>();

   for(Opportunity o : Trigger.new)
   {
      // If it is a sales order, delete it
      if(o.PDS__Document_Type__c == 'Sales Order')
      {
          delete o;
      }
   }

   update newOpps;
}
      

 When I run it, I get an error:   DML statement cannot operate on trigger.new or trigger.old

 

Why do I get this error?

How can I fix it?



           Thx,

 

                      aqueller

 

 

 

 

I have an opportunity with a number of product line items.

I want to find the name of a product in a given line item (oldProdList[i] is an OpportunityLineItem).

 

I use the following query:

 

String ProdName = [SELECT Name FROM Product2 WHERE (id = :[SELECT Product2Id FROM PriceBookEntry WHERE ID = :oldProdList[i].PricebookEntryId].Id)];

 I get the error: Illegal assignment from LIST<Product2> to String .

 

I have the following questions:

 

1. Name is defined as a string field in Product2. Why am I getting this error?

2. Is it the right query structure for obtaining the product name?

 

            Thanks,

 

                       aqueller

I am setting an opportunity closing date as being 90 days from today ( date.today( ) ).

 

At a later point I create a string with the month name of the closing date, using the following code:

if (NewOpp.CloseDate.month() == 1) {monthName = 'Jan';}
 174	   // else if (NewOpp.CloseDate.month() == 2) {monthName = 'Feb';}
 175	   // else if (NewOpp.CloseDate.month() == 3) {monthName = 'Mar';}
 176	   // else if (NewOpp.CloseDate.month() == 4) {monthName = 'Apr';}
 177	   // else if (NewOpp.CloseDate.month() == 5) {monthName = 'May';}
 178	   // else if (NewOpp.CloseDate.month() == 6) {monthName = 'Jun';}
 179	   // else if (NewOpp.CloseDate.month() == 7) {monthName = 'Jul';}
 180	   // else if (NewOpp.CloseDate.month() == 8) {monthName = 'Aug';}
 181	   // else if (NewOpp.CloseDate.month() == 9) {monthName = 'Sep';}
 182	   // else if (NewOpp.CloseDate.month() == 10) {monthName = 'Oct';}
 183	   // else if (NewOpp.CloseDate.month() == 11) {monthName = 'Nov';}
 184	   // else {monthName = 'Dec';}

 The problem is that when I test the code it comes below 75% coverage,

given that we are in October and the close date of the next opportunity is in January.

 

How can I modify the test program to get full coverage? Is there a way to simulate

a system time for test purposes?

 

       Thank you

I am looking for help.

 

I have written a test program for an Apex trigger. The program creates a test account and an opportunity

that is associated with it. The code is shown below:

        // Create a test account for 'Corp Admin'
        Account testAccount = new Account
        (
            Name = 'Test Account',
            Owner = [select username from user where username = 'Corp Admin']
        );
        
        insert testAccount;
        
        // Create a forecast opportunity
        Opportunity testOpp = new Opportunity
        (
            AccountId = testAccount.ID,
            Name = 'testOpportunity' + date.today(),
            CloseDate = date.today() + 1,                    
            StageName = 'Contract signed; waiting for P.O',
            Type = 'Existing Business',
            Pricebook2Id = [select Id from Pricebook2 where name = 'Standard Price Book'],
            OwnerId = testAccount.OwnerId
         );
         
         insert testOpp;
         

 In the program, I want to set the appropriate Price Book, so that I can later enter line items from a specific price book.

The line:

Pricebook2Id = [select Id from Pricebook2 where name = 'Standard Price Book']

is used for this purpose.

 

When compiling, I get the error:

Invalid initial expression type for field Opportunity.Pricebook2Id, expecting: Id.

 

How would I get the Id for the price book?

 

In the same way, I am using the following, to enter a line item (OpportunityLineItem) for the opportunity:

PricebookEntryId = [select Id from Product2 where name = 'AC02'],

 

I get the same kind of error.

 

         Thanks,

 

                aqueller

 

I need help with the following:

 

I have a trigger on a record update. The record is uploaded with the owner being 'admin'.

I want to change it to the true owner of the account:

 

trigger ChangeOwner on Opportunity(before update)
{
   // Create a list of Opportunities, newOpps, to make it bulk fiendly
   List<Opportunity> newOpps = new List<Opportunity>();

   for(Opportunity o : Trigger.new)
   {
      if(o.ForecastCategoryName == 'Closed')
      {
         // This query retrieves the account associated with the Opportunity
         Account myAcct = [select id, name, AccountNumber, owner from account where id = :o.AccountId];


         // Change owner

         o.OwnerId = myAcct.owner;

 

         update o;

 

   }

}

 

This code returns an (understandable) error that it contains illegal recursion.

 

How can I get around this problem and change a field just before the record is updated?

 

      Thx,

 

            aqueller

 

I have an opportunity, ExOp that I receive through a query.

 

Opportunity ExOp = [SELECT name from opportunity

                                    WHERE (AccountId = :o.AccountId and ForecastCategoryName !='Closed')

                                    ORDER BY CloseDate ASC NULLS last LIMIT 1];

 

I am trying to access the list of product in it. (is it OpportunityLineItem?)

Specifically, I want to get to the 'Product2' and 'quantity' fields.



Can someone suggest code to access it?

 

I have an administrator account.

 

I can't edit the opportunity category of opportunities that are not mine,

although I can change the owner to myself, at which point I can edit

the opportunity category.

 

Is there a configuration setting that will allow me to edit the category

without changing owners?

Hi,

 

I have created two price books and want to set the system up such that some users

see Price Book 1, others see Price Book 2 and a third group sees Price Books 1 & 2 (selectable)

 

How do I configure the system to do that?

 

      Thx,

 

           aqueller

Hi,

 

I have a problem with permissions and perhaps someone can help me.

 

I have two managers, MGR A and MGR B.

 

Sales A reports to MGR A (MGR A is defined as his manager, MGR A is the direct manager of Sales A in the role hierarchy as well as the forecast hierarchy)

 

Sales B reports to MGR B in the same way.

 

To allow the managers to override the quota of their subordinates, I have configured them 'modify all data'. The problem is that by doing so, now MGR A can see the forecast for Sales B and MGR B can see the forecast of Sales A.

 

How would I enable the managers to overided their subordinates, yet only see the forecast of their group?

 

        Thx

Does the Apex Data Loader work on a developer sandbox?

- I am able to log into the production site, using its login, password and security token

  but am unable to do so in the sandbox that we have created for this site.

 

       Thx.

Hi,

 

I have an issue with seeing/editing another user's data.

 

1. I have 'edit quota' enabled in my profile

2. I am able to 'Manage Users'

3. The other users's profile shows that I am his manager

4. The other user has 'edit quota' enabled

5. In the forecasting hierarchy I show as being "above" the other user

6. Both of us have forecasting enabled.

7. Our site is configured for 'customizable forecasting'

 

I am able to see and modify my quota (from the user profile screen) but am unable

to see the 'Quotas' area in his profile.

 

Can someone tell me what is missing in the configuration?

 

         Thx,

 

                  aqueller

I am trying to write a trigger that will create a new opportunity when one is closed.

The code that I use is as follows:

 

trigger Recurring on Opportunity (after update)
{
    if (Opportunity.StageName == 'Closed Won')
    {
        Opportunity newOpp = new Opportunity (
                                    Account = 'TEST',
                                    StageName = 'Prospecting',
                                    Type = 'Existing Business');
        insert newOpp;
    }
}

I get two errors, one related to the IF statement and the other

related to setting the account.

 

Can someone suggest what are my mistakes and how I can correct them?

 

       Thx