• Leanbridge Technologies
  • 9 Points
  • Member since 2019

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 27
I've tried a third time using a brand new Trailhead Playground, and still get the error when checking the challenge:
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: TFJOJLKH

What should I do?

i have written a test class for the trigger, when i try to run the test i get 100% code coverage,i have even disabled the validation rule which is present on the lead object,  but still in the Test results i get the following error

System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Error::::::Divide by 0: [CRM_Owner__c]

how do i resolve this issue
Below is my trigger and Test class
trigger ShareWithCRMOwner on Lead (after insert,after update) {
    List<LeadShare> csShareList = new List<LeadShare>();
    for( Lead cs : trigger.new ) {
        if( cs.CRM_Owner__c != NULL ) {
            // Create a new LeadShare object for each Lead where CRM_Owner__c field is not NULL.
            LeadShare csShare = new LeadShare();
            // Give Read write access to that user for this particular Lead record.
            csShare.LeadAccessLevel = 'edit';
            // Assign Lead Id of Lead record.
            csShare.LeadId = cs.id;
            // Assign user id to grant read write access to this particular Lead record.
            csShare.UserOrGroupId = cs.CRM_Owner__c;
            csShareList.add( csShare );
    if( csShareList != null && csShareList.size() != 0 ) {
        try {
            insert csShareList;
            update csShareList;
                integer k=1/0;
        }catch( Exception e ) {

Test Class
private class TestShareWithCRMOwner {
    // test that newly inserted records marked as pubic=true have corresponding shares created
    static testMethod void testAddShares() {
        Set<ID> ids = new Set<ID>();
        List<Lead> Leads = new List<Lead>();
        for (Integer i=0;i<50;i++)
            Leads.add(new Lead(FirstName='First ',LastName='Name '+i,RecordTypeId='012p0000000Nn05AAC',
        insert Leads;
        // get a set of all new created ids
        for (Lead c : Leads)
        // assert that 50 shares were created
        List<LeadShare> shares = [select id from LeadShare where 
                                  LeadId IN :ids and RowCause = 'Manual'];
    // insert records and switch them from public = true to public = false
    static testMethod void testUpdateContacts() {
        Set<ID> ids = new Set<ID>();
        List<Lead> Leads = new List<Lead>();
        for (Integer i=0;i<50;i++)
            Leads.add(new Lead(FirstName='First ',LastName='Name '+i,RecordTypeId='012p0000000Nn05AAC',
        insert Leads;
        for (Lead c : Leads)
        update Leads;
        // assert that 0 shares exist
        List<LeadShare> shares = [select id from LeadShare where 
                                  LeadId IN :ids and RowCause = 'Manual'];
        for (Lead c : Leads)
        update Leads;
        // assert that 50 shares were created
        shares = [select id from LeadShare where LeadId IN :ids and RowCause = 'Manual'];
        for (Lead c : Leads)
        update Leads;
        // assert that 0 shares exist
        shares = [select id from LeadShare where LeadId IN :ids and RowCause = 'Manual'];

I am using `Platform Events`, to fire a webservice(HTTP request) call post transaction commit, let us say Once Account is Created or Account Updated. In the process of doing so, I am able to create/publish Platform Events from the (Account/any Object) Triggers.

Trigger as PlatformEvent Subscriber:
As a Platform Event subscriber, I have written a Trigger on PlatformEvent. Logic written inside the trigger is not completely working, in other words partially working. In detail, in the logic I have added Debug satements as a first line and my further logic is to query a record and send those details in a webservice(HTTP) and update a record based on the HTTPResponse received. 

In this scenario, debug statement is getting executed but neither query nor webservice call happening. I assume this is because of '`Automated Process`' user do not have enough permissions on Object (to query) or Apex class( to invoke)from Trigger. I believe, we do not have any control on this user or it's profile. Correct me if I am wrong?

Work around I have used: The same logic is written in an Invocable method and used ProcessBuilder as PlatformEvent sbscriber. This is working perfectly.

Query: Is it a known issue that we cannot use Triggers as PlatformEvent subscriber? If not, do we have any approach to change Automated Process user's profile permissions? Please help. Thank you in advance.
I'm currently writing a test class and keep getting "Method does not exist or incorrect signature errors... I'm not certain or confident that I am writing the test class properly...

public class SetEMT {
    ApexPages.StandardController stdCtrl;
    public SetEMT(ApexPages.StandardController controller) {
    List<EmailTemplate> mmts;
    public String mmtid {get; set;}
    public String mmtname {get; set;}
    public String folder {get; set;}
    public List<EmailTemplate> getTemplates() {

        if(mmts == null) mmts = [select name, description from EmailTemplate order by Name];              
        return mmts;
    public void changeTemplates() {
      if(folder != null && !folder.equals('')) mmts = [select name, description from EmailTemplate where FolderId = :folder order by Name];
      else mmts = [select name, description from EmailTemplate order by Name];
    public List<SelectOption> getFolders() {
        List<Folder> folders = [select name, Id from Folder where Type = 'Email' order by name];
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('',''));
        for (Folder f : folders) {
            options.add(new SelectOption(f.Id,f.Name));
        return options;
    public void setTemplate() {
        EAST_Mailing__c mailing = (EAST_Mailing__c)stdCtrl.getRecord();
        mailing.PreApprovedEmailTemplateName__c = mmtname;
        mailing.PreApprovedEmailTemplateLink__c = URL.getSalesforceBaseUrl().toExternalForm() + '/' + mmtid;
        update mailing;

@ istest (SeeAllData=true)
public class SetEMTTest
    private static testmethod void validate(){
        List<EmailTemplate> eList = new List<EmailTemplate>();
        EmailTemplate e = new EmailTemplate (Name = 'Test Template', TemplateType= 'Text');   
        ApexPages.StandardSetController setCtr = new ApexPages.StandardSetController(eList);
        SetEMT.setSelected(new EmailTemplate[]{e});
        MassUpdateSimpleController controller = new MassUpdateSimpleController(SetEMT);
Rapidly works & instantly create corrupt OST files to MBOX file with safely all data of OST files by instantly great technology name of OST to MBOX converter software.

Advance Benefits-

* Convert OST to MBOX
* export corrupt files from OST to MBOX with Outlook
Export Calendar to ICS with Zimbra/Live Exchange/ MSG/EML/EMLX/OLM/NSF/MBOX/ HTML and etc.

* Migrate OST to Office 365 with live Exchange server
* Batch Option- easily select multiple files from OST to Outlook
* split large PST file ( 25GB)
Filter message by "Date"
* Software easily Conversion all items to PST without installing MS Outlook version

More Info-: https://www.kdetools.com/ost/mbox/
User-added image
Hello Salesforce Expertrs 

i am new to the salesforce and i am trying to write test class for the Content document trigger, So when partner user tries a Upload a document through files, automatically he gets email saying that document has been uploaded with the document link, the trigger was successful and with great difficulty i wrote a test class with 100% code coverage, but when i see the test result i see that there is erro "INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY" i have checked in the profile, as well as the OWD settings, still i was not able to resolve this issue, any help will be highly appreciated

User-added image
trigger ContentDocumentTrigger on ContentDocument (after insert) {
    static boolean firstRun = true; 
    if(Trigger.isInsert && Trigger.isAfter){
        for(ContentDocument cd: trigger.new){ 
                    List<user> userlist = [SELECT id,Profile.UserLicense.Name from user WHERE id=:cd.ownerid AND Profile.UserLicense.Name='Partner Community'];
                        List<Partner_Upload_Email_Addresses__mdt> custmeta = [select id,Email_Addresses__c from Partner_Upload_Email_Addresses__mdt];
                        String[] toAddresses = new String[]{};
                            for(Partner_Upload_Email_Addresses__mdt custemailvales: custmeta){
                        Messaging.Singleemailmessage email = new Messaging.Singleemailmessage();
                        email.setSenderDisplayName('Partner Upload File ');
                        //String[] toAddresses = new String[] {'manjuzmail053@gmail.com'};
                            String body = '<html><body>Please note: A new document has been added\n \n ';
                            body += 'File name: '+ cd.title+'\n\n' ;
                            body += 'Created By: '+ cd.createdbyid+ '\n\n';
                            body += 'Created Date: '+ cd.CreatedDate+ '\n\n';
                            body += 'link to file: https://moengage--partnersf.lightning.force.com/lightning/r/ContentDocument/'+cd.id+'/view </body></html>';
                            email.setSubject('A new file is uploaded by your Partner with file name :  '+cd.Title);
                            Messaging.sendEmail(new Messaging.SingleEmailmessage[] {email});
                            firstRun = false;

public class ContentDocumentTestclass {
    public static testmethod void ContentDocumentInsertTest()
        List<user> userlist = [SELECT id,Profile.UserLicense.Name,isactive from user WHERE Profile.UserLicense.Name='Partner Community' AND isactive=true];
        System.runAs(userlist[1]) {
            // The following code runs as user 'u' 
            System.debug('Current User: ' + UserInfo.getUserName());
            System.debug('Current Profile: ' + UserInfo.getProfileId());

            ContentVersion contentVersionInsert = new ContentVersion(
                Title = 'Tes11t',
                PathOnClient = 'Test1.jpg',
                VersionData = Blob.valueOf('Test 11Content Data'),
                IsMajorVersion = true
            insert contentVersionInsert;
            system.debug('User' + UserInfo.getUserName());
            List<ContentDocument> documents = [SELECT Id, Title, LatestPublishedVersionId FROM ContentDocument];

Looking for anyone encountering the same behaviour:
  • Via SFDX I created an Unlocked Package containing a few Flows and Processes
  • After installing the Package into a Partial Copy Sandbox for deployment testing, I cannot access the respective Flows and Processes any more.
  • When I click on them in the Flow or Process Builder, I receive the following error messages:
  • On a Process: "Unfortunately, there was a problem. Please try again. If the problem continues, get in touch with your administrator with the error ID shown here and any other related details. Error ID: 1099551912-258214 (2076307982)"
  • On a Flow: The Flow User-added imageIt reads: This page has an errir. You might just need to refresh it. [sourceElementContainer is not defined. It must be defined.] Failing descriptor:{markup//builder_platform_interaction:canvas]
  • Actions that trigger the flows or processes cause the respective flows to fail.
I have absolutely no idea what could cause this issue and hope for any pointers you guys can give me.

The packages were created using sfdx-cli/7.33.2-045d48473e win32-x64 node-v10.15.3 and "sourceApiVersion": "47.0"


Hi guys,

I created an AutoLaunch flow in my sandbox, along with the Process Builder. It works perfectly in the sandbox but when I deploy it, it doesn't work. 
I have activated both the Flow and the Process Builder.

Anyone any ideas?
Hi All,

Does any one have an idea on how to move code from Azure DevOps branch to Salesforce Sandbox using CI/CD ?

If so please share some details.,

I am using TDTM framework for my projects. I have created a triggerhandler record with my class name configured for delete. When I try deleting a record in synchronous mode it is successful. When I try deleting a record in TDTM framework in Asynchronous mode I am getting below error.

first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, hed.TDTM_CourseEnrollment: execution of AfterDelete caused by: System.NullPointerException: Attempt to de-reference a null object Class.hed.TDTM_TriggerHandler.runAsync: line 162, column 1 Class.hed.TDTM_TriggerHandler.runClass: line 135, column 1 Class.hed.TDTM_TriggerHandler.run: line 75, column 1 Class.hed.TDTM_Global_API.run: line 61, column 1 Trigger.hed.TDTM_CourseEnrollment: line 33, column 1: []

The code base is in

And the error is occuring as in delete it is trying to access newList.

Is there any alternative that I can use after delete in Async mode?
Hi there,

I've got a problem with the assignment of a collection size to a Number variable using the Equals Count standard function: on the Field Service mobile app, the variable becomes a Boolean insted of being a Number (the sandbox i'm working with is running release Summer '19)
Here's the steps:
1) I've created the number:
User-added image
2) Then I assigned a collection size to it:
User-added image
3) Last step, I've printed the value in a screen. The result in the desktop debugger is correct, there are 48 items in the list:
User-added image
But on the Field Service mobile app (the flow is launched as App Extension) the result is the following:
User-added image
Both flow interviews are runned with the same Admin user.
Have you experienced the same issue? If yes, have you found any workarounds without looping the collection adding + 1 to the total count?

Thank you very much for any suggestions.

Does anybody know how to pass variable values to ANT task in Azure Devops?
When look into my task logs, I can see the Pipeline variables been passed, but looks like it's trying to overwrite them with the values I manually entered in the build.properties file.

How to I dynamically pass the value of my Pipeline variables into the build.properties file?
  • August 26, 2019
  • Like
  • 0

Is it possible to run Azure DevOps pipelines using Salesforce DX? Presumably the sfdx cli needs to be installed, but unsure of a starting point.

I've seen a video leveraging ANT scripts, but nothing so far with sfdx.

Hi Experts,

Could you please guide me, How to develop App in salesforce DX with any example.

  • February 21, 2018
  • Like
  • 0
I am using Community as Identity for my Heroku app via OAuth Web Server flow. Standard login works ok.
Now I need to pass a custom parameter to my controller during this Login flow and do not see a way to do this. I try to use URL params but that get removed during redirect of OAuth dance/flow.

My community page is passing parameter if I hit that URL directly. But if I use community URL it does not get this parameter. That seems to be restricted set what can be passed to OAuth as documented here: https://developer.salesforce.com/page/Digging_Deeper_into_OAuth_2.0_on_Force.com

But I want to know if it is possible, anyone has done it to pass any custom parameter from initial request to Controller?
In My example, I need to add parameter <URL>?poi=999 to my OAuth request and get this value in my Login controller.
My current URL format that does not work: https://<COMMUNITY HOST>/services/oauth2/authorize?response_type=code&poi=999&client_id=<MY LONG CLIENT ID>&redirect_uri=http://localhost:8080/authorized&prompt=login consent&display=page
How to get rid of this error?
Can anyone please suggest way to remove this error?!

Thanks inadvance.
I followed the steps necessary for creating a hybrid remote app. But once I build and run the project I am getting error index.html is missing. 

1) forcedroid create 

2) fill in all the remaining things 

3) change bootconfig.json file with connected app value etc . 

4) Cordova prepare 

In bootconfig.json, I replaced remoteAccessConsumerKey with the right value from my developer org. The start page is "/apex/myStartPage", which is just a simple page printing some static text. But when I ran this app in Eclipse, android simulator comes up but with no salesforce login page. Instead it is giving error as "Index.html not found".Can you point out where I possibly missed in the setup? 
Seems to me that the following achomplish the same thing:

List<Account> aa = [SELECT Id, Name FROM Account WHERE Name = 'Acme'];

List<Account> aa = databse.query('SELECT Id, Name FROM Account WHERE Name = 'Acme'');

What are the advantages of using one over the other?