• About Me
  • NEWBIE
  • 35 Points
  • Member since 2019

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 3
    Likes Given
  • 2
    Questions
  • 7
    Replies
Hi Developers!
I need help please! I have deployed a change set to production and it is failing on multiple apex tests. I looked at some of the classes that failed and they are not working/old and obsolete. I don't know how to deactivate them or modify to make them work so that the failures clear up. Also, it seems that I have a lot of exception errors since I created more complex process builders. Could this be the cause of the failures? I am the SF Admin and the only SF person here, so my resources are limited and all help is appreciated!
User-added image
Hello,
 Trying to display sObjects and the fields of the sObject selected on vf page and in the process stuck with the error 'Collection size 1,133 exceeds maximum size of 1,000.'  Any suggestions or code sample would be greatly appreciated, thank you.
I have tried creating list of lists but no use.
Tried creating a Map to return the object names but not succesfull in doing so.
And no I cannot set read only attribute ='true' as I have a DML operation to be performed.
<apex:page controller="searchAndDelCntrl" readOnly="false" lightningStylesheets="true">
  
 
   <apex:form id="formblock" >
      <apex:pageBlock id="block">
      <apex:pageMessages escape="false"/>
         <apex:pageBlockSection >
            <apex:pageBlockSectionItem >               
                <apex:panelGrid columns="10" id="theGrid">
                  <apex:outputLabel for="ObjectName" >Object:&nbsp;</apex:outputLabel>                  
                  
                    <apex:SelectList id="ObjectPicklist"  value="{!selectedDataObject }" size="1"
                                   onchange="DataFeedAction()"> 
                              <apex:selectOptions value="{!ObjectOption}" />
                              <apex:actionFunction name="DataFeedAction"  status="waitingStatus" reRender="block"/> 
                </apex:SelectList>    

                <apex:outputLabel for="ColumnName">Field: </apex:outputLabel>
                 <apex:selectList id="ObjectFieldPicklist" value="{!selectedFieldName}" multiselect="true" size="5" >                                        
                                        <apex:selectOptions value="{!FieldOptions }" />                                     
                                       </apex:selectList>
                
                  <apex:commandButton value="Search" action="{!doSearch}"   
                                      
                                      rerender="block" status="status"/>
               </apex:panelGrid>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        <apex:actionStatus id="status" startText="requesting..."/>
        
      </apex:pageBlock>
   </apex:form>
   
 <script>
  

 function MyjavaFunction(ReceiveObjectID,ReceiveFieldID ){
 //onclick="if(MyjavaFunction('{!$Component.ObjectPicklist}','{!$Component.ObjectFieldPicklist}')) {return};"
 //onclick="if(!MyjavaFunction('{!$Component.ObjectPicklist}','{!$Component.ObjectFieldPicklist}')) {return};"
// onclick="if(!MyjavaFunction('{!$Component.ObjectPicklist}','{!$Component.ObjectFieldPicklist}')) {return};"
        
        var inputValue = document.getElementById(ReceiveObjectID).value;            
     
         if(inputValue == '0'){
            alert('Please select any item from object.');
            return false;
            }
         else
         {          
             var inputFieldValue = document.getElementById(ReceiveFieldID).value;
             // alert(document.getElementById(ReceiveFieldID).value);
             if(inputFieldValue== '0' || inputFieldValue=='' ){
                   alert('Please select any item from field picklist.');
                   return false;             
             }
             
           } 
           
   }   
 </script>
 
 
</apex:page>
Controller--------->
public with sharing class SearchFieldControllerNew {
    
    // variables and properties
    String strUserID ;
    public Map <String, Schema.SObjectType>  schemaMap = Schema.getGlobalDescribe();
    public List<SelectOption> objectNames{get;set;}
    public String selectedDataObject { get; set; }
    public String selectedFieldName{ get; set; }
  
    /*
    List<ReportFieldsUsed__c> results; 
    public List<ReportFieldsUsed__c> getResults() {
        return results;
    }  
    */
    
    public SearchFieldControllerNew(){
        objectNames  = initObjNames();
    }
    
    public List<SelectOption> initObjNames(){
        List<SelectOption> objNames = new List<SelectOption>(); 
        List<String> entities = new List<String>(schemaMap.keySet());
        entities.sort();
        
        for(String objName : entities){
            if (!objName.contains('__share') && !objName.contains('__tag') && !objName.contains('__history') && !objName.contains('__feed'))
            {
                objNames.add(new SelectOption(schemaMap.get(objName).getDescribe().getName(),schemaMap.get(objName).getDescribe().getName()));
            }
        }
        return objNames;
    }
    
    // Search filed depending upon object selected from above
    public List<selectOption> FieldOptions {
        get{
            try
            {
                System.Debug('pkp : ' + selectedDataObject);
                List<SelectOption> FieldOption = new List<SelectOption>();
                //FieldOption.add(new SelectOption('0','--None--')); 
                //FieldOption.add(new SelectOption('0','--None--')); 
                
                Schema.sObjectType objectType = Schema.getGlobalDescribe().get(selectedDataObject);  // for example
                Map<String, Schema.sObjectField> fieldMap = objectType.getDescribe().fields.getMap();
                for (String fieldName : fieldMap.keySet()) {
                    //System.debug('DJR >> ' + fieldName + ' (' + fieldMap.get(fieldName).getDescribe().getName() + ') ' + fieldMap.get(fieldName).getDescribe().getName());
                    FieldOption.add(new SelectOption(fieldMap.get(fieldName).getDescribe().getName(),fieldMap.get(fieldName).getDescribe().getName()));
                    
                }
                FieldOption.sort();
                return FieldOption;
            }   
            catch(Exception e)
            {
                System.Debug(' Exception : '+ e.getMessage());
                return  null;  
            }  
        } 
        set;
    }

    // Method Dosearch is called on click of the button and passed three parameters to the batch class.
    public PageReference doSearch() {
        
        System.Debug('pkp selected object API :' +selectedDataObject);
        System.Debug('pkp selected field  :' +selectedFieldName);
        try{
            // server side validation 
            if(selectedDataObject == '0' || selectedFieldName=='[]')
            {
                if(selectedDataObject == '0')
                {
                    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Please select any item from Object Picklist.'));
                    return null;
                }
                if(selectedFieldName=='[]')
                {
                    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Please select any item from Field Picklist.'));
                    return null;
                }            
                
            }
            else
            {
                
                System.Debug('pkp : ' + selectedDataObject); 
                strUserID =UserInfo.getUserId(); 
                List<ReportFieldsUsed__c> fldids = new list<ReportFieldsUsed__c>();
                
                //List<ReportFieldsUsed__c> existing = [SELECT Id From ReportFieldsUsed__c where userid__c =:strUserID];
                
                for(ReportFieldsUsed__c f:[SELECT Id From ReportFieldsUsed__c where userid__c =:strUserID])
                {
                    ReportFieldsUsed__c rpf = new ReportFieldsUsed__c();
                    rpf.Id = f.Id;
                    fldids.add(rpf);
                }
                
                delete fldids;         
                //System.Debug('pkp selected object API :' +selectedDataObject);
                //System.Debug('pkp selected field  :' +selectedFieldName);
                //System.Debug('pkp current user  :' +strUserID);
                SearchReportFieldBatchNew obj = new SearchReportFieldBatchNew(selectedDataObject,selectedFieldName,strUserID);
                if(!Test.isRunningTest()) Database.executeBatch(obj,1);   
            }
            
        }catch(Exception ae){}
        return null;
    }
    
}


 
Hi All, I have a scenario where ParentObject Field A needs to be updated based on the ChildObject Start and End Dates. Difference between the start date and End dates are to be calculated and displayed on the Field A(parent object field)
Scenario 1) After Update trigger: Trigger should update ParentObject Field A when ChildObject Start and End dates arent Blank which does not with the code I have below. 
Scenario 2) Batch Process to update the same field (FieldA of parent object)when my ChildObject Start is not blank and End date is Blank(different between the start date and date.today)
In my code, I am setting the field values to zero every time I run the batch and Trigger, so losing the old values which I do not want instead I want the new value appended to the old value. If I comment on the logic of making the field zero from Batch class then when I run the batch multiple times the value is doubling instead should only consider if the date. today is changed. Not sure how to handle this scenario
//batchProcess
global class  UpdateBatch implements Database.Batchable<sObject>, schedulable {
   
   global Id id_AgreementCustom = null; 
    List<ParentObj> aGCList = new List<ParentObj>();
    
    //parametrized constructor for passing specific record to process
    global UpdateBatch(Id agcuId){
        System.debug('@Developer --> UpdateBatch -->:' + agcuId);
        id_AgreementCustom = agcuId;
    }
    
    //parametrized constructor
    global UpdateBatch() {
    }
    global Database.QueryLocator start(Database.BatchableContext bc) {
         System.debug('@Developer --> DepartmentReviewUpdateBatch -->:' + id_AgreementCustom);
        String sSOQL = 'Select Id, Name,FieldA, ';
        sSOQL += ' (Select id,name,Value,, ';
        sSOQL += ' startdate ';
        sSOQL += ' From Parent.ChildRelation__r ';
        sSOQL += ' Where enddate = NULL ) ';
        sSOQL += '  ';
        sSOQL += ' From ParentObj ';
        
        if(id_AgreementCustom != null){
            sSOQL += ' Where  Id =\'' + id_AgreementCustom + '\'';    
        }
        if (test.isRunningTest()){
            sSOQL += ' limit 5 ';
        }
        return Database.getQueryLocator(sSOQL);
    }  
    global void execute(Database.BatchableContext bc, List<ParentObj> scope) {
        for(ParentObj aGC : scope){
          //  FieldA          = 0;
            for(ChidlObj dR : Parent.ChildRelation__r){
                
				BusinessDaysUtilityClass bDays= new BusinessDaysUtilityClass();
             
  			 datetime startDate = ChildObj.StartDate;
                datetime endDate   = date.today(); 
          
                Integer updateWorkingDays = bDays.getNoOfBusinessDaysBetweenDates(startDate.date(), endDate.date());
                
				if(startdate !=NULL){   
                    if(value == 'Salesforce'){
                    
                             FieldA += updateWorkingDays;                  
                    }     
            }
            aGCList.add(aGC);    
        }
        Map<Id, parentObj> aGMapToUpdate = new Map<Id,parentObj>();
        aGMapToUpdate.putAll(aGCList);
        if(aGMapToUpdate.size()>0){    
            update  aGMapToUpdate.values();  
        }       
    }
    global void execute(SchedulableContext sc) {}
    global void finish(Database.BatchableContext bc) { }
}

//triggerHandler
public class TriggerHandler {  
    public static void DaysCalculation(list<ChildObj> dRList){     
        Set<Id> ctoIDS = new Set<Id>();
        List<ParentObj> aGCList = new List<ParentObj>();    
        for(ChildObj dr : dRList){
            ctoIDS.add(dr.Parent__c);
        }
        for(ParentOBj aGC : [select id, name,FieldA(select id,name,Value,StartDate,EndDate
                                                                           from Child__r) from ParentA where Id =:ctoIDS]){
                                                                               
                                                                            FieldA         = 0;
                                                                               for(ChildObj d : aGC.Child__r){
                                                                                   BusinessDaysUtilityClass bDays= new BusinessDaysUtilityClass();
                                                                                   datetime startDate = cObj.startdate;
                                                                                   datetime endDate   = cObj.enddate;
                                                                                   system.debug('@developer-->startDate'+startDate);
                                                                                   system.debug('@developer-->endDate'+endDate);
                                                                                   
                                                                                   if(startdate != NULL && enddate != NULL){
                                                                                       Integer updateWorkingDays = bDays.getNoOfBusinessDaysBetweenDates(startDate.date(), endDate.date());
                                                                                       sy
                                                                                       if(Value == 'Salesforce'){                                               
                                                                                           FieldA += updateWorkingDays;               
                                                                                       }     
                                                                               }
                                                                               aGCList.add(aGC);
                                                                           }
        Map<Id, ParentObj> aGMapToUpdate = new Map<Id,ParentObj>();
        aGMapToUpdate.putAll(aGCList);
        if(aGMapToUpdate.size()>0){    
            update  aGMapToUpdate.values();  
        }         
}

as the same parentObj Field A is updating via 2 processes and every time a process updates the field A values should be added instead of doubling or losing the old value.The code snippet below. 
Hi All,
 
I'm working on a requirement where I want a button that will open a modal to create a new Task record in LWC. For this, I tried using NavigationMixin. But on click of Save in the modal, it redirects to the newly created record page instead of closing the modal. Is there any way to skip the navigation to the newly created record and close the modal only.
Below is the code of NavigationMixin that I'm using:
this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Task', actionName: 'new' } });
 
Thanks in advance.
 
#LightningFramework #lightningwebcomponents  #LWC  #Navigationmixin
This code is working fine but if i changed -91 to -90 r -92 then also one opportunity is creating can any one please fix this
    public static void insertOpportunity(list<OrderApi__Subscription__c> sub){
        
        set<id> ids = new set<id>();
        
        for(OrderApi__Subscription__c o : sub){
        
            ids.add(o.id);
        
        }
        
        
        list<Opportunity> op = new list<Opportunity>();

        for(OrderApi__Subscription__c o : [select id,OrderApi__Subscription_Plan__c,OrderApi__Days_To_Lapse__c,OrderApi__Contact__c,OrderApi__Contact__r.name,OrderApi__Item__c,OrderApi__Account__c from OrderApi__Subscription__c where id in : ids and (OrderApi__Item_Class__r.name='Silver Leader Membership' or OrderApi__Item_Class__r.name='Council Membership')]){
            
            if(o.OrderApi__Days_To_Lapse__c==-91){
                
                Opportunity opp = new Opportunity(Name=o.OrderApi__Contact__r.name,AccountId=o.OrderApi__Account__c,ContactId=o.OrderApi__Contact__c,StageName='Qualified',Type='Existing Business',CloseDate=system.today()+365,Probability=10);
                op.add(opp);
            }
        }
        
        if(op.size()>0){
        
            insert op;
        }
    }
===================================
if -91 hits i need to insert opportunity this one is working fine, if i updated -91 to any other number then also opportunity is creating please help me on this bug.
here is my class:-
public class CloneXmittal {
public ID transmittalid = ApexPages.currentPage().getParameters().get('transmittalid');
public ID ClonedTXid;
  public CloneXmittal(){}
  public void CloneXmittal1(){
        Transmittal__c TXOriginal = [Select id, Name,Addcontact__c,Bid_Due_Date__c,Change_Update_Sent__c,Contacts__c,Delivery_Method__c,Emaillist__c,FTP_Link__c,Opportunity__c,Requested_By__c,RFP_Sent_to_Vendor__c,Rownumber__c,Sales_Admin_Instructions__c,Structural_Fab_Misc_Vendor__c,Transmittal_Request_Date__c,Vendor_Instructions__c,Vendor_Proposal_Deadline__c,Vendor_Type__c from Transmittal__c where id =: transmittalid ];
        Transmittal__c TX = new Transmittal__c(
                                Addcontact__c=TXOriginal.Addcontact__c,
                                Contacts__c=TXOriginal.Contacts__c,
                         Delivery_Method__c=TXOriginal.Delivery_Method__c,
                                Emaillist__c=TXOriginal.Emaillist__c,
                                FTP_Link__c=TXOriginal.FTP_Link__c,
                                Opportunity__c=TXOriginal.Opportunity__c,
                                Requested_By__c=TXOriginal.Requested_By__c,
                                Rownumber__c=TXOriginal.Rownumber__c,                     Structural_Fab_Misc_Vendor__c=TXOriginal.Structural_Fab_Misc_Vendor__c,

 Vendor_Type__c=TXOriginal.Vendor_Type__c
                                );
                                insert TX;
                                ClonedTXid = TX.id;
        List<StructuralFab_Vendors__c> SFABLIST= new List<StructuralFab_Vendors__c>([Select ContactList__c, Transmittal__c, Account__c from StructuralFab_Vendors__c where Transmittal__c =:transmittalid  ]);
        List<StructuralFab_Vendors__c> SFABCLONE= new List<StructuralFab_Vendors__c>();
        for(StructuralFab_Vendors__c SFAB: SFABLIST){
             StructuralFab_Vendors__c SFABCOPY = SFAB.clone(false,true,false);
             SFABCOPY.Transmittal__c = TX.id;
            SFABCLONE.add(SFABCOPY );       
        }
        insert SFABCLONE;
        CloneXmittalDML();
}
public pagereference CloneXmittalDML(){
 PageReference home = new PageReference('/' + ClonedTXid );
        home.setRedirect(true);
return home;
}
}

test class:-

@isTest
public class CloneXmittalTest {
    
    static testMethod void test1(){
       Transmittal__c tr = new Transmittal__c();
        tr.Addcontact__c=false;
        tr.Delivery_Method__c='Email / Web';
        insert tr; 
        
        List<StructuralFab_Vendors__c> SFABCLONE= new List<StructuralFab_Vendors__c>();
        SFABCLONE[0].Transmittal__c = tr.Id;
        
        insert SFABCLONE;

        CloneXmittal cx = new CloneXmittal();
        cx.CloneXmittal1();
       
    }
}
Hi, 
I have a test class for Salesforce trigger.
I have 100% coverage without any test.startTest();  test.stopTest().
Should i write them to? 
If I have 100% coverage => my test class is good? 
So I don't need to write any positive, negative tests? 
If I have negative and postive tests, how can I check results?
Thank you. 
Hello,
 Trying to display sObjects and the fields of the sObject selected on vf page and in the process stuck with the error 'Collection size 1,133 exceeds maximum size of 1,000.'  Any suggestions or code sample would be greatly appreciated, thank you.
I have tried creating list of lists but no use.
Tried creating a Map to return the object names but not succesfull in doing so.
And no I cannot set read only attribute ='true' as I have a DML operation to be performed.
<apex:page controller="searchAndDelCntrl" readOnly="false" lightningStylesheets="true">
  
 
   <apex:form id="formblock" >
      <apex:pageBlock id="block">
      <apex:pageMessages escape="false"/>
         <apex:pageBlockSection >
            <apex:pageBlockSectionItem >               
                <apex:panelGrid columns="10" id="theGrid">
                  <apex:outputLabel for="ObjectName" >Object:&nbsp;</apex:outputLabel>                  
                  
                    <apex:SelectList id="ObjectPicklist"  value="{!selectedDataObject }" size="1"
                                   onchange="DataFeedAction()"> 
                              <apex:selectOptions value="{!ObjectOption}" />
                              <apex:actionFunction name="DataFeedAction"  status="waitingStatus" reRender="block"/> 
                </apex:SelectList>    

                <apex:outputLabel for="ColumnName">Field: </apex:outputLabel>
                 <apex:selectList id="ObjectFieldPicklist" value="{!selectedFieldName}" multiselect="true" size="5" >                                        
                                        <apex:selectOptions value="{!FieldOptions }" />                                     
                                       </apex:selectList>
                
                  <apex:commandButton value="Search" action="{!doSearch}"   
                                      
                                      rerender="block" status="status"/>
               </apex:panelGrid>
            </apex:pageBlockSectionItem>
        </apex:pageBlockSection>
        <apex:actionStatus id="status" startText="requesting..."/>
        
      </apex:pageBlock>
   </apex:form>
   
 <script>
  

 function MyjavaFunction(ReceiveObjectID,ReceiveFieldID ){
 //onclick="if(MyjavaFunction('{!$Component.ObjectPicklist}','{!$Component.ObjectFieldPicklist}')) {return};"
 //onclick="if(!MyjavaFunction('{!$Component.ObjectPicklist}','{!$Component.ObjectFieldPicklist}')) {return};"
// onclick="if(!MyjavaFunction('{!$Component.ObjectPicklist}','{!$Component.ObjectFieldPicklist}')) {return};"
        
        var inputValue = document.getElementById(ReceiveObjectID).value;            
     
         if(inputValue == '0'){
            alert('Please select any item from object.');
            return false;
            }
         else
         {          
             var inputFieldValue = document.getElementById(ReceiveFieldID).value;
             // alert(document.getElementById(ReceiveFieldID).value);
             if(inputFieldValue== '0' || inputFieldValue=='' ){
                   alert('Please select any item from field picklist.');
                   return false;             
             }
             
           } 
           
   }   
 </script>
 
 
</apex:page>
Controller--------->
public with sharing class SearchFieldControllerNew {
    
    // variables and properties
    String strUserID ;
    public Map <String, Schema.SObjectType>  schemaMap = Schema.getGlobalDescribe();
    public List<SelectOption> objectNames{get;set;}
    public String selectedDataObject { get; set; }
    public String selectedFieldName{ get; set; }
  
    /*
    List<ReportFieldsUsed__c> results; 
    public List<ReportFieldsUsed__c> getResults() {
        return results;
    }  
    */
    
    public SearchFieldControllerNew(){
        objectNames  = initObjNames();
    }
    
    public List<SelectOption> initObjNames(){
        List<SelectOption> objNames = new List<SelectOption>(); 
        List<String> entities = new List<String>(schemaMap.keySet());
        entities.sort();
        
        for(String objName : entities){
            if (!objName.contains('__share') && !objName.contains('__tag') && !objName.contains('__history') && !objName.contains('__feed'))
            {
                objNames.add(new SelectOption(schemaMap.get(objName).getDescribe().getName(),schemaMap.get(objName).getDescribe().getName()));
            }
        }
        return objNames;
    }
    
    // Search filed depending upon object selected from above
    public List<selectOption> FieldOptions {
        get{
            try
            {
                System.Debug('pkp : ' + selectedDataObject);
                List<SelectOption> FieldOption = new List<SelectOption>();
                //FieldOption.add(new SelectOption('0','--None--')); 
                //FieldOption.add(new SelectOption('0','--None--')); 
                
                Schema.sObjectType objectType = Schema.getGlobalDescribe().get(selectedDataObject);  // for example
                Map<String, Schema.sObjectField> fieldMap = objectType.getDescribe().fields.getMap();
                for (String fieldName : fieldMap.keySet()) {
                    //System.debug('DJR >> ' + fieldName + ' (' + fieldMap.get(fieldName).getDescribe().getName() + ') ' + fieldMap.get(fieldName).getDescribe().getName());
                    FieldOption.add(new SelectOption(fieldMap.get(fieldName).getDescribe().getName(),fieldMap.get(fieldName).getDescribe().getName()));
                    
                }
                FieldOption.sort();
                return FieldOption;
            }   
            catch(Exception e)
            {
                System.Debug(' Exception : '+ e.getMessage());
                return  null;  
            }  
        } 
        set;
    }

    // Method Dosearch is called on click of the button and passed three parameters to the batch class.
    public PageReference doSearch() {
        
        System.Debug('pkp selected object API :' +selectedDataObject);
        System.Debug('pkp selected field  :' +selectedFieldName);
        try{
            // server side validation 
            if(selectedDataObject == '0' || selectedFieldName=='[]')
            {
                if(selectedDataObject == '0')
                {
                    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Please select any item from Object Picklist.'));
                    return null;
                }
                if(selectedFieldName=='[]')
                {
                    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Please select any item from Field Picklist.'));
                    return null;
                }            
                
            }
            else
            {
                
                System.Debug('pkp : ' + selectedDataObject); 
                strUserID =UserInfo.getUserId(); 
                List<ReportFieldsUsed__c> fldids = new list<ReportFieldsUsed__c>();
                
                //List<ReportFieldsUsed__c> existing = [SELECT Id From ReportFieldsUsed__c where userid__c =:strUserID];
                
                for(ReportFieldsUsed__c f:[SELECT Id From ReportFieldsUsed__c where userid__c =:strUserID])
                {
                    ReportFieldsUsed__c rpf = new ReportFieldsUsed__c();
                    rpf.Id = f.Id;
                    fldids.add(rpf);
                }
                
                delete fldids;         
                //System.Debug('pkp selected object API :' +selectedDataObject);
                //System.Debug('pkp selected field  :' +selectedFieldName);
                //System.Debug('pkp current user  :' +strUserID);
                SearchReportFieldBatchNew obj = new SearchReportFieldBatchNew(selectedDataObject,selectedFieldName,strUserID);
                if(!Test.isRunningTest()) Database.executeBatch(obj,1);   
            }
            
        }catch(Exception ae){}
        return null;
    }
    
}


 
Hi Developers!
I need help please! I have deployed a change set to production and it is failing on multiple apex tests. I looked at some of the classes that failed and they are not working/old and obsolete. I don't know how to deactivate them or modify to make them work so that the failures clear up. Also, it seems that I have a lot of exception errors since I created more complex process builders. Could this be the cause of the failures? I am the SF Admin and the only SF person here, so my resources are limited and all help is appreciated!
User-added image
Hi All,
 
I'm working on a requirement where I want a button that will open a modal to create a new Task record in LWC. For this, I tried using NavigationMixin. But on click of Save in the modal, it redirects to the newly created record page instead of closing the modal. Is there any way to skip the navigation to the newly created record and close the modal only.
Below is the code of NavigationMixin that I'm using:
this[NavigationMixin.Navigate]({ type: 'standard__objectPage', attributes: { objectApiName: 'Task', actionName: 'new' } });
 
Thanks in advance.
 
#LightningFramework #lightningwebcomponents  #LWC  #Navigationmixin
here is my class:-
public class CloneXmittal {
public ID transmittalid = ApexPages.currentPage().getParameters().get('transmittalid');
public ID ClonedTXid;
  public CloneXmittal(){}
  public void CloneXmittal1(){
        Transmittal__c TXOriginal = [Select id, Name,Addcontact__c,Bid_Due_Date__c,Change_Update_Sent__c,Contacts__c,Delivery_Method__c,Emaillist__c,FTP_Link__c,Opportunity__c,Requested_By__c,RFP_Sent_to_Vendor__c,Rownumber__c,Sales_Admin_Instructions__c,Structural_Fab_Misc_Vendor__c,Transmittal_Request_Date__c,Vendor_Instructions__c,Vendor_Proposal_Deadline__c,Vendor_Type__c from Transmittal__c where id =: transmittalid ];
        Transmittal__c TX = new Transmittal__c(
                                Addcontact__c=TXOriginal.Addcontact__c,
                                Contacts__c=TXOriginal.Contacts__c,
                         Delivery_Method__c=TXOriginal.Delivery_Method__c,
                                Emaillist__c=TXOriginal.Emaillist__c,
                                FTP_Link__c=TXOriginal.FTP_Link__c,
                                Opportunity__c=TXOriginal.Opportunity__c,
                                Requested_By__c=TXOriginal.Requested_By__c,
                                Rownumber__c=TXOriginal.Rownumber__c,                     Structural_Fab_Misc_Vendor__c=TXOriginal.Structural_Fab_Misc_Vendor__c,

 Vendor_Type__c=TXOriginal.Vendor_Type__c
                                );
                                insert TX;
                                ClonedTXid = TX.id;
        List<StructuralFab_Vendors__c> SFABLIST= new List<StructuralFab_Vendors__c>([Select ContactList__c, Transmittal__c, Account__c from StructuralFab_Vendors__c where Transmittal__c =:transmittalid  ]);
        List<StructuralFab_Vendors__c> SFABCLONE= new List<StructuralFab_Vendors__c>();
        for(StructuralFab_Vendors__c SFAB: SFABLIST){
             StructuralFab_Vendors__c SFABCOPY = SFAB.clone(false,true,false);
             SFABCOPY.Transmittal__c = TX.id;
            SFABCLONE.add(SFABCOPY );       
        }
        insert SFABCLONE;
        CloneXmittalDML();
}
public pagereference CloneXmittalDML(){
 PageReference home = new PageReference('/' + ClonedTXid );
        home.setRedirect(true);
return home;
}
}

test class:-

@isTest
public class CloneXmittalTest {
    
    static testMethod void test1(){
       Transmittal__c tr = new Transmittal__c();
        tr.Addcontact__c=false;
        tr.Delivery_Method__c='Email / Web';
        insert tr; 
        
        List<StructuralFab_Vendors__c> SFABCLONE= new List<StructuralFab_Vendors__c>();
        SFABCLONE[0].Transmittal__c = tr.Id;
        
        insert SFABCLONE;

        CloneXmittal cx = new CloneXmittal();
        cx.CloneXmittal1();
       
    }
}
Hi,

I am in Lightning and I am currently using Salesforce's standard functionality of adding products on an opportunity.

As we have different types of products, when the users are selecting the products from the Add Products page and click the button Next, I want to be able to hide a Lookup field to a custom object I have created on the OLI - depending on the type of product selected. 

Also, when the Lookup field is showing on the OLI for some of the products, I want to prepoluate another two fields from the OLI with the values of the records from the Lookup field.

Is it possible to achieve this only by creating an Apex code? Without having to create a Visualforce page?


Thanks a lot.