• Marcelo Costa
  • NEWBIE
  • 95 Points
  • Member since 2016

  • Chatter
    Feed
  • 3
    Best Answers
  • 1
    Likes Received
  • 3
    Likes Given
  • 4
    Questions
  • 39
    Replies
I am trying to create a batch Apex class that I can schedule to run weekly to automatically unqualify Leads that are 60 days old or older and haven't had activity on them in the past 10 days (and only for a single Record Type). Here is my Class and Test Class...My assertion keeps failing. It seems 0 of my leads are being updated correctly.

Batch Apex Class:
global class AutoUnqualifyLeads implements Database.Batchable<sObject> {
    
    global Database.QueryLocator start(Database.BatchableContext bc){
        String query = 'SELECT Id, Status, Reason_Not_Qualified__c, LastActivityDate '+
                         'FROM Lead '+
                        'WHERE CreatedDate < LAST_N_DAYS:60 '+
                          'AND Days_Since_Last_Activity__c > 10 '+
                          'AND IsConverted = false '+
                          'AND Status != '+' \'Unqualified\' '+
                          'AND RecordTypeId = '+' \'0121I000000QxE7QAK\' ';
        return Database.getQueryLocator(query);
    }
    
    global void execute(Database.BatchableContext bc, List<Lead> scope){
        List<Lead> leads = new List<Lead>();
        for (Lead l: scope){
                l.Status                  = 'Unqualified';
                l.Reason_Not_Qualified__c = 'No Response';
                system.debug(l);
                leads.add(l);
        }
   update leads;
   }

    global void finish(Database.BatchableContext bc){
        
    }
}

Test Class (my test load data information is listed below the code snippet):
@isTest

private class AutoUnqualifyLeadsTest {
    @isTest
    static void setupTest(){
        List<Lead> leadLoad = Test.loadData(Lead.sObjectType,'testLeadsAutoUnqual');
        System.debug(leadLoad);
        
    }
    
    @isTest
    static void testLeads(){
        
        Test.startTest();
        AutoUnqualifyLeads aul = new AutoUnqualifyLeads();
        Id batchId = Database.executeBatch(aul);
        Test.stopTest();

     System.assertEquals(3, [select count() from Lead where Status='Unqualified']);
    }
 
}
Test data:

CreatedDate, RecordTypeID, Days_Since_Last_Activity__c, Status, Reason_Not_Qualified__c, LastName, Company
2017-10-07T01:40:39, 0121I000000QxE7, 12, Open, Bing, Friends Co.
2017-09-22T01:43:39, 0121I000000QxE7, 13, Contacted, Gellar, Friends Inc.
2014-05-02T02:43:39, 0121I000000QxE7, 4, Open, Green, Friends LLC

Can you please help me troubleshoot??
 
I am super new to Apex and consequently struggling through. I created an Apex class with the intent that I will trigger it with Process Builder. I built a test class for it and I'm getting the error "Method does not exist or incorrect signature: void updateCustomer(Id) from the type CustomerAccountingUpdate.

Here's my Apex Class:
public class CustomerAccountingUpdate {
        
    public static string updateCustomer(Account aAccount) {
    	aAccount.c2g__CODAAccountsReceivableControl__c = System.Label.GeneralLedgerAcctsRec;
        aAccount.c2g__CODASalesTaxStatus__c = 'Taxable';
        aAccount.c2g__CODATaxCode1__c = 'AvaTax';
        aAccount.c2g__CODADaysOffset1__c = 0;
        aAccount.c2g__CODADescription1__c = 'Due Upon Receipt';
       
        update aAccount;
        
        return 'success';
    }
}


And my test Class:
@isTest(SeeAllData=true)
public class CustomerAccountingUpdateTest {
	static private Account setUpTestEnvironment() {          
         Account a =  new Account(
                               Name = 'Test Accounting Test'
                               ,Type = 'Prospect'            				   
                           );
         insert a;
        return a;
    }
    static testMethod void AccountingUpdateTest() {
         Account a = setUpTestEnvironment();
   
         Test.startTest();
         
         CustomerAccountingUpdate.updateCustomer(a.id);
         
         Test.stopTest();
    }
}


Thanks so much - this is the first time I've written a class & test totally from scratch rather than modifying something that was already there so I have no idea where I'm going wrong.
 
Hello,

Admin here so apologies for any inaccurate terminology on my part.

We have an Apex class with a @future tag that has been responsible for creating a scheduled apex class to change the ownership on a newly created record. This process for the most part has worked without a hitch, though recently we had a couple of snags we can't explain.

The first thing that happens is that while the Scheduled Apex class will be listed as "Completed" in the Apex Jobs Queue, that status will then change to "Aborted" the next time that apex class is called for a new record (which will itself be listed as "Completed" until the next job is called). This doesn't appear to affect functionality at all, but it somewhat strange.

The second thing that happens is that, out of the blue, an Apex job a few days ago got stuck at "Queued" for no particular reason and never fired(causing the ownership of the record to stay the same). By all accounts this hasn't happened before, and we have no idea what could have caused it since there wasn't really anything unusual with the record or the system going on at the time (we tried it again with an identical record and it worked perfectly). 

Any idea why this could be happening? We haven't encountered problems like this before and our development company is stumped. I'd be happy to provide Apex Code/Debug Logs if necessary.

Thank you,
Max

Hi everyone.
I have something that never happened with us before, and I wonder if anyone can help me. adding a contract related list to an account object for a specific page layout, ended up showing the contracts related list with 2 columns... have never seen that before and do not know how to fix it.
Anyone knows how to "fix" it (display the fields in a table as per default behavior??)

Related list of Contracts in account related tab.

Hi Everyone,
I have a issue in a customer, where we have 2 portals installed, and 2 different sso solutions at the same time.
Regular salesforce users log in through login.salesforce.com or custom url.
Customers from portal 1 go through IDP 1
Customer from portal 2 o trough IDP 2
Both IDP SSO configs are SP initiated (they have to start on salesforce).
My issue is:
I need a way to avoid going to the login page and actively chose one of the logins methods.
Salesforce generate the login links as follows:

https://my.custom.salesforce.domain/saml/authn-request.jsp?saml_request_id=_2CAAAAVZTcY0mME8wbTAwMDAwMDA0Qzk0AAAAypQs87MjXfKGfnOM29wBsHYId_Alz7ZZxK9jm0Sw2ElCsi4NGRR0OeIj1-asA8CLNDxFCpFjK3Cu4pxu031lK7RQaxwGRPuw4eI9nnPtleFYfR_5_eIXAAE0Dcp7zHjceZXj1q7Ivl5_Prgc0wDl7YmXkt53qOVr8bJ2oAPtR-CMj-_XB_KDi7URAcJnjWDvsseG0z15wSpCwN52nhB9QzWJWwvZTJ0BwYxS9ex4PJHrP8UPSS-pgnBiiG9oPLQp5g&saml_acs=https%3A%2F%2Fmy.custom.salesforce.org%3Fso%3D00Dm0000000CqC7&saml_binding_type=HttpPost&Issuer=https%3A%2F%2F.my.salesforce.com%2F&samlSsoConfig=SSoCOnfigId&RelayState=%2F

Is there a way to programatically chose a connection method or to manually generate the saml_request_id
Anyone has any thoughts on how achieve that without going the IDP initiated SSO???
Cheers
Dears,
I am having a really big problem trying to add pages to a customer community using the napili template when trying to add a menu item of a community page type. When I select the page here is what I get:
User-added image

If I remove the : from objectname and filterId, I can add the Item, but when I try to access the page It transfers me to the error page.
Anyone ever managed to get that working??
Best Regards.
Hey All!
We are facing a issue here trying to use standard svg icons on tabs in console.
We can easily set the icon (default service cloud console case) using:
sforce.console.setTabIcon('/img/icon/t4v35/standard/case_60.png', null, null);
But the thing is that afterwards we should set the other attributes (background color for icon etc..)
Has anyone achieved that?
Best regards!!

 
Hey All!
We are facing a issue here trying to use standard svg icons on tabs in console.
We can easily set the icon (default service cloud console case) using:
sforce.console.setTabIcon('/img/icon/t4v35/standard/case_60.png', null, null);
But the thing is that afterwards we should set the other attributes (background color for icon etc..)
Has anyone achieved that?
Best regards!!

 
I have a change set I'm trying to validate and I get the following error and I don't understand what it means.  There is one custom lookup field in the change set. 

duplicate value found: <unknown> duplicates value on record with id: <unknown>


Thanks in advance for your help!
Following the latest release, the hyperlink functionality we have been using to link agents to the telephony app and to create a new task linked to the lead they are dialling off stopped working.

I have been trying to create a new custom link within the lead layout, but I cannot get it to link to the Lead.  
Here is what I have currently:

https://eu1.salesforce.com/00T/e?Task.Subject=Call&Task.Who={!Lead.Id}&followup=1&tsk5=Call&retURL=%2F{!Lead.Id}&Task.Number_Dialled__c=&{!Lead.MobilePhone}&Task.Call_Source__c=Outbound;

window.open('https://xxxxx.xxxx.net.nz/Dialer/Phone/"&{!Lead.MobilePhone}&"','DiallerWindow','status = 1, height = 500, width = 500, resizable = 1');

When I click the custom link, a new task is created but it is not linked to the lead I came from, and the dialler piece does not work.

Help?!

 
this.SBAAcctLst.add(new SBARelation(0, new Account(RecordTypeId = accRtSBAId,Owner_Fulfillment_Account__c=null, Phone_Type__c='Work',
                                            ShippingStreet=NSBAAcctLst[0].NSBA.ShippingStreet, 
                                            ShippingCity=NSBAAcctLst[0].NSBA.ShippingCity,
                                            ShippingState=NSBAAcctLst[0].NSBA.ShippingState,
                                            ShippingCountry=NSBAAcctLst[0].NSBA.ShippingCountry,
                                            ShippingPostalCode=NSBAAcctLst[0].NSBA.ShippingPostalCode), this));
I am trying to create a Trigger to limit the number of Account a User can own.
Here is my code:
trigger Accounts75Limit on Account (after insert, after update) {

    //List<Account> acc = new List<Account>();
	for(Account acc : trigger.new)
    string accountOwner = accs.OwnerId;

    if (accs.Protected_Accounts__c == true) {
        Integer accounts = [ SELECT COUNT()FROM Account WHERE Account.OwnerId = : accountOwner]; 
        system.debug(accounts);

        if (accounts >3 ) {
            accs.addError('You are your limit of Accounts.');
        }
    }
}

I am getting the following errors:
User-added image

Any ideas?

Thanks!
I am trying to create a batch Apex class that I can schedule to run weekly to automatically unqualify Leads that are 60 days old or older and haven't had activity on them in the past 10 days (and only for a single Record Type). Here is my Class and Test Class...My assertion keeps failing. It seems 0 of my leads are being updated correctly.

Batch Apex Class:
global class AutoUnqualifyLeads implements Database.Batchable<sObject> {
    
    global Database.QueryLocator start(Database.BatchableContext bc){
        String query = 'SELECT Id, Status, Reason_Not_Qualified__c, LastActivityDate '+
                         'FROM Lead '+
                        'WHERE CreatedDate < LAST_N_DAYS:60 '+
                          'AND Days_Since_Last_Activity__c > 10 '+
                          'AND IsConverted = false '+
                          'AND Status != '+' \'Unqualified\' '+
                          'AND RecordTypeId = '+' \'0121I000000QxE7QAK\' ';
        return Database.getQueryLocator(query);
    }
    
    global void execute(Database.BatchableContext bc, List<Lead> scope){
        List<Lead> leads = new List<Lead>();
        for (Lead l: scope){
                l.Status                  = 'Unqualified';
                l.Reason_Not_Qualified__c = 'No Response';
                system.debug(l);
                leads.add(l);
        }
   update leads;
   }

    global void finish(Database.BatchableContext bc){
        
    }
}

Test Class (my test load data information is listed below the code snippet):
@isTest

private class AutoUnqualifyLeadsTest {
    @isTest
    static void setupTest(){
        List<Lead> leadLoad = Test.loadData(Lead.sObjectType,'testLeadsAutoUnqual');
        System.debug(leadLoad);
        
    }
    
    @isTest
    static void testLeads(){
        
        Test.startTest();
        AutoUnqualifyLeads aul = new AutoUnqualifyLeads();
        Id batchId = Database.executeBatch(aul);
        Test.stopTest();

     System.assertEquals(3, [select count() from Lead where Status='Unqualified']);
    }
 
}
Test data:

CreatedDate, RecordTypeID, Days_Since_Last_Activity__c, Status, Reason_Not_Qualified__c, LastName, Company
2017-10-07T01:40:39, 0121I000000QxE7, 12, Open, Bing, Friends Co.
2017-09-22T01:43:39, 0121I000000QxE7, 13, Contacted, Gellar, Friends Inc.
2014-05-02T02:43:39, 0121I000000QxE7, 4, Open, Green, Friends LLC

Can you please help me troubleshoot??
 
Hello,

I'm not sure why the trigger is not triggering the Case assignment rules. I've checked other posts and have tried to requery my list and I'm still unable to get the Case Assignment Rule to work. 
 
public class Case_RunAssignmentRule {

	public static void runCaseAssignmentRules(List<Case> caseList) {

		List<Case> caseToUpdate = new List<Case> ();
		Id caseInboundRecordType = Schema.SObjectType.Case.getRecordTypeInfosByName().get('Inbound Case').getRecordTypeId();

		for (Case c : caseList) {
			if (c.RecordTypeId == caseInboundRecordType) {
				caseToUpdate.add(c);
				System.debug('CaseID --> ' + caseToUpdate);
			}

		}

		if (caseToUpdate.size() > 0) {
			//List<Case> caseToRunAssignment = [SELECT Id, OwnerId FROM Case WHERE Id IN :caseToUpdate];


			Database.DMLOptions dmo = new Database.DMLOptions();
			dmo.assignmentRuleHeader.useDefaultRule = true;
			System.debug('DMO --> ' + dmo);

			for (Case caseL : caseToUpdate) {
				caseL.setOptions(dmo);
				System.debug('caseOwner --> ' + caseL.OwnerId);
				System.debug('caseId --> ' + caseL);
			}

			//insert caseToUpdate;

		}
	}
}
@isTest
public class Case_RunAssignmentRuleTest {

	@testSetup static void setupTest() {
		List<TriggerController__c> tc = new List<TriggerController__c> {
			new TriggerController__c(Name = 'Case', Disabled__c = false)
		};
	}

	static testmethod void newCaseInsert() {
        
		List<Case> newCases = new List<Case> ();
		for (Integer i = 0; i<5; i++) {
			Case c = new Case();
			c.Subject = 'InboundCaseForCAR' + i;
			c.Product__c = 'G2M';
			c.Reason_Category__c = 'Admin Change';
			c.Case_Category__c = 'Contract Services';
			c.Status = 'New';
            c.RecordTypeId = '01213000001ZUeG'; 
			newCases.add(c);
		}

		test.startTest();
		insert(newCases);

		Id currentUserId = UserInfo.getUserId();

		List<Case> returnCaseList = [SELECT Id, OwnerId, Subject FROM Case WHERE Id IN :newCases];
		for (Case c : returnCaseList) {
			System.assertNotEquals(currentUserId, c.OwnerId);
			System.assertEquals(5, returnCaseList.size());
		}
		test.stopTest();
	}
}


 
  • December 07, 2017
  • Like
  • 0
I am a trigger which is firing twice so i am able to see four records instead of two in debug log.

below is my code.I am having a for loop inside a for loop which i am not able to avoid.
Please correct me what is my mistake.

Customplan is a custom object which is created when opportunity stage is chnaged to plan ready.Now i wamt to split amount with plans starting from today,I am having four plans with start date -Oct,Nov,dec,jan 
In this case i should update only dec and jan plan by calcuating amount for them.(dec has 26 days,jan has 31 days) 
 
trigger updateplans on Opportunity (after update) 
{
    List<customplan__c> CPList =new List<customplan__c>();
    List<customplan__c> updatedlist =new List<customplan__c>();
    List<id> oppid =new List<id>();
    Integer noOfMonths,dINM,noOfDays,startMonth; 
    Opportunity Oldopp =new opportunity();
    Date eD,endD,endDate;
    Date startDate,strD;
        
  
    for(opportunity O: trigger.new){
            oppid.add(O.id);
            oldOpp = Trigger.oldMap.get(O.Id);
      }
      
  CPList=[select startdate__c,enddate__c from customplan__c where opportunity__c =: oppid and enddate__c  > today];
  
    for(opportunity op:trigger.new){
       if(Op.stagename=='Plan ready' && oldopp.stagename != Op.stagename && (Op.amount__c !=null && Op.amount__c >0))
       {
           if(Op.End__c != null)
               {
                   noOfMonths = system.today().monthsBetween(op.Base_Project_End__c);    
               }   
           if(noOfMonths != Null & noOfMonths > 0)
               {
               startDate = system.today();
               enddate=op.Start__c;      
               } 
            for(Integer i = 0; noOfMonths >= i; i++){
                if(i > 0)
                {
                endD = endDate;
                startDate = endD.addDays(1);
                }
                strD = startDate;
                dINM = date.daysInMonth(startDate.year(), (i < 0?
                (strD.month()+1):startDate.month()));
                endDate = Date.newInstance(startDate.year(), startDate.month(), dINM);
                eD= (i > 0)?(endDate > Op.End__c?
               Op.End__c:endDate):endDate;  
                noOfDays = startDate.daysBetween(ED)+1;    
                /*** this i am unable to get outside. ****/
                for(customplan__c rp: rplist){
                 rp.PlanAmount__c=Op.amount__c/op.Numberofdays__c*noofdays ;     //op.numberofdays__c is a formula field which calculates op.End__c -Today()+1    (total days present)
                 updatedlist.add(rp);            
                }
            }          
       }
    }   
    Update updatedlist ;  
}
Thank you,
 
Hi MVPs and Salesforce experts,

I have got a complecrequirement here. How can I integrate multiple salesforce orgs(may be 100s) and get the data into a single org? 
Any help is really appreciated.
Here is my code. I can not even save this because the related object is not being located. 
I'm trying to generate a list of related payments for an Opportunity. (not sure if it matters, but our org renamed Opportunities to Income)...what's going on? I keep getting this message: "Error: Invalid field OppPayments for SObject Opportunity"
 
<messaging:emailTemplate 
recipientType="Contact" 
relatedToType="Opportunity"
subject="Payment report for Opportunity: {!relatedTo.name}"
replyTo="n.wylder@ifiusa.org">
    <messaging:htmlEmailBody>
        <html>
            <body>

            <p>Dear {!recipient.name},</p>
            <p>Below is a list of payments related to {!relatedTo.name}.</p>
            <table border="0" >
                <tr>
                    <th>Case Number</th><th>Origin</th>
                    <th>Creator Email</th>
                </tr>
                <apex:repeat var="cx" value="{!relatedTo.OppPayments}">
                <tr>
                    <td><a href = 
                        "https://na77.salesforce.com/{!cx.id}">{!cx.Name}
                    </a></td>
                    <td>{!cx.Designation__c}</td>
                    <td>{!cx.npe01__Payment_Amount__c}</td>
                </tr>
                </apex:repeat> 
            </table>
            <p/>
            <center>
                <apex:outputLink value="http://www.salesforce.com">
                    For more detailed information login to Salesforce.com
                </apex:outputLink>
            </center>
            </body>
        </html>
    </messaging:htmlEmailBody>
</messaging:emailTemplate>

 
We are using Single sign on to login to Salesforce. We'd like to make an API callout from Salesforce to an internal API. To authenticate to access the API, we'd like to use the session token from the single sign-on to send with the HttpRequest so that the service can validate that the request is coming from a reliable user from salesforce. How to get the user session token that the single sign-on provider sends using Apex?

Any guidance would be helpful. Thank you!
 
  • December 06, 2017
  • Like
  • 0
I have a table of date ranges split out by day and month, and I need to determine if a user provided date falls within the range. 
User-added image

I have no years in the table. I was using this logic:
if(qRec.Expected_Start_Date__c >= Date.newInstance(qRec.Expected_Start_Date__c.year(), Integer.valueOf(soqlResults.Start_Month__c), Integer.valueOf(soqlResults.Start_Day__c)) && 
                    qRec.Expected_Start_Date__c <= Date.newInstance(qRec.Expected_Start_Date__c.year(), Integer.valueOf(soqlResults.End_Month__c), Integer.valueOf(solqResults.End_Day__c))){
Which works for the majority of the use cases, until it crosses a year and needs to fall into the 12/25 - 1/24 range. I'd prefer to take year out of the comparison all together, as it is not relevant. Any suggestions appreciated. 
Thanks
 
Hello,

Our SalesForce application is suddendly slow (several minutes to perform a query or an insert) and sometimes fails.

We are getting a lot of periodic failures and slowness executing api calls against salesforce.  
The exception we are getting back is: An unknown repository error occurred

We use a C#/.NET API to call the SalesForce App. The API uses the System.Web.Services.Protocols.SoapHttpClientProtocol (standard Microsoft .NET assembly) to talk to salesforce … 
the XML payload to the SOAP call was generated using a WSDL they generate from Selsforce … it is slow to get a matter and add a dataset (objects defined in our SalesForce application). 
I believe that these operations map to SELECT or INSERT of matter/dataset records in the app database

Please let me know any suggestions on how to find out the root cause of this issue or any additional info I can provide to troubleshoot.

Thanks!
Is there any way to consume a webservice what is currently behind an authenticated proxy server?
I am super new to Apex and consequently struggling through. I created an Apex class with the intent that I will trigger it with Process Builder. I built a test class for it and I'm getting the error "Method does not exist or incorrect signature: void updateCustomer(Id) from the type CustomerAccountingUpdate.

Here's my Apex Class:
public class CustomerAccountingUpdate {
        
    public static string updateCustomer(Account aAccount) {
    	aAccount.c2g__CODAAccountsReceivableControl__c = System.Label.GeneralLedgerAcctsRec;
        aAccount.c2g__CODASalesTaxStatus__c = 'Taxable';
        aAccount.c2g__CODATaxCode1__c = 'AvaTax';
        aAccount.c2g__CODADaysOffset1__c = 0;
        aAccount.c2g__CODADescription1__c = 'Due Upon Receipt';
       
        update aAccount;
        
        return 'success';
    }
}


And my test Class:
@isTest(SeeAllData=true)
public class CustomerAccountingUpdateTest {
	static private Account setUpTestEnvironment() {          
         Account a =  new Account(
                               Name = 'Test Accounting Test'
                               ,Type = 'Prospect'            				   
                           );
         insert a;
        return a;
    }
    static testMethod void AccountingUpdateTest() {
         Account a = setUpTestEnvironment();
   
         Test.startTest();
         
         CustomerAccountingUpdate.updateCustomer(a.id);
         
         Test.stopTest();
    }
}


Thanks so much - this is the first time I've written a class & test totally from scratch rather than modifying something that was already there so I have no idea where I'm going wrong.
 
I need to create a folder in google drive every time I save for the first time a new record of a custom object.
After that i will need to copy a couple of template files in that folder. The files also need to be linked in the new record in salesforce.
Please any directions?? Maybe not only using apex code?

There is an "idea" to disable jobs, but is there a way to mass delete them all using Apex?   Would like to delete the following:

 

Dashboard Refresh

Data Export

Scheduled Apex

Report Run

 

 

 

https://sites.secure.force.com/success/ideaView?id=08730000000HBnU

I have a table of date ranges split out by day and month, and I need to determine if a user provided date falls within the range. 
User-added image

I have no years in the table. I was using this logic:
if(qRec.Expected_Start_Date__c >= Date.newInstance(qRec.Expected_Start_Date__c.year(), Integer.valueOf(soqlResults.Start_Month__c), Integer.valueOf(soqlResults.Start_Day__c)) && 
                    qRec.Expected_Start_Date__c <= Date.newInstance(qRec.Expected_Start_Date__c.year(), Integer.valueOf(soqlResults.End_Month__c), Integer.valueOf(solqResults.End_Day__c))){
Which works for the majority of the use cases, until it crosses a year and needs to fall into the 12/25 - 1/24 range. I'd prefer to take year out of the comparison all together, as it is not relevant. Any suggestions appreciated. 
Thanks
 
I see that we can set Apex unit test with an annotation of @isTest(isParallel=true). That is awesome. However I'm requesting some clarification on its functionality.
  1. What is the default value? (I assume false... but don't like to assume)
  2. If I select a group of tests and indicate to SF that I want those tests to run in parallel, do I have to explicity set that to FALSE inorder to preform specific tests in serial? (or do they all run in parallel because I requested it)
  3. If I select a group of tests and indicate I want them run in serial, if isParallel set to TRUE does it over ride and still run in parallel?
Basically I want to understand the dynamics of isParallel before implementing in a LARGE project, that for years has run in serial. It has some tests that do NOT work in parallel, however we want to get the best possible performance out of the tests that can. So our HOPE is that we can tell Salesforce to run all tests in parallel, except the few that cannot, and run those in serial.  Is this the right feature to enable or set this.

Thanks in advance.

 

Simply put the following formula into a formula field of type "Text":

 

Id
& MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",(
    IF(FIND(MID(Id,1,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0)
    +IF(FIND(MID(Id,2,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0)
    +IF(FIND(MID(Id,3,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0)
    +IF(FIND(MID(Id,4,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0)
    +IF(FIND(MID(Id,5,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0)
    )+1,1)
& MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",(
    IF(FIND(MID(Id,6,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0)
    +IF(FIND(MID(Id,7,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0)
    +IF(FIND(MID(Id,8,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0)
    +IF(FIND(MID(Id,9,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0)
    +IF(FIND(MID(Id,10,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0)
    )+1,1)
& MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",(
    IF(FIND(MID(Id,11,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0)
    +IF(FIND(MID(Id,12,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0)
    +IF(FIND(MID(Id,13,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0)
    +IF(FIND(MID(Id,14,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0)
    +IF(FIND(MID(Id,15,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0)
    )+1,1)

 

This is an optimized version of the code example "BPS: 18 digit external ID within the UI" you can find on the Online Help, but unlike the example provided there, it is small enough to fit into a formula field. Also, this code doesn't contain the error found in the online help example, where the second character byte equivalent of the first 5-character chunk was "4" instead of "2". I'd be more than happy if someone could come up with an even shorter version of this formula...Still, I hope you can use this.

 

Cheers,

Erik Mittmeyer