• 30 Points
  • Member since 2016

  • Chatter
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
  • 34

I want to translate Milestones of an Entitlement Process but I can't find it in the translation workbench. How can it be done?


I have 2 custom object with master detail relationship.
Monthly_Plan__c(Master) and Weekly-Plan__c(Child).

1.Monthly_Plan__c Object have Start_Date__c field
2.Weekly-Plan__c Object have Start_Date__c field and End_Date__c field 

For example : If I select Start_Date__c field of Monthly_Plan__c Object as 1/07/2018(1/july/2018) then my trigger should create 5 child records for the Weekly-Plan__c Object because July month have 5 weeks.

for example
My first record should be for first week of the month 
   Start_Date__c should be 1/07/2018
&  End_Date__c Should be 7/07/2018

My second record should be for Second week of the month 
   Start_Date__c should be 8/07/2018
​&  End_Date__c Should be 14/07/2018

and so on.

On a standard object layout when you inline edit a single field, all the fields displayed on the layout are updated. Could be possible that only the field(s) that have been modified are updated?
Consider this scenario:
  • You are using the Service Console
  • You have an Account open as primary tab
  • You have a Case related to the account, open as a sub tab
  • You close the case using the standard Close button
  • Upon the case closure, an apex trigger will update a field called Status on the account from value "OLD_VALUE" to "NEW_VALUE"
  • You go back to account primary tab, where the status field is still showing as "OLD_VALUE"
  • You inline edit ONLY the account description and Save
As a result, account Status value is again "OLD_VALUE". Saving the account record after an inline edit will override the Status field also (and all others present on layout).
hi all,

     I need to create a way to capture when the first response. I then need to measure how long time between when the Case was opened and       when it was first responded. 

I created two fields: 

I need to capture the first response and measure the time to first response in a trigger . 

First Response is defined as when the case owner user makes any edit to the case or logs an activity against the case. 

Time to First Response Calculation: 
I need to NOT include when office is closed (nights, weekends, holidays) in calculation. 
public class CaseUpdateResponseTriggerHelper {
    public static List<Case> newCases = new List<Case>();
    public static List<Case> oldCases = new List<Case>();
    public static Map<Id, Case> newMapCases = new Map<Id, Case>();
    public static Map<Id, Case> oldMapCases = new Map<Id, Case>();
    public static void updateFirstResponse(){
        List<Case> Cases = [SELECT id, First_Response__c, Time_to_First_Response__c FROM Case];
         datetime firstresponce;
    for(Case c: newCases){     
         if(c.createddate == oldMapCases.get(c.id).lastmodifieddate && c.First_Response__c == Null ) {
            decimal miliseconds = decimal.valueOf(system.now().getTime() - c.createddate.getTime());
            Integer seconds = integer.valueof(miliseconds / 1000);
            Integer Minutes = integer.valueof(seconds / 60);
            Integer Hours   = integer.valueof(Minutes / 60);
            Integer Days    = integer.valueof(Hours / 24);
            if(seconds >= 1 && Minutes <= 0){           
                c.First_Response__c =  datetime.valueof(seconds); 
            }else if(Minutes >= 1 && Hours <= 0){           
                c.First_Response__c =  datetime.valueof(Minutes) ;
            }else if(Hours >= 1 && Days <= 0){           
                c.First_Response__c =  datetime.valueof(Hours) ;
            }else if(Days >= 1)
                c.First_Response__c =  datetime.valueof(Days) ; 

}                    how to do it with business hours?
                    any suggestions?
please provide me solution with business hours
I have two metadata tables meta1, meta2 that have a Parent-child relationship labeled metarelate.
In meta2 the column Type__c is a Picklist.
Below are 2 different methods for querying the metadata tables.
Query 1
String metatype = 'type1';
for(meta1 m : [SELECT Persona__c, metarelate__r.Name__c   from meta1 
                                                            WHERE metarelate__r.Active__c = true 
                                                            and metarelate__r.Type__c = :metatype]){
       //does not loop through any rows.
but If I do this
Query 2
String metatype = 'type1';
for(meta1 m : [SELECT Persona__c, metarelate__r.Name__c, metarelate__r.Type__c   from meta1 
                                                            WHERE metarelate__r.Active__c = true]){ 
       if(m.metarelate__r.Type__c = metatype){
                //does loop through rows that have Type__c = 'type1'.
 The query has alot of records, so I want to do it the first way, to save on CPU Time. But it will only work the second way, which eats up CPU Time. Why is it that in Query1 the where Clause on Type__c Column is not working. FYI it's a picklist.
Can any give me community login and registration example with visualforce and apex.. I have checked many links but those are not working..Thanks in advance.

I created a custom object that is a child object to Opportunities called "Sales Credit". When the Opportunity Stage reaches "Pending Accounting Approval", a new Sales Credit record is created. However, on certain occasions (random) a sales credit is duplicated. How can I keep this from happening, as it is double counting revenue and skewing data and we have resulted to checking a report everyday and deleting the duplicates. 

The Recurrsion checkbox is unchecked and I have attempted to make this time dependent hoping that would help. 

User-added imageUser-added imageUser-added imageUser-added image
I have a requirement to connect Salesforce to GitHub for repository, development, and deployment.
I have installed eclipse and connected it with force.com ide and eGIT plugin. I have also created a workspace with production login and respective master copy in GitHub. now I want to create branches of it and connect them to different developer sandboxes.
Can anyone please help with the step by step process and tools need to do so.

We have an Apex Class "AYSFReportBatch" which should be scheduled under the user "AYSFIntegration" but the user has been changed which inadequate permissions which means the batch apex job is being abandoned. 
We are not sure how the user was changed, or why but would like to change it back to the original "AYSFReportBatch"  Apex Class. How might this be achievable?
Many thanks!

Hello All,

I am trying to send an email to owner of the record with an attachment from libraries. Here is the Sample code
set<id> ContentDocId = new set<id>();
list<ContentWorkspaceDoc> contentFiles = new list<ContentWorkspaceDoc>();
contentFiles = [ SELECT id, ContentDocument.Id,ContentDocument.CreatedDate,ContentDocument.LastModifiedDate,ContentDocument.IsDeleted,ContentDocument.SystemModstamp,ContentDocument.Title,ContentWorkspace.Name FROM ContentWorkspaceDoc where ContentDocument.Title in : selectedFiles ];
       for(ContentWorkspaceDoc content: contentFiles) 
        system.debug('------------------ ' + contentFiles);
        List <ContentVersion> allDocuments = new List <ContentVersion>();
allDocuments = [SELECT Id, Title, FileType, VersionData, isLatest, ContentDocumentId FROM ContentVersion where isLatest = true AND ContentDocumentId in:ContentDocId];
        attachments = new List<Messaging.EmailFileAttachment>{};
        email = new Messaging.singleEmailMessage();
     emailTemplate et = [select id, name, subject, body from emailTemplate where name ='Test Template'];
     email.toAddresses = new String[] { 'recordOwnerEmail' };       
    for (ContentVersion document: allDocuments) {      
     Messaging.EmailFileAttachment attachment = new                            Messaging.EmailFileAttachment();
      attachment.setFileAttachments(document); // this line causing the error
  // Error: Method does not exist or incorrect signature: void setFileAttachments(ContentVersion) from the type Messaging.EmailFileAttachment

I appreciate if you can help me.

Thank you!

I want to translate Milestones of an Entitlement Process but I can't find it in the translation workbench. How can it be done?

Hi Team,
Iam using javascript button on click custom button on lead object, when lead status is new need to redirect into a visualforce page with id. 
below code is working in classic 
var status = '{!Lead.Status}';
if (status != 'New') {
    alert('Please ensure this Lead is at the New Status prior generating the reservation form');
   window.open('/apex/Downloadaspdf?retURL={!Lead.Id}&id={!Lead.Id}&noopptt={!Lead.LastName&", "&Lead.FirstName}'); 
I have idea that javascript buttons will not work in lightning 
how can i move it into lightning  without using lightning component

any help :) 

Thanks for advance 

I have a custom button in a login flow that needs to navigate to an external website. Below is the code I have for the component and controller, but I think the button needs to redirect to a new tab and open the URL there (the button doesn't navigate the user anywhere). 

<aura:component implements="lightning:availableForFlowScreens" access="global">

    <lightning:button variant="brand" label="Find My Closer" title="Find My Closer" onclick="{! c.navigate }" />

    navigate  : function(component, event, helper) {
        var urlEvent = $A.get("e.force:navigateToURL");
            "url": 'https://www.google.com'
Any help is appreciated.
Thanks in advance!​
  • July 10, 2018
  • Like
  • 2