• KCB
  • NEWBIE
  • 35 Points
  • Member since 2014
  • Salesforce Developer
  • IT America


  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 1
    Likes Given
  • 3
    Questions
  • 10
    Replies
In My Existing VF code I’ve related list "Notes&Attachments" tied to Account
  <apex:relatedList subject="{!account}" list="NotesAndAttachments"   />  

Now i want to replace with Files and Notes.
     <apex:relatedList subject="{!account}" list="AttachedContentDocuments"  />   
      <apex:relatedList subject="{!account}" list="AttachedContentNotes"  />

Issues is with Notes - I’ve to set the API version above 35 in order to identify AttachedContentNotes object. If i do that, I’ll lose access to existing Notes&Attachment on VF Page, since above 36 version are not supported to notes and attachment.

How can i display both Notes&Attachment and AttachedContentNotes ? or what will be an ideal solution, the reason i want Note&Attachments is it has all historical data and other integration ties

Please Suggest,
Thanks In Advance
  • October 27, 2016
  • Like
  • 1
Here is the relationship of an custom object (all are Lookup relations)
A--> B --> C
A--> D
Trying To Achieve, if a new record is created in "D" then "C" Custom field need to capture "D" latest record Name in a custom field (latest_D_Name__c)

I have written below code, I tested with Bulk data as well its working fine
But i want this to optimize as much as possible and make it simple. any suggestion will be helpful

Question in my mind always popping up, Why am getting Null when am trying to pull A.ID (C.B__r.A__c) through "1st For Loop" directly.
If i find a way to pull the A.id from "1st For Loop" , then i can get rid of "2nd For Loop" */
 
trigger C_CustomObjTrigger on C_CustomObj  (Before Update) {  
     set<ID> B_idset = new set<ID>();
     set<ID> A_idset = new set<ID>();
     // Getting Parent ID of Object C (1st For Loop)
     for(C_CustomObj C : Trigger.new){
          if(C.B_CustomObj != null)
             B_idset.add(C.B_CustomObj);
     }  
     // Getting Grand Parent ID (2nd For Loop)
     for(B_CustomObj B: [SELECT NAME,id,A_CustomObj FROM B_CustomObj where id in:B_idset]){
          if(B.A_CustomObj != null)
             A_idset.add(B.A_CustomObj);
     }  
    // pulling Childs list for Grand Parent  
     List<D_CustomObj> D = [Select id,name,Date__c,Value__c From D_CustomObj where A_CustomObj in: A_idset
                                          Order By Date__c Desc];
    If(Trigger.IsBefore) {  
    for(C_CustomObj C_Update: trigger.new){                                           
        if(C_Update.Approved__c == False){
           //Update the Decision Object :Latest D to be caluculated                                  
            if(D.size()>0){
                C_Update.latest_D_Name__c = D[0].Name;
            }                   
        }
   }        
 }

 
  • November 24, 2014
  • Like
  • 0
Would like to know the workflow performance Tuning, For example we can write multiple field updates in one workflow or we can write multiple workflows for each field updates, Complicated conditions can be provided in both the ways. But, this matters while execution therefore am curious to know best practice and impact on the Execution Context it will take for each work flow, And if there are any max out time if i create N number of workflows or 1 work flow with N number of field updates?

Thanks in Advance
  • November 13, 2014
  • Like
  • 0
In My Existing VF code I’ve related list "Notes&Attachments" tied to Account
  <apex:relatedList subject="{!account}" list="NotesAndAttachments"   />  

Now i want to replace with Files and Notes.
     <apex:relatedList subject="{!account}" list="AttachedContentDocuments"  />   
      <apex:relatedList subject="{!account}" list="AttachedContentNotes"  />

Issues is with Notes - I’ve to set the API version above 35 in order to identify AttachedContentNotes object. If i do that, I’ll lose access to existing Notes&Attachment on VF Page, since above 36 version are not supported to notes and attachment.

How can i display both Notes&Attachment and AttachedContentNotes ? or what will be an ideal solution, the reason i want Note&Attachments is it has all historical data and other integration ties

Please Suggest,
Thanks In Advance
  • October 27, 2016
  • Like
  • 1
In My Existing VF code I’ve related list "Notes&Attachments" tied to Account
  <apex:relatedList subject="{!account}" list="NotesAndAttachments"   />  

Now i want to replace with Files and Notes.
     <apex:relatedList subject="{!account}" list="AttachedContentDocuments"  />   
      <apex:relatedList subject="{!account}" list="AttachedContentNotes"  />

Issues is with Notes - I’ve to set the API version above 35 in order to identify AttachedContentNotes object. If i do that, I’ll lose access to existing Notes&Attachment on VF Page, since above 36 version are not supported to notes and attachment.

How can i display both Notes&Attachment and AttachedContentNotes ? or what will be an ideal solution, the reason i want Note&Attachments is it has all historical data and other integration ties

Please Suggest,
Thanks In Advance
  • October 27, 2016
  • Like
  • 1
I'm having trouble with one of the trailhead modules, Lightning Components Basics Input Data Using Forms https://developer.salesforce.com/trailhead/lex_dev_lc_basics/lex_dev_lc_basics_forms

In a previous module I set up the SLDS static resource and now in this module I'm asked to acess it and I'm not getting the custom styling that is supposed to be implimented. I copy-pasted the code exactly as it is shown in the module and only changed the name of the static resource.

expensesApp.app
<aura:application>
 
    <!-- Include the SLDS static resource (adjust to match package version) -->
    <ltng:require styles="{!$Resource.SLDS201 +
         '/assets/styles/salesforce-lightning-design-system-ltng.css'}"/>
 
    <!-- Add the "scoping" element to activate SLDS on components
         that we add inside it. -->
    <div class="slds">
       
        <!-- This component is the real "app" -->
        <c:expenses/>
       
    </div>
    <!-- / SLDS SCOPING DIV -->
 
</aura:application>
expenses.cmp
<aura:component>

    <!-- PAGE HEADER -->
    <div class="slds-page-header" role="banner">
      <div class="slds-grid">
        <div class="slds-col">
          <p class="slds-text-heading--label">Expenses</p>
          <h1 class="slds-text-heading--medium">My Expenses</h1>
        </div>
      </div>
    </div>
    <!-- / PAGE HEADER -->

    <!-- NEW EXPENSE FORM -->
    <div class="slds-col slds-col--padded slds-p-top--large">


        <!-- [[ expense form goes here ]] -->


    </div>
    <!-- / NEW EXPENSE FORM -->

</aura:component>

I've tried uninstalling and re-uploading the resource as well as changing the filepath but I can't seem to figure out how to acces this file.
Any help would be really appreciated.
 
Please help!  I am stuck on creating flows.  Can't seem to work.  I keep on re-doing my work and not sure if I am doing it right.  The challlenge as follows:

To pass this challenge you will need to create a flow that implements the business process of Account, Contact, and Opportunity data entry and place it on a Visualforce page.The Flow will need to be called 'New Customer Flow'.
The Flow should have a screen with fields for First Name, Last Name, Company Name, Opportunity Amount, and Opportunity Stage.
The Flow needs to have steps to create an account, a contact, and an opportunity from the data entered.
Opportunity name, close date and stage are required fields. Name the Opportunity '{Company Name} - {Last Name}', set the close date to one month from today and set the stage to 'Prospecting'.
The Flow should be invoked from a Visualforce page.
The Visualforce page should be called FlowPage.
The Visualforce page will need a component to reference the 'New Customer Flow' process.

If possible, if you can provide a snapshot.

Thank you.
Here is the relationship of an custom object (all are Lookup relations)
A--> B --> C
A--> D
Trying To Achieve, if a new record is created in "D" then "C" Custom field need to capture "D" latest record Name in a custom field (latest_D_Name__c)

I have written below code, I tested with Bulk data as well its working fine
But i want this to optimize as much as possible and make it simple. any suggestion will be helpful

Question in my mind always popping up, Why am getting Null when am trying to pull A.ID (C.B__r.A__c) through "1st For Loop" directly.
If i find a way to pull the A.id from "1st For Loop" , then i can get rid of "2nd For Loop" */
 
trigger C_CustomObjTrigger on C_CustomObj  (Before Update) {  
     set<ID> B_idset = new set<ID>();
     set<ID> A_idset = new set<ID>();
     // Getting Parent ID of Object C (1st For Loop)
     for(C_CustomObj C : Trigger.new){
          if(C.B_CustomObj != null)
             B_idset.add(C.B_CustomObj);
     }  
     // Getting Grand Parent ID (2nd For Loop)
     for(B_CustomObj B: [SELECT NAME,id,A_CustomObj FROM B_CustomObj where id in:B_idset]){
          if(B.A_CustomObj != null)
             A_idset.add(B.A_CustomObj);
     }  
    // pulling Childs list for Grand Parent  
     List<D_CustomObj> D = [Select id,name,Date__c,Value__c From D_CustomObj where A_CustomObj in: A_idset
                                          Order By Date__c Desc];
    If(Trigger.IsBefore) {  
    for(C_CustomObj C_Update: trigger.new){                                           
        if(C_Update.Approved__c == False){
           //Update the Decision Object :Latest D to be caluculated                                  
            if(D.size()>0){
                C_Update.latest_D_Name__c = D[0].Name;
            }                   
        }
   }        
 }

 
  • November 24, 2014
  • Like
  • 0
Sorry to repeat a question, but I'm still not understanding workflow triggers.

We have a set of workflow rules that update fields based on a date field.  For example, Account Status on the account object is updated based on the latest contract end date.  So if the contract end date is tomorrow, the account status is "Active" if the latest contract end date was yesterday, the account status is updated to "Inactive".  

The workflow isn't working.  It will not update the Account Status field unless someone makes and saves a change to an Account object.  This means that we have lots of Accounts where the contract has expired, but the Status still shows "Active".  If I go into a field, make a change, and save the change, THEN the workflow fires.  This isn't a good solution.  We want the field to update whether or not someone saves a change to the account.

Is this a job for Apex, or does an Apex trigger ALSO require an account to be created or updated to fire?
The following formula will calculate the number of working days (inclusive) between 2 dates. A working day is defined as Monday to Friday. Even if the start or end dates are a weekend, these are accommodated.

IF(AND((5 - (CASE(MOD( Start_Date__c - DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)) < (CASE(MOD(  End_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0)) ),
((( End_Date__c  -   Start_Date__c ) + 1) < 7)),
((CASE(MOD(  End_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0)) - (5 - (CASE(MOD(  Start_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)))),
(((FLOOR((( End_Date__c  -  Start_Date__c ) - (CASE(MOD(  Start_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 6, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0))) / 7)) * 5) +
(CASE(MOD(  Start_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 5, 2, 5, 3, 4, 4, 3, 5, 2, 6, 1, 0)) +
(CASE(MOD(  End_Date__c  - DATE(1900, 1, 6), 7), 0, 0, 1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 0))))


The Start Date and End Date fields are custom in the above example and can be replaced as required. If use of a DateTime field is required then the DATEVALUE function will be required.

I also recommend a simple field validation rule is added to check that the End Date is after the Start Date.
  • January 05, 2009
  • Like
  • 9