Questions tagged [opportunity]

An Opportunity is a Salesforce Standard Object that represents a sale or pending deal.

Filter by
Sorted by
Tagged with
9
votes
3answers
12k views

Make Validation Rule bypass if TRIGGER is run?

Is there a way to make a Validation Rule BYPASS via it's logic when a Trigger is doing it's job? I've already tried various methods including setting a hidden field on the object in the Trigger (can'...
41
votes
2answers
71k views

How to fix insufficient access rights on cross-reference id?

I am getting the error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: [] Scenario is, I am inserting an Opportunity and then Opportunity Line ...
7
votes
2answers
6k views

Sending Email using Email Author in custom button

I have tried this code for custom button for single click email sending. Unfortunately it is not working and returns an error. Could anyone tell me what I am doing wrong and correct me please. Thank ...
21
votes
1answer
2k views

Refresh lightning component Opportunity page on Stage progress bar

I have a lightning component on the opportunity layout. I want it to refresh on stage change. Currently, it works when you change the stage using the edit button using the following code. <aura:...
2
votes
1answer
2k views

How to recreate Contact, Account, & Opportunity homepages with Visualforce pages?

An answer, from this question, "How to remove Reports & Tools from the Contact, Account, & Opportunity homepages?," suggest the following: If you are open for writing Code then here ...
6
votes
1answer
698 views

Account lookup on Opportunity not filtered correctly from Visualforce page

Visualforce Our organization uses a Visualforce page to override the New Opportunity action. Below is a functional sample of the Visualforce page that specifies the Account lookup field and ...
25
votes
9answers
26k views

Is it possible to remove/hide the “New” button?

When you click on the Opportunities tab, (assuming you haven't modified standard salesforce layout), you see a "Recent Opportunities" list. At the top of the list, there is a "New" button. Is there ...
7
votes
6answers
17k views

Run Trigger As A Specific User (or Profile)?

Is this possible? I'm not finding help, Google or otherwise, for this. Situation: A trigger runs and cycles through groups of Opportunities. Some of these Opportunities are Closed Won, and most ...
7
votes
2answers
5k views

Using Apex Managed Sharing to share an opportunity

Here's the use case. When a lead is converted to an Opportunity, I want to automatically share the opportunity with the previous owner of the lead. This is needed because upon conversion, the ...
4
votes
2answers
6k views

After Delete - Need To “Cleanup” When An Opp Is Deleted

I have a hole in the logic of a huge Trigger that "piggybacks" data from Opportunities to Account (summarized). If someone touches an Opp, this trigger fires and checks ALL OPPS under that Account ...
3
votes
1answer
3k views

Opportunity Access for customer community and customer community licenses

I can't show opportunity tab to customer community and customer community licenses users. And on the profile level there is no any option for this. I read the documents and type of licenses and ...
2
votes
2answers
2k views

How to remove “Reports” & “Tools” from the Contact, Account, & Opportunity homepages?

Attempting to remove the "Reports" & "Tools" items from the homepages of Contact, Account, & Opportunity - is this possible, and if so, how?
2
votes
2answers
921 views

Validation Rule on picklist under opportunities

There are 2 requirements: standard users can’t update the status of a record beyond “open won” (so that only SF Admins or auto processes update “registered” and the stages beyond registration. ...
1
vote
1answer
63 views

Automatically add ProductB once productA is manually added to Opportunity

I was trying to accomplish this through a trigger, but its not really working. Is there a way to get this done through Process Builder? If so, what is that process? I'm trying to have ProductB being ...
1
vote
1answer
143 views

Custom Validation using Trigger throwing System.FinalException: SObject row does not allow errors

I am trying to addError on the opportunities based on one condition. But getting System.FinalException: SObject row does not allow errors error while saving the record. Below I have given the code ...
0
votes
1answer
88 views

Fetch Files Related to opportunity in salesforce

I want to run a SOQL query that fetches files associated with opportunities(in a particular stage). If I am not wrong content version is the actual object I need to be querying on to fetch content? ...
0
votes
1answer
807 views

Salesforce trigger Opportunity and Opportunity product

I am working on a requirement to create an opportunity and opportunity products , when there is an update on the asset object. The asset object has a filed called Refresh_Asset_To__c, this is a ...
9
votes
1answer
16k views

INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: [] on opportunity

I have created an object named as "Component" which has Master-Detail Relationship with Opportunity Object. On Opportunity we have a button says "Create Component", when user clicks on it it takes ...
4
votes
1answer
2k views

How to upload an Excel file into ContentVersion Object

I need to upload an Excel file on an opportunity. I want to user ContentVersion standard object to store these excel files. Can anyone please explain or share a code snippet to show how can we ...
6
votes
2answers
12k views

How to query Products by Opportunity?

I want to query products only related to particular opportunity. And I tried this using sub-queries but I was able to retrieve PricebookEntries related to Opportunities. I'll hit a dead end if I tried ...
4
votes
2answers
4k views

Access ListView via REST API

I am trying to use the REST api to access Opportunities in SalesForce. I seem to be able to do this quite easily with a call to services/data/v26.0/sobjects/Opportunity/ and enumerating over the ...
2
votes
1answer
278 views

Custom button to open opportunity after lead is converted

I have a global class that creates an Opp from a custom lead conversion button. The problem is that the button works to convert the lead to an Opp but it does not open the Opp. I get an error message ...
2
votes
1answer
2k views

Get Opportunity with Opportunity Line Items

How can I use the salesforce api to get a list of opportunities such that each opportunity contains it's opportunity line items?
1
vote
1answer
955 views

Access Opportunity Fields during Task Creation

Is it somehow possible to implement a process based on TASK creation, that accesses information on a related opportunity (if present)? More precisely, I want to update a field on the task, if the ...
1
vote
3answers
1k views

Redirect to opportunity edit page

I have 2 user profiles: internal user and partner user (partner portal). I want to have separate behaviours when each user clicks on the Opportunity New button, to create a new opportunity: internal ...
9
votes
1answer
4k views

How can i query for the type in opportunity stage?

How do i query for all opportunities which has the type "Closed/won" on opportunityStage not the stage "Closed/Won". We have a few stages which are of Type Closed/Won but not with the stagename as ...
5
votes
1answer
2k views

Account Owner changes Opportunity Owner?

Q1: When I change the owner of an Account record to UserA, the associated Opportunity record's owner is set to UserA automatically. Is it a native behavior? (I checked all the workflows and account ...
4
votes
2answers
2k views

How to get Opportunities from Contacts

I am trying to get Opportunities from Contacts but hitting the below error: Save error: The configuration of your org has changed, please reload the page. Missing dependent object: Field: ...
4
votes
2answers
8k views

Trigger to update opportunity stage based on Account Status

I have a trigger that updates/ inserts opportunities when the account is created. This was implemented by a third party. Now I would like to update the opportunities to Cancelled when the Account ...
3
votes
1answer
2k views

How to Map Opportunity Owner to Account Owner

I'm trying to find a way to map the opportunity owner field to the account owner field when a new opportunity is created. So if an opportunity is created by Jon for Account XYZ, which is owned by Jill,...
3
votes
2answers
7k views

Why i am getting “Field is not writable: OpportunityShare.UserOrGroupId” compile time error

I am getting compile time error while trying to assign userId to opShare.UserOrGroupId field. I am not sure what is wrong in it - List<OpportunityShare> grantAccessUpsertLst = new List<...
2
votes
1answer
253 views

different behaviour when adding opportunityline through visual flow?

To give some context, I had the requirement that I needed to guide the users through a couple of screens when closing an opportunity. So logically, I started implementing this requirement using ...
2
votes
1answer
72 views

Is it possible to sum all the days of a set of events inside an opportunity and subtract from a total # of days?

I am using opportunities in Salesforce to track professional services engagements. As soon as the opportunity is won and closed, I will fill in a custom field called "number of days" which represents ...
2
votes
2answers
530 views

Trigger Is not working on opportunity while insert

I have a trigger in opportunity in trigger on update and insert. It was working until today but suddenly gotta stuck. It is working fine while update but while inserting it is giving error like ...
2
votes
2answers
1k views

How can I create Opportunity Validation Rules without breaking Lead Conversion?

In our Salesforce process, our Opportunities have a custom Picklist field called 'Vertical' to track the industry segment of each Opportunity. I'm trying to make this a required field. I'd like to ...
1
vote
1answer
1k views

Approval Process : Lock the whole Opportunity Including Notes and Attachment

Currently I have an approval process, that locks the opportunity and the record but the user, still can submit Notes & Attachments after. Is there a way to lock those as well?
1
vote
2answers
1k views

How to lock date field in opportunity? [closed]

I have few scenarios for locking the date If Closed:Won – Date locked If Stage changed to ‘Closed:Lost’ or ‘Declined’ from Closed:Won then date is changed to the date of that activity and locked ...
1
vote
2answers
473 views

In a new trigger on an Opportunity, how can I grab the owner's email address or other info if the type is Lookup(User)?

Ultimately, my goal is to send the owner an email with a trigger. This is my first time working with triggers, so bear with me, I'm still trying to figure it out. Starting small, I managed to use a ...
1
vote
1answer
6k views

Trigger to update converted Lead's Opportunity with information from converted Contact

I'm having an issue with a trigger, and can't seem to figure it out, so I'm hoping someone can help me. Basically, I wrote a trigger that runs when a lead is converted. It is supposed to populate a ...
1
vote
2answers
2k views

Problems writing a Test class for the salesforce OpportunityTerritory2AssignmentFilter class

I am trying to write a test class for OpportunityTerritory2AssignmentFilter It implements the TerritoryMgmt.OpportunityTerritory2AssignmentFilter and is a sample class provided by salesforce. Has any ...
0
votes
1answer
352 views

Best practice - should Expenses be tracked in Opportunity Object?

should we use opportunity to track expense related to an account, or create a custom object for tracking expense. I want to know logically which is more appropriate.
0
votes
1answer
37 views

Opportunity button override for lightning experience

I would like to know why 'Lightning experience override' option is not present in Opportunity Clone button override. I could override the New as well as Edit buttons. But in the case of Clone button, ...
0
votes
1answer
1k views

Trying to clone Attachment to new record via trigger Code not working

I'm trying to clone an attachment on an opportunity to a custom case object via a trigger. My code is creating the case but not cloning the attachment. Is there anything I can do to get this to work?...
0
votes
2answers
735 views

Rollup Opportunity fields on Custom object

I have custom object that is between Account and Opportunity. I need it to roll up some of the field from the opportunity, but I can't because the opportunity cannot have another master, and rollups ...
0
votes
2answers
2k views

Opportunity Contact Role is required to create an opportunity

When creating an opportunity as of now opportunity contactrole is not mandatory.System should display error message "Opportunity Contact Role" is required to create an opportunity if system did not ...
0
votes
1answer
2k views

Filter Account Lookup by Record Type to match correlated Opportunity Record Type

Notice: The below question does not address the issue we were trying to solve. The real issue had to do with a Visualforce component (see the update). Jenny B's answer provides good information for ...
0
votes
2answers
1k views

How To Clone Opportunity With Extra Related Custom Objects

Each Opportunity in our Salesforce system may have zero or more related Opportunity Items which are custom objects. The relationship and use of Opportunity and Opportunity Items is like Orders and ...
0
votes
1answer
1k views

Trigger on OpportunityTeamMember has an error

Since there is no out of the box solution to send email notifications to users when they are added/removed from an Opportunity team, I wrote a trigger. So far I have code to handle the addition. This ...