• Brian Hopkins 25
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 3
    Questions
  • 8
    Replies
There was once an Idea to fix this... https://success.salesforce.com/ideaView?id=08730000000Bqr4AAC

It was eventually marked as Delivered, even though it was not.  However, the shitty experience I've had with Ideas is beside the point.

I need to know why I can't build a trigger on OpportunityContactRole.  There's just... no explanation, anywhere.  I tried opening a Case, and those people did not even understand what I was talking about...  Maybe it's just me but I have been having a brutal time with any sort of service coming directly from Salesforce.

I accept that Salesforce isn't going to lift a finger to solve the issue of not being able to create triggers.  Why would they, they already have my money.  I just want a straight answer - why?  Is that too much to ask?
When an Opportunity is created via a Contact, Salesforce will automatically create an OpportunityContactRole record.

When an after insert trigger is fired, the OpportunityContactRole records are already present.

However I cannot replicate this functionality in my Test Class.  When I insert the opportunity, the trigger fires before I can insert the OpportunityContactRole records, so the test fails.

I need to either:
  • Reproduce that automatic functionality so that the OpportunityContactRole is inserted with the Opportunity
  • Delay the firing of the trigger until after i have inserted the OpportunityContactRole

Triggers can not be added to the OpportunityContactRole object, or I'd have built it that way.
If you are not familiar with this process DO NOT RESPOND.  (I'm sick of getting copy-pasted responses from people who didn't read the question.)
Greetings,

So.  I've replaced the standard OpportunityContactRoles object with a custom one, Contact_Roles__c
It does basically the same thing, acts as a junction object between Contacts and Opportunities.

When a new Opportunity is created from a Contact page, the Opportunity edit page has the parameter conid=XXXXXXXXXX.
When saving the Opportunity, Salesforce uses this conid parameter to generate an OpportunityContactRole.

I've built a after insert trigger on the Opportunity, that queries OpportunityContactRole and duplicates them as Contact_Roles__c records.
That part works perfectly.

Now I am trying to write a test class for this, but I can't figure out how to pass in the conid parameter to the Opportunity insert function.
Keep in mind that this is a Trigger, not a Controller

How, I ask, would I accomplish this?  Do I still need to mess around with page controllers to emulate this functionality?
There was once an Idea to fix this... https://success.salesforce.com/ideaView?id=08730000000Bqr4AAC

It was eventually marked as Delivered, even though it was not.  However, the shitty experience I've had with Ideas is beside the point.

I need to know why I can't build a trigger on OpportunityContactRole.  There's just... no explanation, anywhere.  I tried opening a Case, and those people did not even understand what I was talking about...  Maybe it's just me but I have been having a brutal time with any sort of service coming directly from Salesforce.

I accept that Salesforce isn't going to lift a finger to solve the issue of not being able to create triggers.  Why would they, they already have my money.  I just want a straight answer - why?  Is that too much to ask?
When an Opportunity is created via a Contact, Salesforce will automatically create an OpportunityContactRole record.

When an after insert trigger is fired, the OpportunityContactRole records are already present.

However I cannot replicate this functionality in my Test Class.  When I insert the opportunity, the trigger fires before I can insert the OpportunityContactRole records, so the test fails.

I need to either:
  • Reproduce that automatic functionality so that the OpportunityContactRole is inserted with the Opportunity
  • Delay the firing of the trigger until after i have inserted the OpportunityContactRole

Triggers can not be added to the OpportunityContactRole object, or I'd have built it that way.
If you are not familiar with this process DO NOT RESPOND.  (I'm sick of getting copy-pasted responses from people who didn't read the question.)
Greetings,

So.  I've replaced the standard OpportunityContactRoles object with a custom one, Contact_Roles__c
It does basically the same thing, acts as a junction object between Contacts and Opportunities.

When a new Opportunity is created from a Contact page, the Opportunity edit page has the parameter conid=XXXXXXXXXX.
When saving the Opportunity, Salesforce uses this conid parameter to generate an OpportunityContactRole.

I've built a after insert trigger on the Opportunity, that queries OpportunityContactRole and duplicates them as Contact_Roles__c records.
That part works perfectly.

Now I am trying to write a test class for this, but I can't figure out how to pass in the conid parameter to the Opportunity insert function.
Keep in mind that this is a Trigger, not a Controller

How, I ask, would I accomplish this?  Do I still need to mess around with page controllers to emulate this functionality?
Dear All

I am facing a major challenge in prepopulating values in a custom lookup field from a URL (I am redirected to a new record standard page)
URL :
https://cs10.salesforce.com/001/e?acc2=Greg+Hewitt&CF00NJ0000001x7yoMAA=00QJ000000AQSUtMAP&nooverride=1&retURL=%2F001%2Fo

In the above URL : i am able to prepopulate the standard name field of account from the url param:
acc2=Greg+Hewitt

However, there is a custom field on account called convertedfromlead__c (which is a lookup to lead)
The above needs to be populated from:
CF00NJ0000001x7yoMAA=00QJ000000AQSUtMAP

Where : 
00NJ0000001x7yoMAA = Id field of Custom Field 
00QJ000000AQSUtMAP = Id field of lead record

The custom lookup field somehow does not get populated.

Kindly help me with this and let me know if this is possible.

I had prepended the id with CF as indicated in some articles, however, did not work with or without that

Regards
Rajat 
 
Hello,

We have develoepd a managed package, in which we want to include Contract management feature (sending contract, payment, send pdf, updates in SF etc). I want to know what all extra features I'll get if I use standard Contract object? Which I will not get if I create a new custom object? We are thinking to create a custom object because it is more flexible if product (managed package) is concerned.

Please tell me what should I prefer. Few things I know that we get on standard Contract i.e. activating, locking it down etc. Though I'm not sure what Activate button exactly does.

Please help me understand all features that std Contract object offers.

Thanks in advance!
Shruti
We are getting an error when running a test on the MyProfilePageController Apex class, as follows: 

System.DmlException: Insert failed.
First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, A first name is required.[Full_Name__c]
Stack Trace Class.MyProfilePageController.testSave: line 93, column 1


Since Apex tests are run when deploying change sets, we cannot deploy a set until this error is resolved. Problem is, we didn't write the code, and we're not developers. Looks like it's Salesforce.com code. Unfortunately, we don't have Premium support, and Salesforce will not assist and have directed us to this forum.

Help!
 
  • November 11, 2014
  • Like
  • 0

Hi All,

 

I would like to be able to call the SF Metadata API from Apex code in my custom app.

 

I went to Setup/App Setup/Develop/API and clicked on 'Download Metadata WSDL' and saved it to my hard drive.

 

Then I went to Setup/App Setup/Develop/ApexClasses and clicked on the 'Generate from WSDL' button. For Step 1, I navigate to the Metadata WSDL that I just saved and click 'Parse WSDL.' This takes me to the Step 2 screen where I then click on the 'Generate Apex code' button.

 

This takes me to the Step 3 screen which shows this error:

 

<error>

Apex generation failed.

Error message:
Error: Class name 'Metadata' already in use. Please edit WSDL to remove repeated names

 

</error>

 

Does this error mean that what I am attempting to do is not allowed? If it is allowed, how do I get around this error.

 

Any help would be appreciated.

 

Thanks,

Andrew