-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
12Questions
-
15Replies
How to identify opportunity is clone (with related)
We have custom apex trigger running on Opportunity Line item. This will generate line item schedule for any given line items matching conditions.
The Clone opportunity with related function also allows to clone opportunity with products and schedule .... so when using this function my trigger kicks in and creates a secundairy schedule which .. will give twice the revenue .... Now I would like to prevent the trigger from firing but then I need to know if the opportunity is created by this function.
So .. is there a way to determine the opp and it's items are created thru this function ...
-
- Jos Vervoorn 2
- September 09, 2020
- Like
- 0
- Continue reading or reply
VF Page with table on custom object with products and prices
I have s custom object containing a Product2 Lookup and several other fields like for example the stock volume. This data is originated from another system.
Based on this custom object I like to show a table (VF) to expose the product name and some other details ... but I would also like to show the price coming from a dedicated Pricebook with entries.
So basically I would like to join the custom object with price book entry filtered on the currency. The join should be done on the mutual product lookup. Can this be done through mapping?
-
- Jos Vervoorn 2
- February 13, 2020
- Like
- 0
- Continue reading or reply
I like to add some fields to the global search file results.
Honestly ... attachments were much more flexible in this.
-
- Jos Vervoorn 2
- July 17, 2019
- Like
- 0
- Continue reading or reply
What is wrong with the query .... within the batch querylocator
-
- Jos Vervoorn 2
- May 30, 2019
- Like
- 0
- Continue reading or reply
Streaming API with replayID which is older than 24h
Currently, we are using jsforce (Node.JS) SDK and if you log the message exchange between server and client we get the error that the provided replayId is invalid and that we should use -2 or -1, the thing is that this error does not throw an exception or notifies the handler in any way.
So from your perspective how should we tackle this problem? From our side we could only work on forking the client project, then we could do these modifications and later make a PR, but it would be much better if something would be done from the server side such as supporting replayIDs older than 24H of age.
Thanks in advance.
-
- Jos Vervoorn 2
- April 25, 2019
- Like
- 0
- Continue reading or reply
Trigger on ContentVersion issue
So a document is added or changed and the picklist value 'Signed Contract' is selected. This would flip the 'HasSignedQuote__c' bollean on true on the opportunity.
However I noticed that the LinkedEntityId from the ContentDocumentLink is not always populated and I can't get my finger behind the root cause.
trigger ContentVersion_TRIGGER on ContentVersion (After insert, After update) { Public static Boolean SignedContract = false; System.debug(LoggingLevel.Info,'[ContentVersion_TRIGGER]. - TRIGGER '); Set<Id> contentDocumentIdSet = new Set<Id>(); for(ContentVersion cv:trigger.new){ if(cv.ContentDocumentId != null){ contentDocumentIdSet.add(cv.ContentDocumentId); If(cv.File_Type__c == 'Signed Contract'){ //** Based on Content version picklist ... System.debug(LoggingLevel.Info,'[ContentVersion_TRIGGER]. - Set SignedContract = true'); SignedContract = true; } } } System.debug(LoggingLevel.Info,'[ContentVersion_TRIGGER].contentDocumentIdSet'+contentDocumentIdSet); ContentDocumentLink cdl = [SELECT ContentDocumentId, LinkedEntityId FROM ContentDocumentLink WHERE ContentDocumentId IN:contentDocumentIdSet Limit 1]; System.debug(LoggingLevel.Info,'[ContentVersion_TRIGGER].ContentDocumentLink :'+cdl.LinkedEntityId); List<Opportunity> OppList = [SELECT Id, HasSignedQuote__c FROM Opportunity where Id =:cdl.LinkedEntityId]; System.debug(LoggingLevel.Info,'[ContentVersion_TRIGGER].OppList.size() :'+OppList.size()); For (Opportunity Opp:OppList){ If (SignedContract == true){ System.debug(LoggingLevel.Info,'[ContentVersion_TRIGGER]. - Flag opportunity HasSignedQuote to true ...'); Opp.HasSignedQuote__c = true; } } Update OppList; } //** end of Class
-
- Jos Vervoorn 2
- February 20, 2019
- Like
- 0
- Continue reading or reply
Sum within loop
I have created to Lists. One of Quotas (Sales targets) and another on Opportunity Line Item schedule.and I'working with a nested loop (forgive me the inefficiency) ....
For (OpportunityLineItemSchedule OppS:LineItemSchedList){ For (ForecastingQuota FQ:MyForeCastquotaList){ If ((FQ.StartDate.Year() == OppS.ScheduleDate.Year()) && (FQ.StartDate.Month() == OppS.ScheduleDate.month()){ LineCounter = LineCounter + 1; System.debug(LoggingLevel.Info,'[******] --------------------------------------------------'); System.debug(LoggingLevel.Info,'[******] Month ..: '+FQ.StartDate.Month()); System.debug(LoggingLevel.Info,'[******] FQ.Currency ..: '+FQ.currencyisocode); System.debug(LoggingLevel.Info,'[******] FQ.QuotaAmount ..: '+FQ.QuotaAmount); System.debug(LoggingLevel.Info,'[******] FQ.Owner ..: '+FQ.quotaOwner.Name); System.debug(LoggingLevel.Info,'[******] Item Revenue ..: '+OppS.Revenue); System.debug(LoggingLevel.Info,'[******] LineCounter ..: '+LineCounter); } } }
So ultimately want to have a sum on OppS.Revenue per month/year ..... but for some reason I'm not getting this to work. Now you may wander why i'm not using aggregate list ... well ... it's simple ... convertCurrency(QuotaAmount) is not allowed on aggregate and on a multi currency I need to make sure all quota's and actuals are in singular (read EUR) currency.
Once I have this I will insert the rows (target/actuals) in a table so I can simply report on this and schedule a job to (auto) populate and refresh the table ...
Any help / direction is much appreciated ....
-
- Jos Vervoorn 2
- January 22, 2019
- Like
- 0
- Continue reading or reply
Regex find is true but I get no results ....on timezone substring ...
String text= 'Australian Central Standard Time ((South Australia) Australia/Adelaide)'; String RegEx = '(\\w+[/]\\w+[/]?\\w+)||GMT'; Pattern regexPattern = Pattern.compile(regex); Matcher mymatcher= regexPattern.matcher(text); If (myMatcher.find()){ system.debug(LoggingLevel.Info,'*** Match ' + myMatcher.group()); }What I expect in the log is Australia/Adelaide. The RegEx seems ok ... https://regexr.com/43hi9
-
- Jos Vervoorn 2
- November 21, 2018
- Like
- 0
- Continue reading or reply
How to adjust the community consent page
Looking for a way to adjust the branding of the community consent page (image below) or how to implement a custom page (if possible). Any kind of support/direction is much appreciated.
This dialog is presented after login to approve/grant access to various types of information from Salesforce. We use Salesforce as the identity provider for another (connected) community.
-
- Jos Vervoorn 2
- September 25, 2018
- Like
- 0
- Continue reading or reply
ERROR: Static method cannot be referenced from a non static context
Static method cannot be referenced from a non static context: void OpportunityLineItemTriggerHandler.AutoScheduleLineItemsAfterUpdate(List<OpportunityLineItem>, Map<Id,OpportunityLineItem>)
Now in test sandbox ... I did not run into this error .. so I'm not sure why in production it fails ...
Trigger code:
OpportunityLineItemTriggerHandler updater = new OpportunityLineItemTriggerHandler();
Apex class code (first x lines ......)
Public void AutoScheduleLineItemsAfterInsert(List<OpportunityLineItem> NewOppLineItems) { System.debug('** * ** #20 AutoScheduleLineItemsAfterInsert'); //** Get prepped by retrieving the base information needed for generating schedule Date currentDate; Decimal NumberOfInstallments; //**Decimal numberPayments; Decimal paymentAmount; Decimal totalPaid; String ItemDescription; NumberOfInstallments = 1; //** Ensure default value for installments even when no value provided. //** Generate lists for bulkify on OpportunityItems etc. set<id> oppid = new set<id>(); List<Id> oppLineIdsList = new List<Id>(); List<OpportunityLineItemSchedule> newScheduleObjects = new List<OpportunityLineItemSchedule>(); //** Assign (new) added ID values to variables for (OpportunityLineItem ol : NewOppLineItems) { oppLineIdsList.add(ol.id); oppid.add(ol.opportunityid); } //** Create (parent) opportunity list so we have required into to retrieve account based product (pricebook) values. list<opportunity> opplist = [select id, AccountID,CurrencyIsoCode from opportunity where id in : oppid ]; for (opportunity opp: opplist) { //** So we have all we need. Account, Opportunity currency and ProductID system.debug('** * ** #44 AccountID: '+opp.AccountID); system.debug('** * ** #45 Opportunity Currency: '+opp.CurrencyIsoCode); //** For every OpportunityLineItem record, add its associated pricebook entry //** to a set so there are no duplicates. Set<Id> pbeIds = new Set<Id>(); //** PriceBookEntryID for (OpportunityLineItem oli : NewOppLineItems) //** pbeIds.add(oli.pricebookentryid); pbeIds.add(oli.id); //** For every OpportunityLineItem record, add its associated oppty //** to a set so there are no duplicates. Set<Id> opptyIds = new Set<Id>(); for (OpportunityLineItem oli : NewOppLineItems) opptyIds.add(oli.OpportunityId);
Thanks in advance.
-
- Jos Vervoorn 2
- November 26, 2017
- Like
- 0
- Continue reading or reply
Parsing error: Unexpected token case
({ StartTiming: function(component, event, helper) { console.log('save:1'); var action = component.get("c.case"); action.setParams({"case": case }); } })Some help to overcome this would be great. Now the controller is not finished but I need to overcome this issue first.
Many thanks on advance.
-
- Jos Vervoorn 2
- September 21, 2017
- Like
- 0
- Continue reading or reply
List controller results by parent (case)
Without this everything works just fine.as a 'related' email list on the case page layout. What do I miss of what is wrong ?
The code of the controller:
public class CaseEmailListController {
public CaseEmailListController(ApexPages.StandardController controller) {
}
private ApexPages.StandardController stdCtrl {get; set;}
public List<Case> Cases {get; set;}
// Sorting on CreatedDate and ToAddress
private String sortOrder = 'CreatedDate';
public void sortByCreatedDate() {
this.sortOrder = 'CreatedDate';
}
public void sortByToAddress() {
this.sortOrder = 'ToAddress';
}
public Case ourCase {get; set;}
public List<EmailMessage> getCaseEmail() {
List<EmailMessage> results = Database.query(
'SELECT CreatedDate, FromAddress,HasAttachment,Id,ParentId,Subject,TextBody,ToAddress ' +
'FROM EmailMessage ' + 'WHERE ParentID=:' + Case.ID +
' ORDER BY ' + sortOrder + ' ASC ' +
'LIMIT 10'
);
return results;
}
}
-
- Jos Vervoorn 2
- March 30, 2017
- Like
- 0
- Continue reading or reply
What is wrong with the query .... within the batch querylocator
- Jos Vervoorn 2
- May 30, 2019
- Like
- 0
- Continue reading or reply
Trigger on ContentVersion issue
So a document is added or changed and the picklist value 'Signed Contract' is selected. This would flip the 'HasSignedQuote__c' bollean on true on the opportunity.
However I noticed that the LinkedEntityId from the ContentDocumentLink is not always populated and I can't get my finger behind the root cause.
trigger ContentVersion_TRIGGER on ContentVersion (After insert, After update) { Public static Boolean SignedContract = false; System.debug(LoggingLevel.Info,'[ContentVersion_TRIGGER]. - TRIGGER '); Set<Id> contentDocumentIdSet = new Set<Id>(); for(ContentVersion cv:trigger.new){ if(cv.ContentDocumentId != null){ contentDocumentIdSet.add(cv.ContentDocumentId); If(cv.File_Type__c == 'Signed Contract'){ //** Based on Content version picklist ... System.debug(LoggingLevel.Info,'[ContentVersion_TRIGGER]. - Set SignedContract = true'); SignedContract = true; } } } System.debug(LoggingLevel.Info,'[ContentVersion_TRIGGER].contentDocumentIdSet'+contentDocumentIdSet); ContentDocumentLink cdl = [SELECT ContentDocumentId, LinkedEntityId FROM ContentDocumentLink WHERE ContentDocumentId IN:contentDocumentIdSet Limit 1]; System.debug(LoggingLevel.Info,'[ContentVersion_TRIGGER].ContentDocumentLink :'+cdl.LinkedEntityId); List<Opportunity> OppList = [SELECT Id, HasSignedQuote__c FROM Opportunity where Id =:cdl.LinkedEntityId]; System.debug(LoggingLevel.Info,'[ContentVersion_TRIGGER].OppList.size() :'+OppList.size()); For (Opportunity Opp:OppList){ If (SignedContract == true){ System.debug(LoggingLevel.Info,'[ContentVersion_TRIGGER]. - Flag opportunity HasSignedQuote to true ...'); Opp.HasSignedQuote__c = true; } } Update OppList; } //** end of Class
- Jos Vervoorn 2
- February 20, 2019
- Like
- 0
- Continue reading or reply
Regex find is true but I get no results ....on timezone substring ...
String text= 'Australian Central Standard Time ((South Australia) Australia/Adelaide)'; String RegEx = '(\\w+[/]\\w+[/]?\\w+)||GMT'; Pattern regexPattern = Pattern.compile(regex); Matcher mymatcher= regexPattern.matcher(text); If (myMatcher.find()){ system.debug(LoggingLevel.Info,'*** Match ' + myMatcher.group()); }What I expect in the log is Australia/Adelaide. The RegEx seems ok ... https://regexr.com/43hi9
- Jos Vervoorn 2
- November 21, 2018
- Like
- 0
- Continue reading or reply
Case field update after milestone processing
To sketch the scenario:
On the case, we would like to have a field to contain the deadline for the active milestone. So when we complete the current milestone ... this custom field get's populated with the deadline.
Now we can do this whenever a field update on the case has been performed ... but it seems that milestone processing takes place after triggers and after process builder. I have seen some samples out there but ... I'm having a hard time to get this working while it sounds so easy.
- milestone is completed / case deadline is populated by next milestone
All help & support is much appreciated.
- Jos Vervoorn
- January 15, 2018
- Like
- 1
- Continue reading or reply
ERROR: Static method cannot be referenced from a non static context
Static method cannot be referenced from a non static context: void OpportunityLineItemTriggerHandler.AutoScheduleLineItemsAfterUpdate(List<OpportunityLineItem>, Map<Id,OpportunityLineItem>)
Now in test sandbox ... I did not run into this error .. so I'm not sure why in production it fails ...
Trigger code:
OpportunityLineItemTriggerHandler updater = new OpportunityLineItemTriggerHandler();
Apex class code (first x lines ......)
Public void AutoScheduleLineItemsAfterInsert(List<OpportunityLineItem> NewOppLineItems) { System.debug('** * ** #20 AutoScheduleLineItemsAfterInsert'); //** Get prepped by retrieving the base information needed for generating schedule Date currentDate; Decimal NumberOfInstallments; //**Decimal numberPayments; Decimal paymentAmount; Decimal totalPaid; String ItemDescription; NumberOfInstallments = 1; //** Ensure default value for installments even when no value provided. //** Generate lists for bulkify on OpportunityItems etc. set<id> oppid = new set<id>(); List<Id> oppLineIdsList = new List<Id>(); List<OpportunityLineItemSchedule> newScheduleObjects = new List<OpportunityLineItemSchedule>(); //** Assign (new) added ID values to variables for (OpportunityLineItem ol : NewOppLineItems) { oppLineIdsList.add(ol.id); oppid.add(ol.opportunityid); } //** Create (parent) opportunity list so we have required into to retrieve account based product (pricebook) values. list<opportunity> opplist = [select id, AccountID,CurrencyIsoCode from opportunity where id in : oppid ]; for (opportunity opp: opplist) { //** So we have all we need. Account, Opportunity currency and ProductID system.debug('** * ** #44 AccountID: '+opp.AccountID); system.debug('** * ** #45 Opportunity Currency: '+opp.CurrencyIsoCode); //** For every OpportunityLineItem record, add its associated pricebook entry //** to a set so there are no duplicates. Set<Id> pbeIds = new Set<Id>(); //** PriceBookEntryID for (OpportunityLineItem oli : NewOppLineItems) //** pbeIds.add(oli.pricebookentryid); pbeIds.add(oli.id); //** For every OpportunityLineItem record, add its associated oppty //** to a set so there are no duplicates. Set<Id> opptyIds = new Set<Id>(); for (OpportunityLineItem oli : NewOppLineItems) opptyIds.add(oli.OpportunityId);
Thanks in advance.
- Jos Vervoorn 2
- November 26, 2017
- Like
- 0
- Continue reading or reply
Parsing error: Unexpected token case
({ StartTiming: function(component, event, helper) { console.log('save:1'); var action = component.get("c.case"); action.setParams({"case": case }); } })Some help to overcome this would be great. Now the controller is not finished but I need to overcome this issue first.
Many thanks on advance.
- Jos Vervoorn 2
- September 21, 2017
- Like
- 0
- Continue reading or reply
List controller results by parent (case)
Without this everything works just fine.as a 'related' email list on the case page layout. What do I miss of what is wrong ?
The code of the controller:
public class CaseEmailListController {
public CaseEmailListController(ApexPages.StandardController controller) {
}
private ApexPages.StandardController stdCtrl {get; set;}
public List<Case> Cases {get; set;}
// Sorting on CreatedDate and ToAddress
private String sortOrder = 'CreatedDate';
public void sortByCreatedDate() {
this.sortOrder = 'CreatedDate';
}
public void sortByToAddress() {
this.sortOrder = 'ToAddress';
}
public Case ourCase {get; set;}
public List<EmailMessage> getCaseEmail() {
List<EmailMessage> results = Database.query(
'SELECT CreatedDate, FromAddress,HasAttachment,Id,ParentId,Subject,TextBody,ToAddress ' +
'FROM EmailMessage ' + 'WHERE ParentID=:' + Case.ID +
' ORDER BY ' + sortOrder + ' ASC ' +
'LIMIT 10'
);
return results;
}
}
- Jos Vervoorn 2
- March 30, 2017
- Like
- 0
- Continue reading or reply
Steps to generate a custom quote/invoice pdf
So I think I need to follow the steps below:
1. Create a custom controller class. Can I do this with standard List controller? Basically, I have to query all the quote and quotelineitems
2. Create a new visual force page using controller from step1, add the proper styling and render as pdf.
3. Create the button on quote with a link to visual force page
Any tips and guides are appreciated.
Thanks.
Did I miss anything?
- Sammy7
- October 17, 2016
- Like
- 0
- Continue reading or reply
Anyone made a Visualforce page of the Send Email page from Tasks?
- SFDC Admin 14
- March 30, 2015
- Like
- 1
- Continue reading or reply
- Dave Farrington
- June 12, 2014
- Like
- 0
- Continue reading or reply