• Sandeep Walia
  • SMARTIE
  • 574 Points
  • Member since 2016
  • Salesforce Developer

  • Chatter
    Feed
  • 15
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 57
    Replies
We are loading the Case from the website. There is an issue with Images field in Case entity as displayed below:

Text in Images Field in Case entity : ["https:\/\/www.intops.com.au\/wp-content\/uploads\/gravity_forms\/2-cb870933d1056667864f32a0efe9bcff\/2018\/08\/MDC3521112.JPG";]
 
So, everytime we have to remove the junk characters and set it as below and check the images.
 
Need update: https:\\www.intops.com.au/wp-content/uploads/gravity_forms/2-cb870933d1056667864f32a0efe9bcff/2018/08/MDC3521112.JPG

Can you please help to write a trigger to truncate the junk characters. Thanks a lot 

 
Hi
I have been trying to pass this challenge (https://trailhead.salesforce.com/en/trails/force_com_dev_intermediate/modules/apex_integration_services/units/apex_integration_webservices):

To pass this challenge, create an Apex REST class that is accessible at '/Accounts/<Account_ID>/contacts'. The service will return the account's ID and Name plus the ID and Name of all contacts associated with the account. Write unit tests that achieve 100% code coverage for the class and run your Apex tests.
The Apex class must be called 'AccountManager'.
The Apex class must have a method called 'getAccount' that is annotated with @HttpGet
The method must return the ID and Name for the requested record and all associated contacts with their ID and Name.
The unit tests must be in a separate Apex class called 'AccountManagerTest'.
The unit tests must cover all lines of code included in the AccountManager class, resulting in 100% code coverage.
Run your test class at least once (via 'Run All' tests the Developer Console) before attempting to verify this challenge.

I getting this error:

Challenge Not yet complete... here's what's wrong: 
Executing the 'AccountManager' method failed. Either the service isn't configured with the correct urlMapping, is not global, does not have the proper method name or does not return the requested account and all of its contacts.

This is my code:
 
@RestResource(urlMapping='/Accounts/*/contacts')
global with sharing class AccountManager {
	
    @HttpGet
    global static List<sObject> getAccount(){
        RestRequest request = RestContext.request;
        List<String> urlParams = request.requestURI.split('/');
        
        String accountId;	
        for(String param: urlParams){
            if((param != 'Accounts') && (param != 'contacts'))
                accountId = param;
        }
    
        List<Account> lstAccounts = new List<Account>();
        lstAccounts = [SELECT Id, Name FROM Account WHERE Id = :accountId];
        
        List<sObject> result = new List<sObject>();
        result.add(lstAccounts[0]);
        
        List<Contact> lstContacts = [SELECT Id, Name FROM Contact WHERE AccountId = :accountId];
        for(Contact c:lstContacts){
            result.add(c);
        }
        return result;
    }
}

This is my response
 
[ {
  "attributes" : {
    "type" : "Account",
    "url" : "/services/data/v39.0/sobjects/Account/001o0000015hgVBAAY"
  },
  "Id" : "001o0000015hgVBAAY",
  "Name" : "SFDC Computing"
}, {
  "attributes" : {
    "type" : "Contact",
    "url" : "/services/data/v39.0/sobjects/Contact/003o000001DbYc8AAF"
  },
  "Id" : "003o000001DbYc8AAF",
  "Name" : "Pepito Peres"
}, {
  "attributes" : {
    "type" : "Contact",
    "url" : "/services/data/v39.0/sobjects/Contact/003o000001BsUPwAAN"
  },
  "Id" : "003o000001BsUPwAAN",
  "Name" : "Last0"
} ]

Can someone light my way?​
How To Split String by space and store each character or substring in array
I have: String  -   '(1 OR 2) AND 3'
I need in this way: 

String [] filterLogicSplittedbySpace=new String[]{'(', '1', 'OR', '2', ')', 'AND', '3'};

Please guide.
 
My inputTextarea with richText enabled isn't firing events. However, if the richText is disabled the event works.
 
<apex:inputTextarea onchange="change()" richText="true" value="{!content}"/>

<script>
                function change() {
                    console.log('changed');
                }
</script>

How can I solve this?
I have a Javascript button in Lightning that needs to go out to SpringCM and pulls a form up that our users complete, it uses fields from the Opportunity that it pass through the URL. I am desperately trying to figure out how to do this and have tried the Trailhead Module: Lightning Alternatives to JavaScript Buttons and either it does not explain for my example or I am unable to understand. Can someone point me to any other solutions?

The Button is below:
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")} 

//Should not have to change this at all 
function getEOSInfo(objectid,objecttype,callback) { 

var baseUrl = "{!$Api.Partner_Server_URL_260}".substring(0, "{!$Api.Partner_Server_URL_260}".indexOf("/services")); 
var url = baseUrl +"/services/apexrest/SpringCMEos/eosinfo?objecttype="+objecttype+"&objectid="+objectid; 
var authkey = "Bearer {!$Api.Session_ID}"; 

sforce.connection.remoteFunction({ 
url : url, 
requestHeaders: {"Authorization":authkey,"Accept":"application/json"}, 
onSuccess : function(response) { 
var eosInfoResponse = JSON.parse(response); 
callback(eosInfoResponse); 
} 
}); 
} 


//Here you write your own code, this is a simple call 
var objectid = "{!Opportunity.Id}"; 
var objecttype = "Opportunity"; 

getEOSInfo(objectid,objecttype,function(eosInfo){ 


var formuid = "8be07531-XXXX-e611-XXXX-6c3be5a7XXXX"; 
var url = "https://XXX21.springcm.com/atlas/Forms/UpdateFormDoc.aspx?aid=9723&FormUid=" + formuid + "&SFFTE={!Opportunity.FTEs__c}&SFIND={!Account.Industry}&SFPSD={!Opportunity.ProgramStartDate__c}&SFID=" + eosInfo.SFId + "&SFNAME={!Opportunity.Name}&SFWF=ABC&SFCAFTYPE=CAAF&SFTYPE=Salesforce.Opportunity&SFPATH=" + eosInfo.FolderPath + "&ru=%2Fatlas%2Fbpm%2FWorkList.aspx"; 

window.open(url); 

});

Your help is greatly appreciated.
In the Trailhead module called "Override A Standard Action with a Lightning Component", everything is going OK up till the point where we add SLDS styling to the cmp to make it a modal. They provide the code (see below), but for some reason, it's not displaying as modal for me. (Yes, I've refreshed, multiple times, even relaunching the playground.) Anybody else experiencing this?
<aura:component implements="lightning:actionOverride,flexipage:availableForRecordHome,force:hasRecordId" access="global">
    <aura:attribute name="picklistValues" type="Object" />
    <aura:attribute name="propertyRecord" type="Property__c" />
    <force:recordData aura:id="forceRecord"
                      recordId="{!v.recordId}"
                      targetFields="{!v.propertyRecord}"
                      fields="Id,Name,Beds__c,Baths__c,Price__c,Status__c"
                      mode="EDIT" />
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />

    <c:PickListValues sObjectName="Property__c" fieldName="Status__c" picklistValues="{!v.picklistValues}" />

    <div aura:id="editDialog" role="dialog" tabindex="-1" aria-labelledby="header43" class="slds-modal slds-fade-in-open">
        <div class="slds-modal__container">
                <div class="slds-modal__header">
                    <h2 class="slds-text-heading--medium">New Record</h2>
            </div>
            <div class="slds-modal__content slds-p-around--medium slds-grid slds-wrap ">
                <lightning:input aura:id="propName" name="propName" label="Property Name" required="true" class="slds-size--1-of-1 slds-p-horizontal_x-small" />
                <lightning:input aura:id="propBeds" name="propBeds" label="Beds" class="slds-size--1-of-2 slds-p-horizontal_x-small" />
                <lightning:input aura:id="propBaths" name="propBaths" label="Baths" class="slds-size--1-of-2 slds-p-horizontal_x-small" />
                <lightning:input aura:id="propPrice" name="propPrice" label="Price" class="slds-size--1-of-2 slds-p-horizontal_x-small" />    
                <lightning:select aura:id="propStatus" name="propStatus" label="Status" class="slds-size--1-of-2 slds-p-horizontal_x-small">
                    <aura:iteration items="{!v.picklistValues}" var="item">
                        <option value="{!item}">{!item}</option>
                    </aura:iteration>
                </lightning:select>
            </div>
            <div class="slds-modal__footer">                
                <lightning:button variant="neutral" label="Cancel" />
                <lightning:button variant="brand" label="Submit" onclick="{!c.saveRecord}" />
            </div>
        </div>
    </div>
    <div aura:id="overlay" class="slds-backdrop slds-backdrop--open"></div>
</aura:component>

 
Component:
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" controller="countRecords" >
    <aura:attribute name="contactcount" type="integer" />
     <aura:attribute name="Accountcount" type="integer" />
    <aura:attribute name="oppcount" type="integer" />
    <div style = "slds">
        <lightning:button onclick="{!c.count}" title="to get the total numbe of records" class="slds-button-sucess"  label="count" variant="brand" iconName="utility:people" iconPosition="left" /><br/>

        Totalnumber of accounts:<ui:outputText value="{!v.contactcount}" title="Totalnumber of accounts" class="slds-output"/><br/>
        Totalnumber of contacts:<ui:outputText value="{!v.Accountcount}" title="Totalnumber of contacts" class="slds-output"/><br/>
        Totalnumber of opprts:<ui:outputText value="{!v.oppcount}" title="Totalnumber of opprts"  class="slds-output"/><br/>
     </div>
</aura:component>
Controller:
({
    count : function(cpnt, event, helper) {
        var action = cpnt.get("c.getrecords");
        var accounts = cpnt.get("v.contactcount");
        var contacts = cpnt.get("v.Accountcount"); 
        var opprts = cpnt.get("v.oppcount");
        action.setParams({ 
                            "accounts": accounts,
                             "contacts": contacts ,
                              "opprts": opprts ,
                         });
        
    action.setCallback(this, function(a) {
           var state = a.getState();
            if (state === "SUCCESS") {
 
    alert("Records are counted sucessfully");
                           
            }
        });
    $A.enqueueAction(action);  

      
    }

})
Apex controller:
public class countRecords {
   /* @AuraEnabled public   integer accounts {get;set;} 
        @AuraEnabled public   integer contacts {get;set;}
        @AuraEnabled public  integer opprts {get;set;}*/
     @AuraEnabled
    Public static void getrecords(integer accounts,integer contacts, integer opprts){
        
        accounts = [select count() from Account];
        contacts = [select count() from contact];
        opprts = [select count() from Opportunitie__c];  
        system.debug('>>>>>>>>>>>'+accounts);
    }
    
}
Thanks in advance
I created an lightning component that displays the Number and a footer text. But when i added it to the account page through lightning app builder, The surrounding margin size of the component is too big. Is there any way i can control the sizing of the component? 

P.S. I tried creating a css class with height and width properties. and added it to outer div. But it didnt work. 
User-added image
Hi

I have attached a screenshot, I need help to create a VF Page same as the attached picture, so that from each button I can call different class to do data entry
User-added image
  • July 19, 2017
  • Like
  • 0
Hello
I have json data as follows.

I need help in creating an object design for this json data so when I deserialize the json then I want to store in backend.

Please help me in creating the object design.
{
  "invoiceList": [
    {
      "totalPrice": 5.5,
      "statementDate": "2011-10-04T16:58:54.858Z",
      "lineItems": [
        {
          "UnitPrice": 1,
          "Quantity": 5,
          "ProductName": "Pencil"
        },
        {
          "UnitPrice": 0.5,
          "Quantity": 1,
          "ProductName": "Eraser"
        }
      ],
      "invoiceNumber": 1
    },
    {
      "totalPrice": 11.5,
      "statementDate": "2011-10-04T16:58:54.858Z",
      "lineItems": [
        {
          "UnitPrice": 6,
          "Quantity": 1,
          "ProductName": "Notebook"
        },
        {
          "UnitPrice": 2.5,
          "Quantity": 1,
          "ProductName": "Ruler"
        },
        {
          "UnitPrice": 1.5,
          "Quantity": 2,
          "ProductName": "Pen"
        }
      ],
      "invoiceNumber": 2
    }
  ]
}
Thanks
smitaB
 
I have shared my custom controller class and I need some help on writing test class for the same. Kindly let me know how to proceed
public class UserAccountsExtension {        
    //Variable Declaration
    boolean showReg=true;
    public UserAccount__c uAccount{get;set;} 
    public Employee_Detail__c addEmployee{get;set;}  
    public List<Employee_Detail__c> uEmployeeDetail{get;set;}      
    
    public UserAccountsExtension(){                
        
        Id id = ApexPages.currentPage().getParameters().get('id'); 
        String pgName=ApexPages.currentPage().getUrl().substringAfter('/apex/').substringBefore('?');
        this.uAccount = (id == null) ? new UserAccount__c() :[select First_Name__c,Last_Name__c,Phone__c,Email__c,UserLogo__c,Role__c,Company_Name__c,Location__c from UserAccount__c where Id=: id];        
        this.uEmployeeDetail = (id == null) ? new List<Employee_Detail__c>() : [select First_Name__c,Last_Name__c,Employee_ID__c from Employee_Detail__c where Id=:id];        
        		if (this.uEmployeeDetail.size() ==0)
        {
            addEmployee=new Employee_Detail__c();        	
        	this.uEmployeeDetail.add(addEmployee);
        }       
    } 
    public PageReference checkStep1()
    {
        If(uAccount.First_Name__c==null||uAccount.First_Name__c=='')
            {
                PageReference step1=new PageReference('/apex/RegisterStep1');
                return step1;
            }
        else
        {
        	return null;
        }        
    }
    public PageReference movetoStep1()
    {                
        PageReference nextPage=new PageReference('/apex/RegisterStep1');
        nextPage.setRedirect(false);
        return nextPage;
    }
    public PageReference movetoStep2()
    {
		/*if(userimage.name==''||userimage.name==null)        
        {           
			userimage.body = userlogo; 
			userimage.name = 'userlogo'; 			
			userimage.ContentType = 'application/jpg'; 
        }	*/	
        PageReference nextPage=new PageReference('/apex/SampleLogin');
        nextPage.setRedirect(false);
        return nextPage;
    }
    public PageReference movetoStep3()
    {                
        PageReference nextPage=new PageReference('/apex/RegisterStep3');
        nextPage.setRedirect(false);
        return nextPage;
    }
    public PageReference gotoConfirmation()
    {
    	PageReference nextPage=new PageReference('/apex/Confirmation');
        nextPage.setRedirect(false);
        return nextPage;
    }
	public PageReference mysave() { 
        insert uAccount;
        for(integer i=0;i<uEmployeeDetail.size();i++)
        {
        	uEmployeeDetail[i].UserAutoID__c=this.uAccount.id;
        }
        insert uEmployeeDetail;
        PageReference pv=new pageReference(ApexPages.currentPage().getURL());   
        if (!ApexPages.hasMessages())
        {showReg=false;}   
        else
        {pv.setRedirect(FALSE);}    	     
        return pv; 
    }
       
    public void addRow()
    {
        addEmployee=new Employee_Detail__c();       
        uEmployeeDetail.add(addEmployee);
    }    
        
    public boolean getShowRegistration()
    {     
        return showReg;
    }
        
}

 
Hi 

I am using Messaging.sendEmail method.
What is maximun size of setPlainTextBody?

Thanks & Regards,
LinThaw
Can folks who have completed Salesforce Connect Trailhead help?

I am getting the following error:
Challenge Not yet complete... here's what's wrong: 
An external object with the API name Phone_Plan__x does not exist

The instruction on the Challenge says
Note that you will need to adjust the Object Names for the two external objects from the default setting after the initial sync.

So, I go to the External Object and changed the API to Phone_Plan__x

This gives me a validation error
Error: The Object Name field can only contain underscores and alphanumeric characters. It must be unique, begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores. 

It says the Object Name field should not contain two consecutive underscores.  But, the API name does contain two consecutive underscores at the end.

Can someone please help?

Thanks,
Munira

 
I am getting an error in challenger 2 and i am pretty sure all my headers are correct. The error is not really telling me much, can anyone help? thanks 

User-added image
We want to generate an invoice of all the items that have been selected by a user in product and generate an invoice along with all the invoice items,but can't access the pricebook contents.
Hello,

I have requirment to crate field as from vf by selecting data type.
If I selected data type from picklist as text data type  and input value Enter Name for that field this field display as input field(Enter Name With text box) on another page or same page.

PFA
  


User-added image
  • September 03, 2018
  • Like
  • 0
We are loading the Case from the website. There is an issue with Images field in Case entity as displayed below:

Text in Images Field in Case entity : ["https:\/\/www.intops.com.au\/wp-content\/uploads\/gravity_forms\/2-cb870933d1056667864f32a0efe9bcff\/2018\/08\/MDC3521112.JPG";]
 
So, everytime we have to remove the junk characters and set it as below and check the images.
 
Need update: https:\\www.intops.com.au/wp-content/uploads/gravity_forms/2-cb870933d1056667864f32a0efe9bcff/2018/08/MDC3521112.JPG

Can you please help to write a trigger to truncate the junk characters. Thanks a lot 

 
Hi,
from image..once table extends to 2nd page , the last border is breaking..Please help me to manage this table wthout breaking border line..
please check my attachment .
User-added image
Hello, This question is already asked, But my question is something different.

According to me, the above error occurs when the user is idle for some time (i,e standard expiry time of session) and tried to save an opportunity or anything in Salesforce.

So I would like to know is this error solves when user refresh the page?

And also what is the duration of the session?

Any help will be really appreciated.
 
I have an apex trigger which does not align (AT ALL!) with Salesforce "Best Practice" of never having queries and/or DMLs inside a 'for' loop.

I know this theory but, as I am new to coding, I need to break the ice and put this theory into practice (for the first time of my life) and I would like to ask if there is a "Best approach" to doing precisely that (moving SOQL-queries and/or DMLs outside the 'for' loop on 'Trigger.new', or for that matter, to move them from any loop).

Is there any approach, guide, video that could teach me to learn this "optimization process" of my code?

Below, here is my trigger (but please, do not give me the whole solution yet/inmediately, I am looking for a guide for me to try putting it into practice); thank you!:

==>This trigger adds Team Members to an Opportunity upon creation of that new Opportunity:
trigger OwnerManager on Opportunity (after insert) {
    for(Opportunity opp : Trigger.new){
        //Get opp Owner.Manager info
        Opportunity oppWithManagerInfo = [SELECT Id,
                                          Owner.ManagerId
                                          FROM Opportunity
                                          WHERE Id = :opp.Id];
        //Get opp Owner direct dependents
        List<user> directDependents = [SELECT Id
                                       FROM user
                                       WHERE ManagerId = :opp.OwnerId
                                       LIMIT 1];
        //Create Opportunity Team Role
        if (oppWithManagerInfo.Owner.ManagerId != null) {
            OpportunityTeamMember otm = new OpportunityTeamMember();
            otm.UserId                = oppWithManagerInfo.Owner.ManagerId;
            otm.OpportunityId         = opp.Id;
            otm.TeamMemberRole        = 'Sales Manager';
            insert otm;
            //Create another Opportunity Team Role with directDependent
            if (directDependents.size()>0){
                OpportunityTeamMember otm2 = new OpportunityTeamMember();
                otm2.UserId                = directDependents[0].Id;
                otm2.OpportunityId         = opp.Id;
                otm2.TeamMemberRole        = 'Sales Rep.';
                insert otm2;
            }
        }
    }
}

 
Hello all,

In the Create & Edit Visualforce Pages challenge, for #6 in the first part they ask you to run a command in Console to make the page look like Lightning. When I run this command, I am receiving the error "Uncaught ReferenceError: $A is not defined at <anonymous>:1:1".

Has the command changed?

Thank you!
Hi
I have been trying to pass this challenge (https://trailhead.salesforce.com/en/trails/force_com_dev_intermediate/modules/apex_integration_services/units/apex_integration_webservices):

To pass this challenge, create an Apex REST class that is accessible at '/Accounts/<Account_ID>/contacts'. The service will return the account's ID and Name plus the ID and Name of all contacts associated with the account. Write unit tests that achieve 100% code coverage for the class and run your Apex tests.
The Apex class must be called 'AccountManager'.
The Apex class must have a method called 'getAccount' that is annotated with @HttpGet
The method must return the ID and Name for the requested record and all associated contacts with their ID and Name.
The unit tests must be in a separate Apex class called 'AccountManagerTest'.
The unit tests must cover all lines of code included in the AccountManager class, resulting in 100% code coverage.
Run your test class at least once (via 'Run All' tests the Developer Console) before attempting to verify this challenge.

I getting this error:

Challenge Not yet complete... here's what's wrong: 
Executing the 'AccountManager' method failed. Either the service isn't configured with the correct urlMapping, is not global, does not have the proper method name or does not return the requested account and all of its contacts.

This is my code:
 
@RestResource(urlMapping='/Accounts/*/contacts')
global with sharing class AccountManager {
	
    @HttpGet
    global static List<sObject> getAccount(){
        RestRequest request = RestContext.request;
        List<String> urlParams = request.requestURI.split('/');
        
        String accountId;	
        for(String param: urlParams){
            if((param != 'Accounts') && (param != 'contacts'))
                accountId = param;
        }
    
        List<Account> lstAccounts = new List<Account>();
        lstAccounts = [SELECT Id, Name FROM Account WHERE Id = :accountId];
        
        List<sObject> result = new List<sObject>();
        result.add(lstAccounts[0]);
        
        List<Contact> lstContacts = [SELECT Id, Name FROM Contact WHERE AccountId = :accountId];
        for(Contact c:lstContacts){
            result.add(c);
        }
        return result;
    }
}

This is my response
 
[ {
  "attributes" : {
    "type" : "Account",
    "url" : "/services/data/v39.0/sobjects/Account/001o0000015hgVBAAY"
  },
  "Id" : "001o0000015hgVBAAY",
  "Name" : "SFDC Computing"
}, {
  "attributes" : {
    "type" : "Contact",
    "url" : "/services/data/v39.0/sobjects/Contact/003o000001DbYc8AAF"
  },
  "Id" : "003o000001DbYc8AAF",
  "Name" : "Pepito Peres"
}, {
  "attributes" : {
    "type" : "Contact",
    "url" : "/services/data/v39.0/sobjects/Contact/003o000001BsUPwAAN"
  },
  "Id" : "003o000001BsUPwAAN",
  "Name" : "Last0"
} ]

Can someone light my way?​
i have one wrapper class in tha class two data members account and list contacts.
and i have list of wrapper class.i want to show list of wrapper in vf page.But it showing error .How to solve this Pls anyone help me.
  • August 21, 2017
  • Like
  • 0
How To Split String by space and store each character or substring in array
I have: String  -   '(1 OR 2) AND 3'
I need in this way: 

String [] filterLogicSplittedbySpace=new String[]{'(', '1', 'OR', '2', ')', 'AND', '3'};

Please guide.
 

trigger cc_contactUpdateOnApplication on Application__c (after update) {
    Map<id,id> applicationMap = new Map<id,id>();
    List<contact>conList = new List<contact>();
    for(Application__c application : [SELECT id,Name,Contact__c,CC_Term__c,Admissions_Status__c FROM Application__c Order By LastModifiedDate DESC Limit 1]){
        system.debug('@@@@@application'+application);
        if(application.Admissions_Status__c != Trigger.oldMap.get(application.Id).Admissions_Status__c){
            // if(application.Admissions_Status__c !=null){
            applicationMap.put(application.Contact__c, application.Id);
            system.debug('#####applicationMap'+applicationMap);
        }
    } 
    for(contact con :[SELECT id,Name,Active_Application_CC__c FROM contact WHERE Id IN :applicationMap.keySet()] ){
        con.Active_Application_CC__c = applicationMap.get(con.Id);
        conList.add(con);
        system.debug('$$$$conList'+conList);
    }
    if(conList.size() >0){
        update conList;
        system.debug('####conList'+conList);
    }
}
Hello all! 

I have a trigger which operates just fine for all scenarios (Insert, Update, Delet and undelete) but when i am attempting to create a test class for the trigger to test my first scenario I am getting a null pointer exception with the folllowing error: 

System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AcctSubMrrRollup: execution of AfterInsert

caused by: System.NullPointerException: Attempt to de-reference a null object

Trigger.AcctSubMrrRollup: line 18, column 1: []

Please see my Trigger and test class below, can anyone advise what i may e doing incorrect as in theory my trigger should be doing things correctly and I am not sure why my Map is Null even after fulfillign the If statement criteria on not being null?

Please help...

Thanks for your time,

​Shawn

Trigger Code: 
trigger AcctSubMrrRollup on Zuora__SubscriptionProductCharge__c(after insert, after update, before delete, after unDelete) {
    List<Id> AccIds=new List<Id>();
    
If(Trigger.isInsert || Trigger.isUpdate || Trigger.isUnDelete) {
    for(Zuora__SubscriptionProductCharge__c mst:Trigger.New){
    if(mst.Zuora__Account__c !=null){
     AccIds.add(mst.Zuora__Account__c);
    }
    }
   

   Map<Id,Account> AccMap = new Map<Id,Account>([select id,Subscription_MRR__c from Account where id in:AccIds]);
   
   for(Zuora__SubscriptionProductCharge__c mst:Trigger.New)
   {
        if(!AccMap.IsEmpty())
        {
            AccMap.get(mst.Zuora__Account__c).Subscription_MRR__c = AccMap.get(mst.Zuora__Account__c).Subscription_MRR__c + mst.Zuora__MonthlyRecurringRevenue__c;
        }
   }

   if(!AccMap.IsEmpty())
   {
        update AccMap.values();
   }}
   
   If(Trigger.isDelete) {
    for(Zuora__SubscriptionProductCharge__c mst:Trigger.Old){
    if(mst.Zuora__Account__c !=null){
     AccIds.add(mst.Zuora__Account__c);
    }
    }
   

   Map<Id,Account> AccMap = new Map<Id,Account>([select id,Subscription_MRR__c from Account where id in:AccIds]);
   
   for(Zuora__SubscriptionProductCharge__c mst:Trigger.Old)
   {
        if(!AccMap.IsEmpty())
        {
            AccMap.get(mst.Zuora__Account__c).Subscription_MRR__c = AccMap.get(mst.Zuora__Account__c).Subscription_MRR__c - mst.Zuora__MonthlyRecurringRevenue__c;
        }
   }

   if(!AccMap.IsEmpty())
   {
        update AccMap.values();
   }}

}

Test Class Code:
@isTest
public class AcctSubMrrRollupTest {

    public static testMethod void tm1 (){
        
     Account a = new Account();
        a.Name = 'Test Account Rollup';
        
        insert a;
        
        System.debug('The Id for the newly created Account is ' + a.Id);
        
     Zuora__SubscriptionProductCharge__c z1 = new Zuora__SubscriptionProductCharge__c();
        z1.Name = 'Testing 1';
        z1.Zuora__Zuora_Id__c = '12345';
        z1.Zuora__MonthlyRecurringRevenue__c = 100;
        z1.Zuora__Account__c = a.Id;
        
        insert z1;
        
        System.debug('The ID for the newly created Sub Record is ' + z1.Id);
        
        System.assertEquals(100, a.Subscription_MRR__c);
        
    }
    
}

 
When I say debug log I am referring to the following screenshot:





User-added image
where can I find a resource that will teach me how to read this info.

Many Thanks.
Charlene.
{ "destination_addresses" : [ "Bengaluru, Karnataka, India" ], "origin_addresses" : [ "Hyderabad, Telangana, India" ], "rows" : [ { "elements" : [ { "distance" : { "text" : "576 km", "value" : 575574 }, "duration" : { "text" : "8 hours 33 mins", "value" : 30763 }, "status" : "OK" } ] } ], "status" : "OK" }


Thanks
 
My inputTextarea with richText enabled isn't firing events. However, if the richText is disabled the event works.
 
<apex:inputTextarea onchange="change()" richText="true" value="{!content}"/>

<script>
                function change() {
                    console.log('changed');
                }
</script>

How can I solve this?
I have a Javascript button in Lightning that needs to go out to SpringCM and pulls a form up that our users complete, it uses fields from the Opportunity that it pass through the URL. I am desperately trying to figure out how to do this and have tried the Trailhead Module: Lightning Alternatives to JavaScript Buttons and either it does not explain for my example or I am unable to understand. Can someone point me to any other solutions?

The Button is below:
{!REQUIRESCRIPT("/soap/ajax/10.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/10.0/apex.js")} 

//Should not have to change this at all 
function getEOSInfo(objectid,objecttype,callback) { 

var baseUrl = "{!$Api.Partner_Server_URL_260}".substring(0, "{!$Api.Partner_Server_URL_260}".indexOf("/services")); 
var url = baseUrl +"/services/apexrest/SpringCMEos/eosinfo?objecttype="+objecttype+"&objectid="+objectid; 
var authkey = "Bearer {!$Api.Session_ID}"; 

sforce.connection.remoteFunction({ 
url : url, 
requestHeaders: {"Authorization":authkey,"Accept":"application/json"}, 
onSuccess : function(response) { 
var eosInfoResponse = JSON.parse(response); 
callback(eosInfoResponse); 
} 
}); 
} 


//Here you write your own code, this is a simple call 
var objectid = "{!Opportunity.Id}"; 
var objecttype = "Opportunity"; 

getEOSInfo(objectid,objecttype,function(eosInfo){ 


var formuid = "8be07531-XXXX-e611-XXXX-6c3be5a7XXXX"; 
var url = "https://XXX21.springcm.com/atlas/Forms/UpdateFormDoc.aspx?aid=9723&FormUid=" + formuid + "&SFFTE={!Opportunity.FTEs__c}&SFIND={!Account.Industry}&SFPSD={!Opportunity.ProgramStartDate__c}&SFID=" + eosInfo.SFId + "&SFNAME={!Opportunity.Name}&SFWF=ABC&SFCAFTYPE=CAAF&SFTYPE=Salesforce.Opportunity&SFPATH=" + eosInfo.FolderPath + "&ru=%2Fatlas%2Fbpm%2FWorkList.aspx"; 

window.open(url); 

});

Your help is greatly appreciated.
Hello,

In LE, I created an action in order to create an asset, which is related to an opportunity. The action button is located at the top right side in the opportunity detail view. The action works very well, but it stays on the opportunity. Is it possible to customize the return URL, so that it redirects the user to the created asset?