• Prashant Pandey07
  • SMARTIE
  • 839 Points
  • Member since 2015
  • Salesforce Developer


  • Chatter
    Feed
  • 22
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 206
    Replies
Hello,
Having trouble editing some Visualforce code.  I'm trying to edit the AccountHierarchyTree component from the Inline Account Hierarchy Visualforce page (https://appexchange.salesforce.com/listingDetail?listingId=a0N300000016chCEAQ) so it shows a custom Account field, but I get a "Content cannot be displayed: SObject row was retrieved via SOQL without querying the requested field: Account.Project__c" error.  Edited section of code:

       <!-- Include the following if you uses sites with accounts -->

            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Type}" rendered="{!IF(pos.account.Type != '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Name}" rendered="{!IF(pos.account.Name!= '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Industry}" rendered="{!IF(pos.account.Industry!= '', true, false)}"/>&nbsp;
<!-- Stop -->

If I change account.Project__c to account.Name, Industry, or Type it works fine; all other fields I've tested don't.

Wondering if the component needs to be told to look up the field for information?  Whatever it is, I've got no idea how to make it happen - any advice would be much appreciated.

Thanks
How to Insert data Into custom objecton save button  through vf page and apex class 
Hi all,
my scenario is : When record created in custom object (IVR_object) then Task created under Contact object .
i written below code, but when i try to deploy the code getting below errror 
Error: Invalid Data. 
Review all error messages below to correct your data.
Apex trigger createTask caused an unexpected exception, contact your administrator: createTask: execution of AfterInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.createTask: line 5, column 1

even i  remove line 5 also getting same error , can some one please check below code and pls let me know how to fix this

trigger createTask on IVR_Journey__c (after insert) {
    List<Task> taskToInsertList = new List<Task>();
    List<Contact> contactToUpdateList = new List<Contact>();
   id idRecType = Schema.SObjectType.Contact.getRecordTypeInfosByName().get('IVR_Task_Record').getRecordTypeId();
       for (IVR_Journey__c ivj : trigger.new) {
        Task task = new Task();
        task.Subject = 'IVR Self Service';
        task.WhoId = ivj.Ivr_Journey__c;
        task.Status = 'Completed';
        task.ActivityDate = date.Today();
        task.Authentication_Result__c = ivj.Authentication_Result__c;
        task.Caller_ID__c = ivj.Caller_ID__c;
        task.Contact_Channel_Duration__c = ivj.Contact_Channel_Duration__c;
        task.Contact_Intent__c = ivj.Contact_Intent__c;
        task.Automated_Task_Completed__c = ivj.Automated_Task_Completed__c;
        task.Transfered_To__c = ivj.Transfered_To__c;
        task.Survey_Option__c = ivj.Survey_Option__c;
        task.DNIS__c = ivj.DNIS__c;
        task.Start_Date_Time__c = ivj.Start_Date_Time__c;
        task.End_Date_Time__c = ivj.End_Date_Time__c;
        task.Language_Preference__c = ivj.Language_Preference__c;
        Contact contact = new Contact (Id = ivj.Ivr_Journey__c);
        Task.RecordTypeId = idRecType;
        taskToInsertList.add(task);
        contactToUpdateList.add(contact);
        
    }
    
    if(taskToInsertList.size() > 0)
        insert taskToInsertList;
        
    if(contactToUpdateList.size() > 0)
        update contactToUpdateList;
  
}
please check and let me know why this error coming ............Thanks in advance
So I have a pageblocktable that I populate with 
Public List<OpportunityLineItem> oppLineItem {get;set;}
 oppLineItem = [Select Id, Discount, ListPrice, TotalPrice,  PricebookEntryId, Product2Id, ProductCode, Name, Quantity,  UnitPrice, Description FROM OpportunityLineItem WHERE OpportunityId = :oppId];
What I would like to have happen is to group by Name and generate a sum for the Quantity. 

Is that possible or is there a better option than pageblocktable.  Note, I was only using the pageblocktable as I am not sure of how many items will be returned with the query.
 

Hello,

I have a checkmark field in the case, once that checkmark is selected I want the case to be placed in a specific case owners queue, it shouldn't be assigned to the person who opened the case. Is this something I have to do in Process Builder? or?

Thanks!

Would a profile assignment be considered metadata?
Hi All,
I am getting below error while creating the Community User
Error: First exception on row 0; first error: UNKNOWN_EXCEPTION, portal account owner must have a role.

I verified the Account owner Role. It was selected the role also.

Later i found that Account Owner is inactive.

In this senario how to create community user. Is i need to change Account Owner? Please confirm or any best solution.

Hi  All,
I have created  picklist field with options(1,2,3,4) and url field in opportunity object..........
my requirment is when i choose 2 and 3 values in picklist the url field should be shown  and when i choose 1 or 4 values the url field must be disabled or not shown...........
How can i achieve these can anyone help me...................................

Thanks Inadvance..................
Hello All,
Schrren shot for reference
I am working on opportunity and I have a custom button on opportunity as GoToTask. There is custom field on the opportnuity called Test which is a picklist field. It have two values : 1-Ok and 2- Not Ok . If Test field has value as OK then once I click on GoToTask button it should take me to opportunity's NEW TASK creation activity. If Test field has value as NOT OK then there should be a message saying "You can not goto Task". Pls help me to achieve this. I think this can be done thrugh JavaScript but I am not sure how to achieve this.

Thanks.
Hi, 

  Please suggest me a logic to update quotelines from quote. When quote is inserted or updated. 

Thanks
Sudhir
Hi ,
Currently,I am working on below scenario.When check box in quote line Item object is checked ,corresponding check box in opportunity should be checked. Can anyone please post the  trigger code for this scenario

Hi Everyone,

I've created a simpletrigger that creates a new record of custom object: Hosted_PBX_Deployment__c when a new Opportunity is created.
Now I need to set a value to a fiield: Rack_4_19_two_post_Qty__c in custom object that depends on a value of an Account field: All_Network_Devices_Qty__c
so if Account.All_Network_Devices_Qty__c <=11 then Rack_4_19_two_post_Qty__c =1 

what is the best way to reffer to an Account field from Hosted_PBX_Deployment__c trigger?

this is my trigger:

trigger AutoCreateHPBXdeployment on Opportunity (after insert) {


List<Hosted_PBX_Deployment__c> newHPBX = new List<Hosted_PBX_Deployment__c>();
  for (Opportunity opp : Trigger.new) {
      if(opp.Hosted_PBX__c=='Yes'){
    Hosted_PBX_Deployment__c hpbx = new Hosted_PBX_Deployment__c();
    hpbx.Opportunity__c  = opp.Id;
    hpbx.Opportunity_Account__c = opp.AccountId;
   
 
    newHPBX.add(hpbx);
      }
  }
  insert newHPBX;

}

Thank you!

There are two inputText Mobile and Email.
When i fill only Mobile inputText one popup message should be display and if i fill only email inputText another popup messege should display.
I have a visualforce page that I used to override the 'New Opportunity' button on the Opportunity related list on the Account. To make this usable in Lightning, should I create a lightning component? Or is there a way to use the Visualforce page that I already have written? 

Any advice is greatly appreciated. 

Thanks, 
Tasia

I am using the following trigger which should look at the case being created, make it a default admin user for the time being (for permissions), look only for WEB based bases to change the user ( which i think isn't working right either) and then add everyone with a checkbox on their contact as a case team member. However I get an error but ONLY when adding a case from our community. What about those users would mess this up?

 

trigger CaseTeamAddition on Case (after insert) {
 
  if (Trigger.isAfter){
                If (Trigger.isInsert){
                                CaseTeamRole caseTeamRole = [SELECT Id 
                                                            FROM CaseTeamRole 
                                                            WHERE Name = 'Case Update Team'
                                                            LIMIT 1];
 
                                List<Id> accountIdList = new List<Id>();
                          List<Id> caseIdList = new List<Id>();
                                For (Case currentCase : Trigger.new){
                                     accountIdList.add(currentCase.AccountId);
                                    caseIdList.add(currentCase.Id);
                                }
                          
                          User dbUser = [SELECT Id
                                                    FROM User
                                                    WHERE Alias = 'dblevins'
                                                    LIMIT 1];
                          
                          List<Case> caseList = [SELECT Id, OwnerId
                                                      FROM Case
                                                      WHERE Id IN :caseIdList
                                                      AND Type = 'Web'];
                          
                                for (Case curCase : caseList){
                                    curCase.OwnerId = dbUser.Id;
                                }
                          
                          update caseList;
                                
                                List<Contact> contactList = [SELECT Id, AccountId
                                                             FROM Contact
                                                             WHERE AccountId IN : accountIdList
                                                             AND Get_Email_Updates__c = true];
                                
                                List<CaseTeamMember> caseMembersToInsert = new List<CaseTeamMember>();
                                For (Case currentCase : Trigger.new){
                                  For (Contact currentContact : contactList){
                                     If (currentContact.AccountId == currentCase.AccountId){
                                           CaseTeamMember newMember = new CaseTeamMember(ParentId = currentCase.Id,
                                                                             MemberId = currentContact.Id,
                                                                                         TeamRoleId = caseTeamRole.Id);
                                            caseMembersToInsert.add(newMember);
                                        }
                                   }
                                }

                                if (caseMembersToInsert.size() > 0){
                                  insert caseMembersToInsert;
                                
                                }
                                                               
              }
  }                               

Hi there,

I have two custom objects. The Investigation__c is the parent object, and the Time_Entry_Recap_Report__c is the child object. What I want to have happen is when the parent record (Investigation) is initially created, I want to create an initial entry in the 'Time_Entry_Recap_Report__c' with 15 minutes of time worked and a description of the task being 'Opened new investigation'. I'm trying to figure out how to relate the Child record to the parent record when I create the entry in the trigger. The object 'Time_Entry_Recap_Report__c' is already defined as a child to the parent, but trying to insert the record without a reference to the 'Investigation_Time_Entry__c' field within the 'Time_Entry_Recap_Report__c' object didn't work either. The Error I am getting is "Error: Compile Error: Illegal assignment from Schema.SObjectField to Id at line 8 column 7. Any assistance would be greatly appreicated. 
trigger CreateTimeEntry on Investigation__c (after insert) {
    List<Time_Entry_Recap_Report__c> entryList = new List<Time_Entry_Recap_Report__c>();
    for(Investigation__c InvestigationObj : Trigger.new){
    Time_Entry_Recap_Report__c entry = new Time_Entry_Recap_Report__c();
      entry.Hours_Worked__c = '00';
      entry.Minutes_Worked__c = '15';
      entry.Work_Performed__c = 'Opened new investigation';
      entry.Investigation_Time_Entry__c = Investigation__c.NAME;
      entryList.add(entry);
     }
     if(entryList.size()>0){
      upsert entryList;
     }
}

 
Hello,
Having trouble editing some Visualforce code.  I'm trying to edit the AccountHierarchyTree component from the Inline Account Hierarchy Visualforce page (https://appexchange.salesforce.com/listingDetail?listingId=a0N300000016chCEAQ) so it shows a custom Account field, but I get a "Content cannot be displayed: SObject row was retrieved via SOQL without querying the requested field: Account.Project__c" error.  Edited section of code:

       <!-- Include the following if you uses sites with accounts -->

            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Type}" rendered="{!IF(pos.account.Type != '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Name}" rendered="{!IF(pos.account.Name!= '', true, false)}"/>
            <apex:outputText style="{!IF(pos.currentNode,'font-weight: bold;','')}" value=", {!pos.account.Industry}" rendered="{!IF(pos.account.Industry!= '', true, false)}"/>&nbsp;
<!-- Stop -->

If I change account.Project__c to account.Name, Industry, or Type it works fine; all other fields I've tested don't.

Wondering if the component needs to be told to look up the field for information?  Whatever it is, I've got no idea how to make it happen - any advice would be much appreciated.

Thanks
Hello all. I am working through the module called Customize a Salesforce Object, and am trying to complete the section on Enable Account Field History Tracking. I am at the part where it asks to locate Edge Communications, but when I follow the steps, this does not appear - I don't have any Accounts.
Suggestions? Was this account something that was created in a different module?

Instructions

No results
Hi All,

I have a requirment to create Web Form to get the details from new customer and update a custom object in salesforce platform. 

I have created a VF page and a custom controller which can do this. But I want that form (VF page) to be available to the customer who access our main website. i.e., Customer should navigate to this form from our main WEBSITE, not through salesforce.

How can I achieve that? 
Hi there,

I have two custom objects. The Investigation__c is the parent object, and the Time_Entry_Recap_Report__c is the child object. What I want to have happen is when the parent record (Investigation) is initially created, I want to create an initial entry in the 'Time_Entry_Recap_Report__c' with 15 minutes of time worked and a description of the task being 'Opened new investigation'. I'm trying to figure out how to relate the Child record to the parent record when I create the entry in the trigger. The object 'Time_Entry_Recap_Report__c' is already defined as a child to the parent, but trying to insert the record without a reference to the 'Investigation_Time_Entry__c' field within the 'Time_Entry_Recap_Report__c' object didn't work either. The Error I am getting is "Error: Compile Error: Illegal assignment from Schema.SObjectField to Id at line 8 column 7. Any assistance would be greatly appreicated. 
trigger CreateTimeEntry on Investigation__c (after insert) {
    List<Time_Entry_Recap_Report__c> entryList = new List<Time_Entry_Recap_Report__c>();
    for(Investigation__c InvestigationObj : Trigger.new){
    Time_Entry_Recap_Report__c entry = new Time_Entry_Recap_Report__c();
      entry.Hours_Worked__c = '00';
      entry.Minutes_Worked__c = '15';
      entry.Work_Performed__c = 'Opened new investigation';
      entry.Investigation_Time_Entry__c = Investigation__c.NAME;
      entryList.add(entry);
     }
     if(entryList.size()>0){
      upsert entryList;
     }
}