• Sennah
  • NEWBIE
  • 130 Points
  • Member since 2009

  • Chatter
    Feed
  • 4
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 20
    Questions
  • 63
    Replies

Hi:

 

    I have windows vista 32 bit? i downloaded apex data loader but when i supply my username/password of salesforce.com it gives an error " login error" .

 

    How to resolve it?

 

   Does it support only windows XP and 7 only?

 

Thanks,

Dhairya 

 

Hi all,

 

This may be a stupid question, but say I have created a Lead Page Layout for a specific Record Type, is there a way to copy this to an Opportunity Page Layout without having to recreate it all over again for the same Record Type in Opportunites.?

 

Thanks

  • October 11, 2009
  • Like
  • 0

Hello,

 

who can help me out with this? I need permissions for mass mailing;

 

 

NO_MASS_MAIL_PERMISSION, Single email is not enabled for your organization or profile. Single email must be enabled for you to use this feature.

 

 

but both, Support and Developerforce Team tell me they can't equip my DE with the privileges... Without I am not able to continue developing on this.

 

Anyone out there who can help?

 

The Org ID is: "00DA0000000aEi8"

 

Thanks

//Hannes

  • October 10, 2010
  • Like
  • 0

Hi Support / PM,

 

I am working with the LeadHistory table at same place in my code,

to find the previous owner of a Lead.

 

The funny thing (and the reason of this post) is, that in my production the "oldValue" field contains/returns the ID of the previous owner and in my Sandbox it returns the Name.

 

I didn't changed the API-Version, so this should not be the problem.

 

This is my query:

 

 

		LeadHistory leadHistory = [
			SELECT Field, LeadId, OldValue, CreatedDate 
			FROM LeadHistory 
			WHERE LeadId = :leadId 
				AND Field = 'Owner'
			ORDER BY CreatedDate DESC
			NULLS LAST
			LIMIT 1
		];

 

 

and this is my Debug output:

 

 

System.debug('oldValue content: ' + leadHistory.OldValue);

 

 

Again: For production it returns ID, for Sandbox it returns Name.

 

It's not a problem for my app, as I quickly fixed it, but I wonder how this can differ between two orgs.

 

You can run the code from anonymous by putting a lead ID in the code. Of course you need field tracking on Lead Owner and at least one Owner change.

 

Thanks,

Hannes

 

 

Hi Community,

 

who can provide a good and effective way to remove duplicates from a List of sObjects?

 

Of course without another SOQL ;)

 

Cheers,

//Hannes

Hey Product Manager / Support,

 

in all my Developer Orgs I am encountering the following problem:

 

When trying to edit the Campaign Member Status you'll get this error:

 

 

Unable to Access Page
Required parameter "p5" not defined.

Error: The value of the parameter specified above contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and re-submit. If the error still persists, please report it to our Customer Support team and provide the URL of the page you were requesting as well as any other related information. 

 

 

That is, because no CampaignMember Status is selected as default.

When you select a default status you are able to edit the CampaignMember Status just as usual.

 

Would be nice if this gets fixed in the DE template.

 

Thanks,

//Hannes

Hi community,

 

I am experiencing a very strange problem here: When updating the isActive flag on a User I can not getId() for the failed objects.

Here's the content of my resultSet:

 

 

result: 

(Database.SaveResult
[getErrors=(Database.Error
[getFields=();getMessage=cannot inactivate default web-to-lead user;
getStatusCode=system.StatusCode.UNKNOWN_EXCEPTION;]);
getId=null;
isSuccess=false;], 

Database.SaveResult
[getErrors=();
getId=005A0000000GfeHIAS;
isSuccess=true;])

 

 

You can see that the first user errors, but the Id is null.

The second user processes and it returns the Id just fine.

 

Here's my Database operation:

 

 

Database.SaveResult[]  result = Database.Update(userList,false);
System.debug('result: ' + result);

 

 

And two btws.:

1. The Documentation states that it is not possible to set the active flag via the API but I could do this in me DE!?

2. Why does the error code says "Unknown Exception", although it prints me an error message?

 

Thankfully for any hints,

 

//Hannes

Hey ho,

 

I am striving problems while trying to install Smart Follow. I enabled chatter and then tried to install the app via the AppExchange.

 

The installer fails with this error:

 

 

Problem:

1. Apex Classes(01p20000000TZcU) chatterfollowrules.testFollowDepartment();
chatterfollowrules.testFollowEveryone();
chatterfollowrules.testFollowManagerHierarchy();
chatterfollowrules.testFollowProfile();
chatterfollowrules.testFollowRole();
chatterfollowrules.testTeamfollowRule()
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SetupOwnerId duplicates value on record with id: 00D200000000NNy: []
Class.chatterFollowRules.testFollowDepartment: line 819, column 13 External entry point;
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SetupOwnerId duplicates value on record with id: 00D200000000NNy: []
Class.chatterFollowRules.testFollowEveryone: line 627, column 13 External entry point;
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SetupOwnerId duplicates value on record with id: 00D200000000NNy: []
Class.chatterFollowRules.testFollowManagerHierarchy: line 474, column 13 External entry point;
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SetupOwnerId duplicates value on record with id: 00D200000000NNy: []
Class.chatterFollowRules.testFollowProfile: line 759, column 13 External entry point;
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SetupOwnerId duplicates value on record with id: 00D200000000NNy: []
Class.chatterFollowRules.testFollowRole: line 667, column 13 External entry point;
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SetupOwnerId duplicates value on record with id: 00D200000000NNy: []
Class.chatterFollowRules.testTeamfollowRule: line 403, column 13 External entry point

2. Apex Classes(01p20000000TZcO) chatterfollowbatchcaller.testchatterFollowBatchCaller()
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SetupOwnerId duplicates value on record with id: 00D200000000NNy: []
Class.chatterFollowBatchCaller.updateSettings: line 58, column 4
Class.chatterFollowBatchCaller.testchatterFollowBatchCaller: line 128, column 3 External entry point



Validation Errors While Saving Record(s)

There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "00D200000000NNy: APEX_TEST_FAILED [01p20000000TZcU: chatterfollowrules.testFollowDepartment();
chatterfollowrules.testFollowEveryone();
chatterfollowrules.testFollowManagerHierarchy();
chatterfollowrules.testFollowProfile();
chatterfollowrules.testFollowRole();
chatterfollowrules.testTeamfollowRule(): System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SetupOwnerId duplicates value on record with id: 00D200000000NNy: []
Class.chatterFollowRules.testFollowDepartment: line 819, column 13 External entry point;
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SetupOwnerId duplicates value on record with id: 00D200000000NNy: []
Class.chatterFollowRules.testFollowEveryone: line 627, column 13 External entry point;
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SetupOwnerId duplicates value on record with id: 00D200000000NNy: []
Class.chatterFollowRules.testFollowManagerHierarchy: line 474, column 13 External entry point;
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SetupOwnerId duplicates value on record with id: 00D200000000NNy: []
Class.chatterFollowRules.testFollowProfile: line 759, column 13 External entry point;
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SetupOwnerId duplicates value on record with id: 00D200000000NNy: []
Class.chatterFollowRules.testFollowRole: line 667, column 13 External entry point;
System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SetupOwnerId duplicates value on record with id: 00D200000000NNy: []
Class.chatterFollowRules.testTeamfollowRule: line 403, column 13 External entry point, 01p20000000TZcO: chatterfollowbatchcaller.testchatterFollowBatchCaller(): System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SetupOwnerId duplicates value on record with id: 00D200000000NNy: []
Class.chatterFollowBatchCaller.updateSettings: line 58, column 4
Class.chatterFollowBatchCaller.testchatterFollowBatchCaller: line 128, column 3 External entry point]".

 

 

 

And when I choose to install the app with "Ignore Tests" I cannot create follow rules;

 

 

Visualforce Page: /apex/chatterFollow



caused by: System.DmlException: Insert failed. First exception on row 0; first error: DUPLICATE_VALUE, duplicate value found: SetupOwnerId duplicates value on record with id: 00D200000000NNy: []

Class.chatterFollowBatchCaller.updateSettings: line 58, column 4 External entry point

 

We are on EMEA. I can send my org. ID via PM if needed.

 

 

So, looks like I am not taking Chatter live today :(

 

Cheers,

Hannes

Hey all,

 

I am encountering a strange problem here: When I do a mass-update via my test class everything works fine. But when I load a file with the DataLoader in update mode it throws this error:

 

 

System.NullPointerException: Attempt to de-reference a null object

 

 

Here's a code snippet of which seems to make trouble. Line 3 is supposed to be the evil one.

 

for (Task t : trigger.new)  {
body = t.Description;
bodyLength = body.length();
}

 

 

 

Any ideas?

 

Cheers,

Hannes

Hey community,

 

I just deployed some new buttons and was wondering how often they would click it. So I developed a simple Analytics solution.

 

It's basically an Object with only one property (A number field) and a web-service class which has a method to increment the "number" for every click.

 

For every button you want to track you simply add this code:

 

sforce.apex.execute(
'MiniAnalytics',
'trackClick',
{objectOrEventName:'My super-duper Button'}); 

 Note: Button must be of type "Execute Javascript". So if you only call an URL so far, you should change that to "Execute Javascript" and put your URL in a "window.location":

 

window.location = '/some/url';

 

 

Now, if you click your Button(s) it will create a Mini Analytics object first and for every future click increment the "number". This will give you a list like this:

 

 

.. and there you go. Now you definitely know that all the training is needless - because they won't use your solutions anyway ;)

 

You can download the package from the AppExchange;

For Sandbox

For Dev / Live

 

Just install, deploy, grant access for admins only is OK and do not forget to enable the Apex Class for all profiles!

 

The package is non-managed and has not undergone any security review. So if any well known person is around and could check on the 20 lines of code and write that they are safe, that'll be great ;)

 

Hope you enjoy this and I am curios about some feedback.

 

Cheers,

//Hannes

 

Hi community,

 

I've build a Visualforce page for one of my custom objects.

 

Calling the page manually via URL/apex/PageName works just fine. For better usage I linked the Page as a "Custom Link" on my Homepage. But via that link the Page is not accessible because Salesforce adds my User.Id at the end of the link and the StandardController of my CustomObject can't handle this of course.

 

How would I catch this behavior in my Page? Or is there a better way to link to my Page?

 

Thanks for any hints,

Hannes

Hi community,

 

it is very interesting to see how the chatter apps are popping up right now.

Unfortunately I can not contribute a full application due to lack of time, but I wanted to share my thoughts on something...

 

I dropped by my colleague Christians desk yesterday. He was part  of a team here at CoreMedia, researching collaboration in an Enterprise 2.0. We had a look into chatter and discussed the capabilities and values that it has.

 

He then showed my slides from their work (back in 2008 ^^) . A very interesting aspect which their software would have had covered (is that correct English?) is an emotion map. The idea would be to take the status updates, from a certain time frame and analyze them for 'good' and 'bad' words. Then take the result and visualize it*.

I picked up the idea and developed it further, to something which I would call the "emotion alert". Basically, that would be an application where a user (maybe restricted to manager profiles) could enable and refine a rule set, which alerts him when status updates regarding the company situation or on specific projects are going into another direction then they did before. The application would have a preset of sentences and hash-tags which express a certain motion and ideally self learn from either the manager fine-tuning it, or users doing it inexplicit, using a 'like' function or something similar. The rule set should also take object changes it consideration. For example lowering/highering the Oppti amount, less/more conversation rates, less/more system logins, maybe a third-party component feed could be handled too: Website visitors, AdWords stuff, Shop-Orders, etc.

 

Both parts together would build a great "emotion app". Start tab displays the emotion map and then a second tab allows to set up alerts for certain movements within the company. Of course it heavily depends on the employees and their system adoption.

 

Let me know what you think. I am curious about some feedback and maybe someone is picking up the idea and builds a great app. Btw.: This is one example where triggers would come in handy I guess ;)

 

Cheers,

Hannes

 

Skype: hannes.ellerbrock

Mail: hannes@coremedia.com

 

* = I am not sure if it is okay to post their slides public. If someone is interested, please get in touch with me via PM.

  • March 30, 2010
  • Like
  • 0

Dear Product Manager in charge for the "Apex Scheduler",

 

I was wondering why my code did not worked when scheduled. After requesting the debug logs, I could see the following:

 

 

EXCEPTION_THROWN|[45,19]|System.CalloutException: Callout from scheduled Apex not supported.

 

Here are my questions:

 

1. Is this going to be officially changed?

2. Is there a workaround?

3. Did I missed something in the documentation or is it simply not written down there?

 

Quite disappointed,

 

Hannes

 

  • March 12, 2010
  • Like
  • 1

Hi community,

 

I hope someone can help with this: I am running a simple test for webservice callouts. It worked just fine yesterday. With no code changed it won't work today. This is really running me crazy.

 

The test method is really simple. It first inserts two objects and then runs the real test:

 

test.startTest();
ZendeskWebcall.customerLicensesToExpire();
test.stopTest();

 

 The tests debug log says the following:

 

 

11:46:24.569|METHOD_ENTRY|[46,19]|System.Http.send(System.HttpRequest)
11:46:24.569|EXCEPTION_THROWN|[46,19]|System.TypeException: Methods defined as TestMethod do not support Web service callouts, test skipped
11:46:24.569|METHOD_EXIT|[46,19]|send(APEX_OBJECT)
11:46:24.569|METHOD_EXIT|[83,7]|sendNotification(String)
11:46:24.569|METHOD_EXIT|[25,13]|customerLicensesToExpire()
11:46:24.569|FATAL_ERROR|System.TypeException: Methods defined as TestMethod do not support Web service callouts, test skipped

 

 The message itself is of course correct; A TestMethod should not make a real call. But why does it exit with FATAL ERROR and don't even continue to stopTest()?

My first thought was that
customerLicensesToExpire()

 

 

 was defined as test method by erro. But it is course not.

 

Any hints?

 

 

  • March 11, 2010
  • Like
  • 0

Hi,

 

I am receiving this error in my Sandbox on tapp0 when trying to run Apex Tests:

 

 

Internal Salesforce Error: 1198845769-143 (-23142055) (-23142055)

 It looks like that it is thrown when I try to insert an custom object. The Problem occurred from one day to another. Doing the same that the test class does by hand works just fine.

 

Any ideas who could help with this? Support seems pretty overloaded. I have tickets on "new" since more than 10 days.

 

Best,

Hannes

 

  • February 19, 2010
  • Like
  • 0

Hi community,

 

I have coded an email handler that sends out an email to a campaign member when the  CampaignMember gets insert and fulfills certain criteria. That works just fine.

 

My test class inserts a campaign, a lead and a contact and then CampaignMembers  for them. I don't want to call the method directly because I want to test real conditions. That's why my code inserts all the objects and the insert of the CampaignMember fires the trigger that sends out the email.

 

When reviewing the debug log I can verify that the emails have been queued, so the code is working as desired and I have 100% code coverage. Also does my manual test verifies that the code works.

 

But, and here's my question: How can I make sure (assert), that emails have been sent.

I tried 

System.Limits.getEmailInvocations();

 

but that always returns 0.

 

Hope anyone can help with this!

 

Best,

Hannes

 

  • February 19, 2010
  • Like
  • 0

Hi all,

 

does anyone knows how to activate a contract in a test-class?

 

Thanks,

 

Hannes

  • January 22, 2010
  • Like
  • 1

Dear tier 3,

 

this post regards a bug in the page layout editor.

I just had a phone call with tier 1 telling me that they can not escalate this due to some kind of internal rule and the only thing I can do is to post it on the developer-force.

 

Although I don't care if this gets fixed I wanted to make it public to point out how senseless this whole bug-reporting thing is. A customer (me) takes the time to report this error in your Software and you telling him (me) that you won't file the bug because I don't have developer support?

 

Here's how to reproduce the bug and get the exception:

Open the page layout editor with a VisualForce or S-Control in it.

Edit the VF element, set the height to null (leave the field empty).

Then try to save the layout. An exception will be thrown.

 

This is not only happening in my live org. You can reproduce it in every org.

 case:

#03001352

 

So far,

Hannes

  • October 16, 2009
  • Like
  • 0

Hi all,

 

I have a big problem here:

Eclipse is telling me that line converage is too low and prevents saving. But this is my dev. org. and it is my understanding that there is no line coverage needed - or is this different with force.com sites dev. orgs?

Although I am a fan of "test first" this is somehow bothering. Any help appreciated ;)

 

In case support is reading this: My org. ID is 00DA0000000HPxx

 

Best,

Hannes

 

 

  • October 16, 2009
  • Like
  • 0

Hi community,

 

 I am trying to code a trigger that sets the lead's status after it was converted according to either if or if not a Oppti has been created.

 

It basically would look like this:

 

 

trigger LeadConvertStatusOnLeadUpdate on Lead (before update) {

for (Lead l : trigger.new) {

if (l.ConvertedContactId != null && l.ConvertedOpportunityId == null) {
l.Status = 'Closed - Converted to Contact';
update l;
}

if (l.ConvertedContactId != null && l.ConvertedOpportunityId != null) {
l.Status = 'Closed - Converted to Opportunity';
update l;
}
}

}

 

 But this didn't worked out. It just did not set that value.

I tried to make it a trigger "after update" but that also did not worked. It threw me an error that the lead is read-only.

 

Any ideas?

 

Thanks,

Hannes

 

Message Edited by Sennah on 10-26-2009 09:28 AM
  • October 13, 2009
  • Like
  • 0

Hi community,

 

I wonder why my trigger on Contact/delete is not fired when I delete the Account that holds the Contact.

 

Is my assumption wrong?

 

Is there any way to enable this or do I have to write a trigger for Account/delete?

 

Thanks for any hints,

Hannes

  • October 12, 2009
  • Like
  • 0

Hi community,

 

I am working on a VisualForce element which is included in the page layout of my custom object "invoice".

The VF page gets two different lists of opportunities from the account where both, invoice and opptis are  connected to. From those lists you can select opptis and process them.

The basic function works just fine so far.

 

Now, here's my problem: Once the processing is complete I want to fully reload the invoice - the whole page, including the related lists and so on.

 

I tried setting PageReference for my action method and several javascript actions for onComplete.

The PageReference loads the invoice again in the iframe where my VF element was.

The javascripts don't load the whole page again. If I were able to get the current invoice ID this might work:

 

 

<apex:commandButton value="Add Selected" action="{!processSelectedAdd}" onComplete="parent.location.href = '/'"/>

 

 ... by adding the ID to the parent.location.href value.

 

Here's the part of my controller with the PageReference I tried. You see "return null;" is not active at the moment. I tried that too but it doesn't worked out. To get the javascript redirect working at all the return value for this must be null:

 

public PageReference processSelectedAdd() { List<Opportunity> selectedOpportunities = new List<Opportunity>(); for (oOpportunity oOpp : getOpportunities()) { if (oOpp.selected == true) { selectedOpportunities.add(oOpp.opp); } } //System.debug('processing the following:'); for (Opportunity opp : selectedOpportunities) { opp.Invoice__c = this.invoice.Id; update opp; } PageReference pageRef = new PageReference('/' + this.invoice.Id); pageRef.setRedirect(false); return pageRef; //return null; }

 

 And here's the whole VF object:

 

 

<apex:page standardController="CM_Invoice__c" extensions="OpptiListControllerWrapper" tabStyle="Opportunity"> <apex:form > <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton value="Add Selected" action="{!processSelectedAdd}" onComplete="parent.location.href = '/'"/> </apex:pageBlockButtons> <!-- --> <apex:pageBlockTable value="{!opportunities}" var="o" id="table"> <apex:column > <!-- --> <apex:inputCheckbox value="{!o.selected}"/> </apex:column> <!-- --> <apex:column value="{!o.opp.Name}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:form> <apex:form > <apex:pageBlock > <apex:pageBlockButtons > <apex:commandButton value="Remove Selected" action="{!processSelectedDel}" /> </apex:pageBlockButtons> <!-- --> <apex:pageBlockTable value="{!opportunities2}" var="o" id="table2"> <apex:column > <!-- --> <apex:inputCheckbox value="{!o.selected}"/> </apex:column> <!-- --> <apex:column value="{!o.opp.Name}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

 

 

 

 

 Really thankful for any hints!

 

Best,

Hannes

 

  • September 16, 2009
  • Like
  • 0

Dear Product Manager in charge for the "Apex Scheduler",

 

I was wondering why my code did not worked when scheduled. After requesting the debug logs, I could see the following:

 

 

EXCEPTION_THROWN|[45,19]|System.CalloutException: Callout from scheduled Apex not supported.

 

Here are my questions:

 

1. Is this going to be officially changed?

2. Is there a workaround?

3. Did I missed something in the documentation or is it simply not written down there?

 

Quite disappointed,

 

Hannes

 

  • March 12, 2010
  • Like
  • 1

Hi all,

 

does anyone knows how to activate a contract in a test-class?

 

Thanks,

 

Hannes

  • January 22, 2010
  • Like
  • 1

Hello,

 

who can help me out with this? I need permissions for mass mailing;

 

 

NO_MASS_MAIL_PERMISSION, Single email is not enabled for your organization or profile. Single email must be enabled for you to use this feature.

 

 

but both, Support and Developerforce Team tell me they can't equip my DE with the privileges... Without I am not able to continue developing on this.

 

Anyone out there who can help?

 

The Org ID is: "00DA0000000aEi8"

 

Thanks

//Hannes

  • October 10, 2010
  • Like
  • 0

Hi!

 

I have problems with testing the following trigger when I tries do deploy it to the server from eclipse. And in Eclipse it is an yellow triangle next to the trigger which says it's only on local machine, not on the server. Is there anybody who can help me. The error I got when I run the test is that from the if clause is never tested... I wonder what's wrong.

 

TRIGGER:

 

trigger CreateAssetOnDoneItem on OpportunityLineItem (after insert,after update) {
  List<OpportunityLineItem> list_oli = new List<OpportunityLineItem>();
  //Setup the array to hold the ids to Iterate through
   Set<Id> pbeIds = new Set<Id>();
  //Iterate through the Line Items
    for (OpportunityLineItem oli : Trigger.new)
    {   
       // Create individual post
       pbeIds.add(oli.PricebookEntryId);
       pbeIds.add(oli.opportunityId);
    }
     //Setup APEX MAP Arrays to get the required data from the Pricebook and Opportunity
    Map<Id, PricebookEntry> entries = new Map<Id, PricebookEntry>([select Product2.ProductCode,Product2.Name from PricebookEntry where id in :pbeIds]);
    Map<Id, Opportunity> Opp = new Map<Id, Opportunity>([select Account.Name, Account.ID from Opportunity where id in :pbeIds]);
    

      Asset[] ast = new Asset[]{};
         Asset a = new Asset();
         Integer teller = 0;
      for(OpportunityLineItem oli: trigger.new){
               
        if(oli.Status__c == 'Godkjent hos leverandør'  && oli.Converted_to_Asset__c == false)
         {
          a = new Asset();
          a.AccountId = opp.get(oli.OpportunityId).AccountId;
          //a.Product2Id = opp.get(oli.Pricebookentryid).PricebookEntry.Product2Id;
          a.Product2Id = oli.PricebookEntry.Product2ID;
          //a.Product2.Name= oli.PricebookEntry.Product2.Name;
          //a.Product2 = oli.PricebookEntry.Product2Id;
          a.Quantity = oli.Quantity;
          a.Opprinnelig_sum__c = a.Quantity;
          //a.Price =  ol.UnitPrice;
          a.PurchaseDate = oli.Opportunity.CloseDate;
          a.Status = 'Mangler provisjon';
          //a.Description = ol.Description;
          a.Provisjon__c = oli.Provisjon__c;
          System.debug(entries.get(oli.Pricebookentryid).Product2.Name);
          a.Name = entries.get(oli.Pricebookentryid).Product2.Name;
          ast.add(a);
          oli.Converted_to_Asset__c = true;
          //update oli;
          }  
    }
       
 
      insert ast;
     
    
}

 

 

TESTCLASS:

 

@isTest
private class testCreateAssetOnDoneItem {

    static testMethod void testCreateAssetOnDoneItem(){
        
        Account a = [select Id from Account limit 1];
        PricebookEntry pbID = [select Id from PricebookEntry limit 1];
        Opportunity o = new Opportunity();
        OpportunityLineItem ol = new OpportunityLineItem();
        
        o.AccountId = a.Id;
        o.Name = 'test';
        o.StageName = 'Presentere mulighet';
        o.CloseDate = date.today();
        insert o;
        
        ol.OpportunityId = o.Id;
        ol.Quantity = 1;
        ol.UnitPrice = 1.00;
        ol.PricebookEntryId = pbId.Id;
        ol.Converted_to_Asset__c = false;
        
        insert ol;
        test.start();
        ol.Status__c= 'Aksetptert salg';
        update o;
        test.stopTest();
        delete ol;
        delete o;
        
        
        
    }
    
    
}

Hi Everybody,

I want a custom button(next to: Request Update in contact page). 

When the button is pressed(by the admin) it should send mail to particular person(Let the contact person name be : XX)

XX receives a mail and XX should fill the custom fields sent along with the mail (this is to update the contact info).

When XX fill up the fields and hits the submit button it should be updated in Admin DB.

Is it possible?

 

Thanks

Haan

knowing that the callout limit is 10 per Apex transaction, I just wanted to confirm that this would be per batch execution, and not 10 total for the whole batch.

 

For instance, if I have a batch that is to iterate over 10 records in a table, and I set the batch scope to 1, I'd be able to execute a max of 10 callouts per record that I'm iterating in the batch.  Does that sound right?

 

I'm looking to "synch" our community from a 3rd party platform via webservices, every couple hours, rather than execute callouts on every page load that needs the data, so we can reduce latency on Visualforce pages where this content can be "cached" in Salesforce objects instead of on demand.

Hi Support / PM,

 

I am working with the LeadHistory table at same place in my code,

to find the previous owner of a Lead.

 

The funny thing (and the reason of this post) is, that in my production the "oldValue" field contains/returns the ID of the previous owner and in my Sandbox it returns the Name.

 

I didn't changed the API-Version, so this should not be the problem.

 

This is my query:

 

 

		LeadHistory leadHistory = [
			SELECT Field, LeadId, OldValue, CreatedDate 
			FROM LeadHistory 
			WHERE LeadId = :leadId 
				AND Field = 'Owner'
			ORDER BY CreatedDate DESC
			NULLS LAST
			LIMIT 1
		];

 

 

and this is my Debug output:

 

 

System.debug('oldValue content: ' + leadHistory.OldValue);

 

 

Again: For production it returns ID, for Sandbox it returns Name.

 

It's not a problem for my app, as I quickly fixed it, but I wonder how this can differ between two orgs.

 

You can run the code from anonymous by putting a lead ID in the code. Of course you need field tracking on Lead Owner and at least one Owner change.

 

Thanks,

Hannes

 

 

Hi Community,

 

who can provide a good and effective way to remove duplicates from a List of sObjects?

 

Of course without another SOQL ;)

 

Cheers,

//Hannes

HI,

 

I created a package with some trigger and custom fields in sandbox. I want to upload it to product as below:

1. Can it be installed in product with the sandbox package installation link?

2. If I use deployment connection to upload it to product. How can I uninstall it from product?

 

Thanks

Kunlun

Hi , 

        We want to buy Cloud Platform .

1. Which is best Force.com or Salesforce.com?

2. Difference between Force.com or Salesforce.com?

3. Salesforce.com Edition price depends on on developers or Client users?

4. Our Requirement is to Create Only Dashboard in Salesforce.com for our .Net Projects. so which one should we             choose force.com or salesforce?.  

Hello All,

 

Greetings.

 

Could you please share with me advanced apex concepts?

 

Thanks,

Rao

  How to select city in a picklist by selecting a state in another picklist?

 

    I have made an object called "State". There are three custom fields :

                                                                     1. State

                                                                     2. City

                                                                     3. Village

                                                                      in this object.

I have made  picklists for state, city and village . I want that whenever i select a state, city associated with this state got select. And also when i want that  whenever i select a city, Village associated with this city got select.If you have any solution please tell me.Thanks .

I have written code for that which is as follow:-

                                             For page

<apex:page controller="sampleCon">
<apex:form >
<apex:actionFunction name="Citysearch" action="{!getCities}" reRender="result" status="status1"/>
<apex:actionFunction name="Villagesearch" action="{!getVillages}" reRender="result" status="status2"/>

<apex:selectList value="{!State}" size="1" onclick="searchCity()" >
<apex:selectOptions value="{!items}" />
<apex:actionStatus startText="Searching..." stopText="Search Result" id="status1" >
</apex:actionstatus>
</apex:selectList>

<apex:selectList value="{!City}" size="1" onclick="searchVillage()">
<apex:selectOptions value="{!Cities}"/>
<apex:actionStatus starttext="searching..." stoptext="Search Complete" id="status2" >
</apex:actionStatus>
</apex:selectList>

<apex:selectList value="{!Village}" size="1">
<apex:selectOptions value="{!Villages}"/>
</apex:selectList>

</apex:form>
<script>
function searchCity(){
// alert('hiiiiiiiiiii');
getCities();
}
function searchVillage()
{
// alert('hello');
getVillages();
}
</script>
</apex:page>
For controller
public class sampleCon {
        String id;
        public StateCity__c State{get;set;}
        public StateCity__c City{get;set;}
        public StateCity__c Village{get;set;}
        
        public List<SelectOption> getItems() {
                    List<SelectOption> options = new List<SelectOption>();
                    options.add(new SelectOption('id','Rajasthan'));
                    options.add(new SelectOption('id','MP'));
                    return options;
                    }
        
        public List<SelectOption> getCities() {
                    id = ApexPages.currentPage().getParameters().get('id');
                    List<SelectOption> options = new List<SelectOption>();
                    options.add(new SelectOption('id','Ajmer'));
                    options.add(new SelectOption('id','Bhopal'));
                    return options;
                    }
        
        public List<SelectOption> getVillages() {
                    id = ApexPages.currentPage().getParameters().get('id');
                    List<SelectOption> options = new List<SelectOption>();
                    options.add(new SelectOption('id','Kishangarh'));
                    options.add(new SelectOption('id','Nimach'));
                    return options;
                    }               
}

I have been trying to have the rule criteria for a workflow to evaluate to TRUE if a date field in the custom object has been changed.

 

I've been attempting this via the ISCHANGED(Date_field__c) function. However this fails with a message that this function  is invalid for this type of formula.

 

I then want a time dependent workflow action to be set...

 

Any ideas on how I can do this?

 

I'm not sure if the new UI has anything to do with it but I enabled the new UI today.

 

Previously when a user grants me administrator access, I was able to log in and extend the date of access if I needed to however now, it gives me "insufficient privileges"and i'm the system administrator.

 

Is anyone else having the same issue?

Hey Product Manager / Support,

 

in all my Developer Orgs I am encountering the following problem:

 

When trying to edit the Campaign Member Status you'll get this error:

 

 

Unable to Access Page
Required parameter "p5" not defined.

Error: The value of the parameter specified above contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and re-submit. If the error still persists, please report it to our Customer Support team and provide the URL of the page you were requesting as well as any other related information. 

 

 

That is, because no CampaignMember Status is selected as default.

When you select a default status you are able to edit the CampaignMember Status just as usual.

 

Would be nice if this gets fixed in the DE template.

 

Thanks,

//Hannes

I have a checkbox in Accounts that is called client. I want all child account client  = True when any one of those accounts has client = True.

 

For Instance:

 

Account A (parent account 1)

Account B (parent account 1)

Account C (parent account 1)

Account D(parent account 1)

 

If Client = True in Account A, I want Client to be set to True in Account B,C and D. Is this possible?

Hi community,

 

I am experiencing a very strange problem here: When updating the isActive flag on a User I can not getId() for the failed objects.

Here's the content of my resultSet:

 

 

result: 

(Database.SaveResult
[getErrors=(Database.Error
[getFields=();getMessage=cannot inactivate default web-to-lead user;
getStatusCode=system.StatusCode.UNKNOWN_EXCEPTION;]);
getId=null;
isSuccess=false;], 

Database.SaveResult
[getErrors=();
getId=005A0000000GfeHIAS;
isSuccess=true;])

 

 

You can see that the first user errors, but the Id is null.

The second user processes and it returns the Id just fine.

 

Here's my Database operation:

 

 

Database.SaveResult[]  result = Database.Update(userList,false);
System.debug('result: ' + result);

 

 

And two btws.:

1. The Documentation states that it is not possible to set the active flag via the API but I could do this in me DE!?

2. Why does the error code says "Unknown Exception", although it prints me an error message?

 

Thankfully for any hints,

 

//Hannes