• Craig Coates JW
  • 15 Points
  • Member since 2018

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
  • 7
Fellow devs, lend my your ears, or eyes as it may be.

Firstly, apologies if this has already been covered but I couldn't find the same use case. That, or I'm a bit blind.

I have a need to create a custom dashboard for Accounts. Think your old school Classic URL parameter hack to Report filters, but on a much bigger scale and in LEX to boot. Biggest issue to overcome is URL parameters don't work for Dashboard filters so I have a question thusly.

Is it possible to create a Visualforce page which renders as a Dashboard in the Lightning UI which pulls in multiple dashboard charts using dedicated url filters?
If so, suggestions on where to start? I'm reasonably comfortable on building VF for Classic, but custom LEX stuff is still a scary beast.

FYI I've crossposted to r/SalesforceDevelopers and SE so apologies if you see the same question more than once.

Thanks in advance
Good evening SF Hive Mind

I find myself at a loss and in need of guidance.

I have the below invocable class which is fired by a Process in PB. It's in my sandbox on a delay of 2 mins after Email Message creation.

When a single email arrives, it works fine. But if two or more arrive in quick succession, it only fires for the first record and ignores the rest and I cannot figure out why. Are there any restrictions on how many processes can fire at once? Is there anything else why it would ignore the following records?
public class jwOrderAttachmentInvocable {
    public static void jwOrderPDFCloning(List<EmailMessage> emails) {

        Set<String> CaseIds = new Set<String>();
		Set<String> OrdIds = new Set<String>();
        //Set<String> MessageIds = new Set<String>();

        for (EmailMessage email: emails) {


                System.debug('The CaseId is ' + email.ParentId);
            	system.debug('The MessageId is '+email.Id);
            	//system.debug('The MessageIds Set is '+MessageIds);

		if (!CaseIds.isEmpty()) {

                // find the Opportunity to which the Case relates
                Case op = [Select Id, PDF_Order_Number__c from Case where Id in: CaseIds]; {
                    if (op.PDF_Order_Number__c != null) {
                        OrdIds.add(op.PDF_Order_Number__c + '%');
                if (!OrdIds.isEmpty()) {

            Set < String > OrdId = new Set < String > ();
            Order ord = [Select Id From Order Where ERP_Order_Number__c like: OrdIds ORDER BY LastModifiedDate DESC NULLS LAST LIMIT 1]; {
            System.debug('The OrderId is' + ' ' + ord.Id);
            if (!OrdId.isEmpty()) {

                List < Attachment > existing = [Select Id, ParentId, NAme, OwnerId, Body from Attachment where ParentId = :email.Id];
            system.debug('existing.size - ' + existing.size());
                Map < String, Attachment > MapOrderRefToId = new Map < String, Attachment > ();

                for (Attachment att : existing){
                Integer attsize=MapOrderRefToId.size();
                system.debug('The Map size is '+attsize);
                system.debug('MapOrderRefToId keyset = ' + MapOrderRefToId.keySet());
            system.debug('MapOrderRefToId values = ' + MapOrderRefToId.values());
                List < ContentVersion > cvs = new List < ContentVersion > ();
                for (Attachment e: existing) {
                    if (MapOrderRefToId.ContainsKey(e.Id)) {

                        ContentVersion cv = new ContentVersion();
						cv.ContentLocation = 'S';
                        cv.PathOnClient = MapOrderRefToId.get(e.Id).Name;
                        cv.Origin = 'H';
                        cv.OwnerId = MapOrderRefToId.get(e.Id).OwnerId;
                        cv.Title = MapOrderRefToId.get(e.Id).Name;
                        cv.VersionData = MapOrderRefToId.get(e.Id).Body;
                    Database.SaveResult[] cvlist = Database.insert(cvs, false);

                    Set < Id > convsId = new Set < Id > ();

                    for (Database.SaveResult conv: cvlist) {
                        if (conv.IsSuccess()) {
                            System.debug('Successfully inserted Content Version. CV ID: ' + conv.getId());

                        List < ContentVersion > ConVerList = [Select Id, ContentDocumentId from ContentVersion WHERE Id =: convsId];
                        List < ContentDocumentLink > cdList = new List < ContentDocumentLink>();
                    		for (ContentVersion con: ConVerList) {
                        		ContentDocumentLink cd = new ContentDocumentLink();
                        		cd.LinkedEntityId = ord.Id;
                        		cd.ContentDocumentId = [SELECT ContentDocumentId FROM ContentVersion WHERE Id in :ConVerList].ContentDocumentId;
                        		cd.ShareType = 'V';
                        		cd.Visibility = 'AllUsers';
								insert cdList;
            //List < Case > Casestodelete = [Select Id from Case where Id in: CaseIds];
            //delete Casestodelete;

User-added image

In the final approval action of the screen shot I am trying to update a field. 

I choose Add New | Field Update and I hit GO but nothing seems to work. 

Can somene tell me what I'm doing wrong?

Thank you so much. 
We have community on production org.
When the case is raised from support option from community.
The 2 cases getting created in salesforce.
One case with the given details from community and 2nd with the assignment of the newly created case with the subject of new case assignment(EG. Subject - This case is assigned to you) and description with the reference of the newly created case.

In debug logs, We observed that several workflows get fired on case creation in salesforce. So, we have gone through all the workflow rules in org but the field update was the only thing achieved in all workflows.

Also, there are no Process Builders, Apex Triggers, Flows, Queue, Case assignment rules.

Also, I searched for resources on google about this issue, but I was unable to find anything related to this scenario.
Please help me if anyone faced this kind of scenario?
  • August 03, 2018
  • Like
  • 0
Hi all,

I'm trying to create a trigger to generate an autonumber that will only count in specific use cases on Customer Object.
For example, when the client has Active Status and has a project end date.

However, with the code I wrote this giving me an error when I'm trying to update or insert any information to the Customer.
trigger AutonumberOnlyISOnb on JBCXM__CustomerInfo__c (after insert, after update) {
    list<JBCXM__CustomerInfo__c> l= [SELECT Id,Name,IS_Autonumber__c FROM JBCXM__CustomerInfo__c where IS_Autonumber__c !=:null order by IS_Autonumber__c desc limit 1];
    decimal maxacc = l[0].IS_Autonumber__c;
   for(JBCXM__CustomerInfo__c li:trigger.new) {
       if(li.JBCXM__Status__c == 'a0U1a000000H1GiEAK' &&
           li.Onboarding_End_Date__c != null
     li.IS_Autonumber__c = Integer.valueOf(maxacc)+1;
Error:Apex trigger AutonumberOnlyISOnb caused an unexpected exception, contact your administrator: AutonumberOnlyISOnb: execution of AfterUpdate caused by: System.FinalException: Record is read-only: ()
Do you know what could be?

HI There 

Im wondering if someone can help me , ive created a forula but i cant get it to work , wondering if somone can take a look.

IF(ISBLANK( MailingCountry ), "Unknown", 
IF(CONTAINS("Belarus:Bulgaria:Czech Republic:Germany:Hungary:Moldova:Poland:Romania:Russia:Slovakia:Ukraine:Armenia:Azerbaijan:Georgia:Kazakhstan:Estonia:Latvia:Lithuania,") "Eastern Europe", 
IF(CONTAINS(" Andorra:Austria:Belgium:France:Germany:Greece:Ireland:Italy:Liechtenstein:Luxembourg:Malta:Monaco:Netherlands:Norway:Portugal:San Marino:Spain:Sweden:Switzerland:Turkey",) "Western Europe",
IF(CONTAINS("Denmark:Norway:Sweden:Finland:Iceland:Aland Islands;Faroe Islands:Greenland:Svalbard",) "Scandinavia",
IF(CONTAINS("Bahrain:Iraq:Iran:Israel:Jordan:Kuwait:Lebanon:Oman:Palestine:Qatar:Saudi Arabia:Syria:United Arab Emirates:Yemen:UAE",) "Middle East",
IF(CONTAINS("Australia:Fiji:French Polynesia:Guam:Kiribati:Marshall Islands:Micronesia:New Caledonia:New Zealand:Papua New Guinea:Samoa:Solomon:Tonga:Vanuatu",) "Oceania",
IF(CONTAINS("Afganistan:Armenia:Azerbaijan:Bangladesh:Bhutan:Brunei Darussalam:Cambodia:China:Georgia:Hong Kong:India:Indonesia:Japan:Kazakhstan:North Korea:South Korea:Kyrgyzstan:Laos:Macao:Malaysia:Maldives:Mongolia:Myanmar:Nepal:Pakistan:Phillipines:Singapore:Sri Lanka:Taiwan:Tajikistan:Thailand:Timor Leste:Turkmenistan:Uzbekistan:Vietnam:Burma",) "Asia",
IF(CONTAINS("Bermuda:Canada:Greenland:Saint Pierre and Miquelon:United States:USA",) "North America",
IF(CONTAINS("Argentina:Bolivia:Brazil:Chile:Colombia:Ecuador:Falkland Islands:French Guiana:Guyana:Paraguay:Peru:Suriname:Uruguay:Venezuela",) "South America",
IF(CONTAINS("Belize:Costa Rica:El Salvador:Guatemala:Honduras:Mexico:Nicaragua:Panama",) "Central America",
IF(CONTAINS("Anguilla:Antigua and Barbuda:Aruba:Bahamas:Barbados:Bonaire:British Virgin Islands:Cayman Islands:Cuba:Curaçao:Dominica:Dominican Republic:Grenada:Guadeloupe:Haiti:Jamaica:Martinique:Monserrat:Puerto Rico:Saint-Barthélemy:St. Kitts and Nevis:Saint Lucia:Saint Martin:Saint Vincent:Grenadines:Sint Maarten:Trinidad and Tobago:Turks and Caicos Islands:Virgin Islands",) "Carribean",
Tanzania:United Republic of Uganda:Zambia:Zimbabwe:Angola:Cameroon:Central African Republic:Chad:Congo:Equatorial Guinea:Gabon:Sao Tome and Principe:Algeria:Egypt:Libyan Arab:Jamahiriya:Morroco:South Sudan:Sudan:Tunisia:Western Sahara",) "Africa",)))))))))))