• Nehashri320
  • NEWBIE
  • 40 Points
  • Member since 2016

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 6
    Replies
Hello,

What does below code mean in Test class and what is the purpose?
System.assert(false);
thanks for suggestion
 
  • November 30, 2016
  • Like
  • 0
Hi,
I have written a lightning component and calling a flow from this. It works fine except there is one problem. I am able to pass the record id as a flow variable since that is the flow input variable but there is one more field inside the flow and the flow has a decision node based on that field. If i pass only the Id, the other field inside the flow doenst seem to get the field value even though the field from the same object.
If this is the case how can i pass other field value to the flow along with the id ?
Below are my component and controller: 
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
    <aura:attribute name="claim" type="Claim__c"/>
    <aura:attribute name="claimId" type="Id"/>
    <force:recordData aura:id="claimRecordLoader" recordId="{!v.recordId}" fields="Submit_to_TPA__c"
                      targetRecord="{!v.claim}" />
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
    <lightning:flow aura:id="flowData"/>
</aura:component>
 
({
    init : function (component) {
        // Find the component whose aura:id is "flowData"
        var flow = component.find("flowData");
        var inputVariables = [
            {
                name : "ClaimIdVar",
                type : "SObject",
                value : { "Id" : component.get("v.recordId")}
                //value : component.get("v.recordId")
            }
        ];
        // In that component, start your flow. Reference the flow's Unique Name.
        flow.startFlow("SubmitToTPA", inputVariables );
    },
    
})



 
Hi forum,
   I have an after insert trigger on Child object SAFETY_Brief and the parent object is Master_safe_brief.Whenever a safety_brief record is created, i would like to send email to an email field Assigned_email which is on Safety_brief and also the attachments present on the parent objetc Master_safe_brief of that safety_brief.
  Below is my code but i need help regardingemail.setToAddresses(sendTo); where its is supposed to iterate to each e=assigned email of differnt safe briefs  and send emails but its sending emails multiple times to the first safety brief inserted, and so on. I am also attaching the debug log for email queue.User-added image
public class SafetyBriefAttachment {
    public static void sendEmailAttachment(List<Safety_Brief__c> safeBrief){
        Set<Id> masterSafe = new Set<Id>();
        for(Safety_Brief__c sb : safeBrief){
            masterSafe.add(sb.Master_Safety_Brief__c);
        }
        Map<Id, Master_Safety_Brief__c> masterSafeBriefMap = new Map<Id, Master_Safety_Brief__c>();
        for(Master_Safety_Brief__c mastersafety : [select id,Name, Weekly_Topic__c, Publish_Date__c, Due_Date__c from Master_Safety_Brief__c where Id IN : masterSafe]){
            masterSafeBriefMap.put(mastersafety.id, mastersafety);
        }
        
        List<Messaging.SingleEmailMessage> emailList = new List<Messaging.SingleEmailMessage>();
        List<Messaging.SingleEmailMessage> dummyemailList = new List<Messaging.SingleEmailMessage>();
         Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();
        List<String> sendTo = new List<String>();
        List<Messaging.EmailFileAttachment> attachmentList = new List<Messaging.EmailFileAttachment>();
        //Query all the Parent Object Attachment and put into a MAP.
        Map<Id, List<Attachment>> parentAttacmentMap = new Map<Id, List<Attachment>>();
        for(Attachment att: [SELECT id, ParentId, Name, body, ContentType FROM Attachment WHERE ParentId IN :masterSafe ]){
            if(parentAttacmentMap.containsKey(att.ParentId)){
                parentAttacmentMap.get(att.ParentId).add(att);
            }else{
                parentAttacmentMap.put(att.ParentId, new List<Attachment>{att});
            }
        }

        for(Safety_Brief__c sb : safeBrief){
            if(sb.Assigned_Email__c != null){
               
                String Name = sb.Name;
                String subject = 'SAFE BRIEF';
                email.setSubject(subject);
                email.setHtmlBody('<html><head><img src="https://riskonnectrmk--c.na42.content.force.com/servlet/servlet.ImageServer?id=015F0000003wzGV&oid=00DF00000008OmQ" alt="logo" /></head>'+
                                  '<body style="font-family: arial; font-size: 12pt;"><p>Attached is this week\'s SAFE Brief.</p>'+'\n'+
                                  '<b>Weekly Topic:</b> '+masterSafeBriefMap.get(sb.Master_Safety_Brief__c).Weekly_Topic__c+', '+
                                  '<b>Publish Date:</b> '+masterSafeBriefMap.get(sb.Master_Safety_Brief__c).Publish_Date__c.day()+'/'+masterSafeBriefMap.get(sb.Master_Safety_Brief__c).Publish_Date__c.month()+'/'+masterSafeBriefMap.get(sb.Master_Safety_Brief__c).Publish_Date__c.year()+', '+
                                  '<b>Due Date: </b>'+masterSafeBriefMap.get(sb.Master_Safety_Brief__c).Due_Date__c.day()+'/'+masterSafeBriefMap.get(sb.Master_Safety_Brief__c).Due_Date__c.month()+'/'+masterSafeBriefMap.get(sb.Master_Safety_Brief__c).Due_Date__c.year() +'\n'+
                                 '<p>Click the link below to complete the SAFE Brief for this week in the GMM.:</p>'+ '\n'+
                                  '<P><u>'+ URL.getSalesforceBaseUrl().toExternalForm() +'/' + sb.id+ '</u></P></body></html>');
                
                sendTo.add(sb.Assigned_Email__c);
                
                email.setToAddresses(sendTo);
                System.debug('Email address :'+sendTo);
                // Traverse on Attachment on Parent Record and attach it in email. 
                for(Attachment att: parentAttacmentMap.get(sb.Master_Safety_Brief__c)){
                    Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
                    efa.setFileName(att.Name);
                    efa.setBody(att.Body);
                    efa.setContentType(att.ContentType);
                    efa.setInline(false);
                    attachmentList.add(efa);
                 }
                 if(attachmentList != null && attachmentList.size() >0)  
                     email.setFileAttachments(attachmentList);
                    //emailList.add(email);
                    Messaging.sendEmail(email);
            }
        }
        /*if(emailList != null && emailList.size() > 0)
            Messaging.sendEmail(emailList);*/
        System.debug('You have made '+Limits.getEmailInvocations()+'emails calls out of'+Limits.getLimitEmailInvocations()+ 'allowed');
        
    }
}

Thank you
Hi,
I have written a lightning component and calling a flow from this. It works fine except there is one problem. I am able to pass the record id as a flow variable since that is the flow input variable but there is one more field inside the flow and the flow has a decision node based on that field. If i pass only the Id, the other field inside the flow doenst seem to get the field value even though the field from the same object.
If this is the case how can i pass other field value to the flow along with the id ?
Below are my component and controller: 
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction" access="global" >
    <aura:attribute name="claim" type="Claim__c"/>
    <aura:attribute name="claimId" type="Id"/>
    <force:recordData aura:id="claimRecordLoader" recordId="{!v.recordId}" fields="Submit_to_TPA__c"
                      targetRecord="{!v.claim}" />
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
    <lightning:flow aura:id="flowData"/>
</aura:component>
 
({
    init : function (component) {
        // Find the component whose aura:id is "flowData"
        var flow = component.find("flowData");
        var inputVariables = [
            {
                name : "ClaimIdVar",
                type : "SObject",
                value : { "Id" : component.get("v.recordId")}
                //value : component.get("v.recordId")
            }
        ];
        // In that component, start your flow. Reference the flow's Unique Name.
        flow.startFlow("SubmitToTPA", inputVariables );
    },
    
})



 
Hello,

What does below code mean in Test class and what is the purpose?
System.assert(false);
thanks for suggestion
 
  • November 30, 2016
  • Like
  • 0
Hi,

I am create a new standard report of type 'Account with Account Team Member'. i want to add AccountAccessLevel, CaseAccessLevel, ContactAccessLevel fields in my report. But those fields are not available in reports. Is there any other way to show them?

Thanks
Vivek
I wonder if you can help.

I have created a flow with 2 variables CaseID and IncidentID
In the button URL I have added the CaseID so it will allocate to the caseID variable
and when the Incident is created it puts the recordID into the IncidentID variable
I then do an update on the case to set the IncidentID variable into the lookup field but it is not updating that field. Any Ideas?