0

So, I been trying to push the source code to the default scratch org which i have created using VS Code but I keep getting this error.

Starting SFDX: Push Source to Default Scratch Org

00:14:34.116 sfdx force:source:push --json --loglevel fatal 00:14:56.553 sfdx force:source:push --json --loglevel fatal ended with exit code 1

=== Push Errors PROJECT PATH >ERRORS
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ─────────────────────────────────────────────────────────────────────────────────────────
e:\Salesforce\Project-Management-Application-Salesforce\force-app\main\default\applications\Project_Management_Application.app-meta.xml >In field: utilityBar - no FlexiPage named Project_Management_Application_UtilityBar found e:\Salesforce\Project-Management-Application-Salesforce\force-app\main\default\triggers\assoContact.trigger >Variable does not exist: Number_of_Opportunities__c (17:18) ```

This is for the first error:

e:\Salesforce\Project-Management-Application-Salesforce\force-app\main\default\applications\Project_Management_Application.app-meta.xml In field: utilityBar - no FlexiPage named Project_Management_Application_UtilityBar found

<CustomApplication xmlns="http://soap.sforce.com/2006/04/metadata">
    <brand>
        <headerColor>#0070D2</headerColor>
        <logo>PMA</logo>
        <logoVersion>1</logoVersion>
        <shouldOverrideOrgTheme>false</shouldOverrideOrgTheme>
    </brand>
    <description>Project Management Application is a great project management software for the project management power user. Teamwork Projects includes all the tools you’ll need to track the development of a project</description>
    <formFactors>Small</formFactors>
    <formFactors>Large</formFactors>
    <isNavAutoTempTabsDisabled>false</isNavAutoTempTabsDisabled>
    <isNavPersonalizationDisabled>false</isNavPersonalizationDisabled>
    <label>Project Management Application</label>
    <navType>Standard</navType>
    <tabs>standard-home</tabs>
    <tabs>Project__c</tabs>
    <tabs>Client__c</tabs>
    <tabs>Releases__c</tabs>
    <tabs>Employee__c</tabs>
    <tabs>Requirement__c</tabs>
    <tabs>Task_Assigned__c</tabs>
    <uiType>Lightning</uiType>
    <utilityBar>Project_Management_Application_UtilityBar</utilityBar>
</CustomApplication>

And for the second one

e:\Salesforce\Project-Management-Application-Salesforce\force-app\main\default\triggers\assoContact.trigger Variable does not exist: Number_of_Opportunities__c (17:18)

{

    if(Trigger.isAfter && Trigger.isInsert)
    {
        List<Contact> ListCon = new List<Contact>();    
        List<Opportunity> ListOpp = new List<Opportunity>();
        for(Account A : Trigger.new)
        {
            Contact C = new Contact();
            C.AccountId = A.Id;
            C.LastName = A.Name;
            C.Phone = A.Phone;
            ListCon.add(C);
            System.debug(C.LastName+'Added to list');
            
            if(A.Number_of_Opportunities__c > 0)
            { 
                for(Integer i=0; i < A.Number_of_Opportunities__c ; i++ )
                {
                    Opportunity opp = new Opportunity();
                    opp.AccountId = A.Id;
                    opp.Name = A.Name+' '+i ;
                    Date d1 = Date.today();
                    opp.CloseDate = d1.addDays(30);
                    opp.StageName='Prospecting';
                    ListOpp.add(opp);                    
                }
             }
            
            if(ListOpp != NULL)
                insert ListOpp;
            
            System.debug('Opportuity List added susccesfuly');
            
            if(ListCon != NULL)
                insert ListCon;
    
            System.debug('Contact List added susccesfuly');
        
            
        }
      
    }
    
}

This are the logs for it:

21:08:36.398 sfdx force:source:push --json --loglevel fatal
21:09:08.890 sfdx force:source:push --json --loglevel fatal
 ended with exit code 1

=== Push Errors
PROJECT PATH                                                                                                                             ERRORS 

Can anyone please help me with it ?

2 Answers 2

0

Two things, please add the code associated to these errors, because of number two: it's telling you in the bottom piece, the two errors and why. I will add them here. Without the code associated, this is difficult to provide an answer.

applications\Project_Management_Application.app-meta.xml > In field: utilityBar - no FlexiPage named Project_Management_Application_UtilityBar found

and

triggers\assoContact.trigger >Variable does not exist: Number_of_Opportunities__c (17:18)
3
  • I had posted the code as the answer please have a look and help me understand. Thank you.
    – Mohit
    Commented Apr 9, 2022 at 15:49
  • @Mohit : Please see the notes under that answer.
    – Moonpie
    Commented Apr 9, 2022 at 15:58
  • The first error is telling you that the is no FlexiPage named what you wrote. Please check the FlexiPages and see if you made a typo. Second, you do not have a variable with that name. If that is a field on the oppo, then you will need to acquire it with a SOQL and then assign it to a var of your choice. @mohit Commented Apr 11, 2022 at 13:36
0

In your project you are missing a flexipage and a field.

  1. Flexipage - Project_Management_Application_UtilityBar
  2. Field - Number_of_Opportunities__c

Without the assoContact.trigger file contents I can not confirm that on which object this field must exist.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .