• Here-n-now
  • NEWBIE
  • 149 Points
  • Member since 2010
  • Principal Developer


  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 3
    Likes Given
  • 8
    Questions
  • 82
    Replies
We hve a requirement to set up single sign-on, which I see requires a MyDomain. What does setting up a MyDomain affect? Apparently this is not covered by standard SFDC support at all. Basically, I'm trying to figure out what all I'll need to run through, test, or change before I can set up a MyDomain in Production without an issue. Thank for any help you have to offer!
The new lightning:listView component in v42  is certainly very convenient - true for any programmtic component that can leverage configuration directly.  I have a question though.  Just as a plain list view, it needs to be manually refreshed to update the records shown.  My question is, any way to do that programatically via JS controller code?  For instance it'd be nice if we can refresh it every 30 seconds when used on a custom Lightning component in the console.

I tried e.force:refreshView but that didn't seem to work.
I'm only really switching myself at this point as a pilot, but just wanna confirm with people who have experience doing so.
1. Is it a per-user switch?
2. They mentioned it was reversible, does anyone know how to reverse it if I don't like the new interface?

Thanks
Background of the issue:
We have just started exploring the option of using OMNI Channel for our service cloud CSR user. I have turned on omni channel settings in my Dev org. I have set up the routing and service channel configurations for omni channel for a custom object. In our org, for contacts we have custom sharing settings (On contact object, we have a restricted flag, if a contact is restricted, then only certain roles can see that contact). On the custom object record, we have a lookup to contact, with OMNI Channel when we assign the custom object record to a Queue, if that custom object record's contact is restricted then that Queue user is not supposed to accept that custom object record.

Question:
When the user clicks "Accept" in OMNI Channel, we wrote a trigger on the custom object record, to control the change of owner, however, OMNI Channel Agent's accept does not fire the trigger on the custom object for which the owner is getting changed.

I would like to undestand, why the trigger on the custom object record does not fire, when the owner is changed from Queue to a User, when the User clicks "Accept" through OMNI Channel.

Is there any way to write trigger on Agentwork object? Please advice..
 
Hi guys,

I'm looking for the best way generate a unique ID string from a record name.

Example:
Account Name: Universal Containers
Account Unique ID: UNI

UNI should be auto-populated, and has to be unique. If UNI is already associated with another record, then it should be UNV/UNC/UNL etc.

This ID only needs to be unique per territory / team. eg., UNI belonging to one territory, say the UK, is still unique from UNI belonging to the US. In this case I can't use the "Unique" checkbox in the formula field. I can probably overcome that by creating another formula field that copies the country code and the unique ID to check for duplicates.

When checking for duplicates, ideally it would follow this logic -

Account Name: Universal Containers
Country on User (Account Owner): UK

The trigger will populate "UKUNI" using
String ownerCountry = {!User.Country};
String accountName = {!Account.Name};

String UID = ownerCountry.substring(0,2) + accountName.substring(0,3);

Now this needs to be checked for being unique, and insert if it is. This is where I'm lost - if the ID is already taken, it should give me the next possible combo, letter 1,2,4 (UNV) or 1,2,5 (UNE) or 1,3,4 and so on.
Once I have this value, I can copy just the 3 letter code without the country code onto another field. This field will also be user editable, so in a sense, the system generated unique ID is a suggestion which the user can accept or override.


What would be the best approach to check for duplicates and generate the unique ID?

Thanks for you help!
I get the following error when trying to use the SF Labs Mass Convert Leads tool:

ConvertLead failed. First exception on row 0; first error: INVALID_STATUS, invalid convertedStatus: Qualified: [Status]

All of the Leads I'm trying to convert contain the Lead Status = "Credentialed" which I added as a "Converted" Lead Status Picklist value . . . so in theory it should work, right?  "Qualified" is also a converted status value.

Thanks for your help!
Code:-

location.replace('/email/author/emailauthor.jsp?retURL=/{!Lead.Id}&p3_lkid={!Lead.Email}&rtype=00Q&p2_lkid={!Lead.Id}&template_id=00XA0000000RfyB&p5=&save=1');

Error:-

The value of the "p3_lkid" parameter 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 resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information. 
Hi,
We have an external SOAP web service.  We have several APEX classes that call that service, and have had this in place for a couple of years. We use the standard WebServiceCallout structure to make those calls, and it works for all standard users; these classes and associated VF pages are part of our managed package.  Essentially, the SF admin drops our VF page on an Opportunity page layout, and the VF page makes the callout to the web service.  We have a new client that uses Communities, and wants to put our VF page on the Opportunity page layout for their Community Partners.  However, when they do this, the callout is never made.  There are no logs in the debug log, and we have checked all of the permissions we can think of.  The callout works for the standard users, but not partners; I've checked, and they're set to call out to the same URL.  Does anybody have any suggestions, either as to how we could troubleshoot this, or what the problem might be?  
Thanks, Jim
I have contacted the support desk (Open - #11703579) as i wanted to make change to my comapny domai. I wiould like to have a customized URL for ymy company login. 

To access salesfore we use https://login.salesforce.com link. I want to customize my like for my company.

I would like to use either one link mentioned below
https://SamsungNetworkSupport.salesforce.com or https://SamsungNetworkSupport.my.salesforce.com

Please provide direction in order to achive above result. 

Prakrut Mehta
 
All,
I need to make my sales summary code more efficient. Once we hit 9,000 trades on a single Account, the system hits the CPU Limit governor limit, even in a batch job. Anybody have any ideas on the code below? Perhaps moving each calculation in the For loop under each  corresponding map? I'm not sure the best way to change this code, but any help would be greatly appreciated.

Debug log shows errors at random at lines 73, 79, or 92 in the Class and every time on line 4 in the trigger.
CPU Time varies on the number of trades inserted at a time, but even at 1 trade I can get up to 25000 out of 10000 (more than double).

Class:
public class Account_RollupTrades {
    public Static Account_Setting__c setting = Account_Setting__c.getInstance();
    public Static boolean inprog = false;

    public static void execute (Set<Id> accountIds, List<Account> accountsList) {
        Map<Id, Account> accounts = new Map<Id, Account> (AccountsList);
        system.debug ('execute');
        if(setting.Disable_RollupTrades__c != true) {
            //Map<Id, Account> accounts = new Map<Id, Account>();
            for(Id accountId:accountIds) {
                system.debug(accountid);
                accounts.put(accountId,
                   new Account(
                       Id=accountId,
                       /**YTD_NIOR_I_Sales__c = 0,         YTD_NIOR_I_Shares__c = 0,         QTD_NIOR_I_Sales__c = 0,         QTD_NIOR_I_Shares__c = 0,
                       MTD_NIOR_I_Sales__c = 0,         MTD_NIOR_I_Shares__c = 0,         PY_NIOR_I_Sales__c = 0,          PY_NIOR_I_Shares__c = 0,
                       Total_NIOR_I_Sales__c = 0,       Total_NIOR_I_Shares__c = 0,       YTD_NS_Income_Sales__c = 0,      YTD_NS_Income_Shares__c = 0,
                       QTD_NS_Income_Sales__c = 0,      QTD_NS_Income_Shares__c = 0,      MTD_NS_Income_Sales__c = 0,      MTD_NS_Income_Shares__c = 0,
                       PY_NS_Income_Sales__c = 0,       PY_NS_Income_Shares__c = 0,       Total_NS_Income_Sales__c = 0,    Total_NS_Income_Shares__c = 0,**/
                       Total_NS_HI_Sales__c = 0,       Total_NS_HI_Shares__c = 0,       YTD_NS_HI_Sales__c = 0,         YTD_NS_HI_Shares__c = 0,
                       QTD_NS_HI_Sales__c = 0,         QTD_NS_HI_Shares__c = 0,         MTD_NS_HI_Sales__c = 0,         MTD_NS_HI_Shares__c = 0,
                       PY_NS_HI_Sales__c = 0,          PY_NS_HI_Shares__c = 0,          Total_NS_Income_II_Sales__c = 0, Total_NS_Income_II_Shares__c = 0,
                       YTD_NS_Income_II_Sales__c = 0,   YTD_NS_Income_II_Shares__c = 0,   QTD_NS_Income_II_Sales__c = 0,   QTD_NS_Income_II_Shares__c = 0,
                       MTD_NS_Income_II_Sales__c = 0,   MTD_NS_Income_II_Shares__c = 0,   PY_NS_Income_II_Sales__c = 0,    PY_NS_Income_II_Shares__c = 0,
                       Rollup_Trades__c = DateTime.now()
                   )
                            );
            }
            Map<String, SObjectField[]>
                ytd = new map<string, sobjectfield[]> {
                    //'3910' => new sobjectfield[] { account.YTD_NIOR_I_Sales__c , account.YTD_NIOR_I_Shares__c},
                    //'3911' => new sobjectfield[] { account.YTD_NS_Income_Sales__c , account.YTD_NS_Income_Shares__c },
                    '3912' => new sobjectfield[] { account.YTD_NS_HI_Sales__c , account.YTD_NS_HI_Shares__c },
                    '3915' => new sobjectfield[] { account.YTD_NS_Income_II_Sales__c , account.YTD_NS_Income_II_Shares__c }    
                },
                qtd = new map<string, sobjectfield[]> {
                    //'3910' => new sobjectfield[] { account.QTD_NIOR_I_Sales__c , account.QTD_NIOR_I_Shares__c},
                    //'3911' => new sobjectfield[] { account.QTD_NS_Income_Sales__c , account.QTD_NS_Income_Shares__c },
                    '3912' => new sobjectfield[] { account.QTD_NS_HI_Sales__c , account.QTD_NS_HI_Shares__c },
                    '3915' => new sobjectfield[] { account.QTD_NS_Income_II_Sales__c , account.QTD_NS_Income_II_Shares__c }
                },
                mtd = new map<string, sobjectfield[]> {
                    //'3910' => new sobjectfield[] { account.MTD_NIOR_I_Sales__c , account.MTD_NIOR_I_Shares__c},
                    //'3911' => new sobjectfield[] { account.MTD_NS_Income_Sales__c , account.MTD_NS_Income_Shares__c },
                    '3912' => new sobjectfield[] { account.MTD_NS_HI_Sales__c , account.MTD_NS_HI_Shares__c },
                    '3915' => new sobjectfield[] { account.MTD_NS_Income_II_Sales__c , account.MTD_NS_Income_II_Shares__c }
                },
                py = new map<string, sobjectfield[]> {
                    //'3910' => new sobjectfield[] { account.PY_NIOR_I_Sales__c , account.PY_NIOR_I_Shares__c},
                    //'3911' => new sobjectfield[] { account.PY_NS_Income_Sales__c , account.PY_NS_Income_Shares__c },
                    '3912' => new sobjectfield[] { account.PY_NS_HI_Sales__c , account.PY_NS_HI_Shares__c },
                    '3915' => new sobjectfield[] { account.PY_NS_Income_II_Sales__c , account.PY_NS_Income_II_Shares__c }
                },
                total = new map<string, sobjectfield[]> {
                    //'3910' => new sobjectfield[] { account.Total_NIOR_I_Sales__c , account.Total_NIOR_I_Shares__c},
                    //'3911' => new sobjectfield[] { account.Total_NS_Income_Sales__c , account.Total_NS_Income_Shares__c },
                    '3912' => new sobjectfield[] { account.Total_NS_HI_Sales__c , account.Total_NS_HI_Shares__c },
                    '3915' => new sobjectfield[] { account.Total_NS_Income_II_Sales__c , account.Total_NS_Income_II_Shares__c }
                };
    
    // We make the select in a "for" so instead of selecting to many records at once hitting the heap size limit the for it will take only 200 records to work with at each iteration.
    for(Trades__c[] tradesList : [select Dollar_Amount_of_the_transaction__c, Fund_Number__c, Number_of_Shares_of_the_transaction__c, Resolved_Firm_Trading_ID__c, Resolved_Firm_Trading_IDs__c, Trade_Date__c from Trades__c where Resolved_Firm_Trading_ID__c in :accountIds and Fund_Number__c in (/**'3910', '3911',**/ '3912', '3915') and Dollar_Amount_of_the_transaction__c != null and Number_of_Shares_of_the_transaction__c != null and Trade_Date__c != null and Dollar_Amount_of_the_transaction__c >= 0 and Number_of_Shares_of_the_transaction__c >= 0 FOR UPDATE]){
        for(trades__c trade: tradesList) {
            
            if(date.today().year() == trade.trade_date__c.year()) {
                accounts.get(trade.Resolved_Firm_Trading_ID__c).put(ytd.get(trade.fund_number__c)[0], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(ytd.get(trade.fund_number__c)[0]))+trade.Dollar_Amount_of_The_Transaction__c);
                accounts.get(trade.Resolved_Firm_Trading_ID__c).put(ytd.get(trade.fund_number__c)[1], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(ytd.get(trade.fund_number__c)[1]))+trade.Number_of_Shares_of_the_transaction__c);
                //system.debug(ytd);
                //system.debug(LoggingLevel.DEBUG, + Limits.getCpuTime() + '/' + Limits.getLimitCpuTime());
                
                //( (date.ValueOf(date.today().month()).divide(3, 0) == date.ValueOf(trade.trade_date__c.month()).divide(3, 0)) )
                if((((date.today().month() - 1) / 3) + 1) == (((trade.Trade_Date__c.month() - 1) / 3) + 1))   {
                    accounts.get(trade.Resolved_Firm_Trading_ID__c).put(qtd.get(trade.fund_number__c)[0], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(qtd.get(trade.fund_number__c)[0]))+trade.Dollar_Amount_of_The_Transaction__c);
                    accounts.get(trade.Resolved_Firm_Trading_ID__c).put(qtd.get(trade.fund_number__c)[1], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(qtd.get(trade.fund_number__c)[1]))+trade.Number_of_Shares_of_the_transaction__c);
                    //system.debug(qtd);
                    //system.debug(LoggingLevel.DEBUG, + Limits.getCpuTime() + '/' + Limits.getLimitCpuTime());
                    
                    if(date.today().month()==trade.trade_date__c.month()) {
                        accounts.get(trade.Resolved_Firm_Trading_ID__c).put(mtd.get(trade.fund_number__c)[0], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(mtd.get(trade.fund_number__c)[0]))+trade.Dollar_Amount_of_The_Transaction__c);
                        accounts.get(trade.Resolved_Firm_Trading_ID__c).put(mtd.get(trade.fund_number__c)[1], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(mtd.get(trade.fund_number__c)[1]))+trade.Number_of_Shares_of_the_transaction__c);
                        //system.debug(mtd);
                        //system.debug(LoggingLevel.DEBUG, + Limits.getCpuTime() + '/' + Limits.getLimitCpuTime());
                    }
                }
            } 
            else if(date.today().year()-1==trade.trade_date__c.year()) {
                accounts.get(trade.Resolved_Firm_Trading_ID__c).put(py.get(trade.fund_number__c)[0], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(py.get(trade.fund_number__c)[0]))+trade.Dollar_Amount_of_The_Transaction__c);
                accounts.get(trade.Resolved_Firm_Trading_ID__c).put(py.get(trade.fund_number__c)[1], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(py.get(trade.fund_number__c)[1]))+trade.Number_of_Shares_of_the_transaction__c);
                //system.debug(py);
                //system.debug(LoggingLevel.DEBUG, + Limits.getCpuTime() + '/' + Limits.getLimitCpuTime());
            }
            accounts.get(trade.Resolved_Firm_Trading_ID__c).put(total.get(trade.fund_number__c)[0], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(total.get(trade.fund_number__c)[0]))+trade.Dollar_Amount_of_The_Transaction__c);
            accounts.get(trade.Resolved_Firm_Trading_ID__c).put(total.get(trade.fund_number__c)[1], ((Decimal)accounts.get(trade.Resolved_Firm_Trading_ID__c).get(total.get(trade.fund_number__c)[1]))+trade.Number_of_Shares_of_the_transaction__c);
            //system.debug(total);
            //system.debug(LoggingLevel.DEBUG, + Limits.getCpuTime() + '/' + Limits.getLimitCpuTime());
        }
            }
        }
        inprog = true;
        update accounts.values();
        inprog = false;
    }
}
Trigger:
trigger Account_RollupTrades on Account (after update) {
    if(Account_RollupTrades.inprog == false) {
        //set<ID> sID = new set<ID> (trigger.newMap.keySet());
        Account_RollupTrades.execute(trigger.newMap.keySet(), trigger.new);
    }
}



 
Since WI15, SFDC allow deploying changes to batch jobs while they are running
We found out today a potential problem this raises:
We added a new field to a batch process. Post deployment, SFDC threw an 'SObject row was retrieved via SOQL without querying the requested field' error.

It seems that as the batch job was running at the same time as the code was deployed, a data subset has been queried using the old code, while the processing batch used the new code

luckily for us we reprocess failed records automatically, so no real issue , but it's something worth considering when releasing batch job changes