• Aman Pathak
  • NEWBIE
  • 5 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 20
    Replies
Hi ,
Like Draw loop is there any Visualflow package(RunDDP in Drawloop).
In conga.So that we can use that in visualFlows.

Thanks,
Aman

hi I have a flow which convert lead (basically for screen with details of lead) for salesforce1 app.
this is working fine for desktop version but  for SF1 app it is not working, I am getting an opportunity Id after conversion.

VWFConvertLead is the pluging I am using in the flow .
things I have done:

  • Implemeted the flow using the plugin. 
    <apex:page standardController="lead" showQuickActionVfHeader="false" extensions="FlowLEadConvertExtension" lightningStylesheets="true">
        <script  type="text/javascript">
        function getopp(){
            var opIdgenerated ="{!opid}";
            console.log('opIdgenerated'+opIdgenerated);
            if( (typeof sforce != 'undefined') && sforce && (!!sforce.one) ) {
                 // Salesforce app navigation
                 sforce.one.navigateToSObject(opIdgenerated);
                 }
            else
                {
                    console.log('in else');
                }
                
            }
        </script>
        
        <apex:slds />
        <flow:interview name="SAMPLE_Lead_Convert_Flow" interview="{!myAutoFlow}"  buttonLocation="bottom" finishLocation="{!nextpage}">
                    <apex:param name="recordId" value="{!Lead.Id}"/>
           
                </flow:interview>
    </apex:page>

     
  • embedded the flow in the visualforce.
  • called the visualforce page from an actin
  • used pagerefernce to go to the created opportunity.
    public class FlowLEadConvertExtension {
    
        Public Flow.Interview.SAMPLE_Lead_Convert_Flow myAutoFlow { get; set; }
        Public FlowLEadConvertExtension(ApexPages.standardController controller) {}
       public static string opid{get;set;}
        Public String getmyID() {
            if (myAutoFlow==null)
                return '';
            Else
                opid=myAutoFlow.vaOpportunityId;
                return myAutoFlow.vaOpportunityId;
            }
      
        Public PageReference getNextPage(){     
        PageReference p = new PageReference('/' + getmyID() );
        p.setRedirect(true);
        return p;
        }
    }
Hi all,

I'm trying to create a validation rule for our phone numbers. Every number has 2 parts:

Country Code (numerical, 1 digit starts with '+') --> +1

Number (numerical, no digit limit, cannot start with 0)

Examples:

+12019841724

Thanks for help.
  • January 08, 2020
  • Like
  • 0
Apex class:
public class Auraopportunity {

    
    @AuraEnabled
    public static list<opportunity> getdata(){
        
      list<opportunity>lstopp =[select id, name, type, amount from opportunity limit 5];   
       return lstopp; 
    }
}

 Component:
<aura:component controller="Auraopportunity">
    <aura:attribute name ="opportunities" type="list"/>
    
    <aura:iteration items="{!v.opportunities}" var="a">
   
   <h1>{!a.id}</h1>
    </aura:iteration>
    
    <aura:handler name="init" value="{!this}" action="{!c.show}"/>
</aura:component>
Controller
({
	show : function(component, event, helper) {
		alert("Hello");
        
        var abc= component.get("c.getdata");
         console.log("Method is invoked");
        abc.setCallback(this,function(response){
             
          var state = response.getState();
             console.log(state);
            
            if(state === "SUCCESS"){
                
                var result = response.getReturnValue();
                console.log(result);
                alert(result);
                component.set("!v.opportunities",  result);
            }else{
                
                 console.log("Failed");
            }
        });
        $A.enqueueAction(abc);
        
	}
})

iam calling in the application :
 
<aura:application >
    <c:Auraoppiteration/>	
</aura:application>
it is not getting display, may i know  , im getting the timeout error itseems, ..
Thanks
Deepika
Hey guys anyone have idea about how can i show and hide my accordion row at a time using SLDS
here is my component and controller
<!--Attributes-->
            <aura:attribute name="showEditable" type="Boolean" default = "false"/>
            <aura:attribute name="showReadable" type="Boolean" default = "true"/>

    <aura:attribute name="accountList" type="Account[]"/>
        <aura:attribute name="isexpanded" type="Boolean"/>

    <!--handler-->
    <aura:handler name="init" value="{! this }" action="{! c.doInit }"/>

    
      <lightning:card title = "Account Accordian" variant = "narrow">
          <ul class="slds-accordion">
              <aura:iteration items="{!v.accountList}" var="account">
                      <div class="slds-page-header" style="cursor: pointer;" id="{!account.Id}"  data-record="{!idx}" onclick="{!c.expand}" >
                          <section class="slds-clearfix">
                              <div class="slds-float--left ">
                                
                                  <div class="slds-m-left--large">{! account.Name}</div>
                              </div>
                              </section>
                          </div>
                          <div class="slds-hide slds-p-around--medium"  id="{!account.Id}" aura:id="{!account.Id}">
                              Account details
                              <aura:if isTrue="{! v.showReadable}">
                                  <c:AccountDetailsComponent recordId="{! account.Id}"/>
                                  <lightning:button variant="brand" label="Edit" onclick="{! c.EditShow }" />
                              </aura:if>
                              <aura:if isTrue="{! v.showEditable}">
                                  <c:editableRecordLDS recordId="{! account.Id}"/>
                              </aura:if>
                          </div>
                      </aura:iteration>
                  </ul>
              </lightning:card>
</component>
 
({    
    
    expand : function(component,event) {
         var currentElementId = event.currentTarget.getAttribute("id");;  
        console.log("Element Id-> ",currentElementId);
        var acc = component.find(currentElementId.toString());
	  var acc1 = document.getElementById(currentElementId);
        console.log(JSON.stringify(acc));
        console.log(JSON.stringify(acc1));

           /* for(var cmp in acc1) {
        	$A.util.toggleClass(acc[cmp], 'slds-show');  
        	$A.util.toggleClass(acc[cmp], 'slds-hide');  
       }*/
             $A.util.toggleClass(acc1, 'slds-is-open');
       
	},    
    doInit : function(component, event, helper) {
        
        var action=component.get('c.getAccountList');
        
        
        action.setCallback(this,function(response){
            var state = response.getState();
            console.log('state ='+state);
            if (component.isValid() && state === "SUCCESS") {
               
                component.set("v.accountList", response.getReturnValue());
                console.log('v.accountList='+JSON.stringify(response.getReturnValue()));
              }
        });
    $A.enqueueAction(action);
        
    },
  EditShow : function(component, event, helper) {
  	component.set("v.showEditable","true");
        
      component.set("v.showReadable","false");

  },

 }
})

 
I have requirement where I have to replicate a javascript button for Lightning version. As we know, we cannot have Javascript button in Lightning. I'd like to have the same button in Lightning version. Below is the Javascript code for the button in Classic version.

Any help is appreciated!

Many Thanks!


{!REQUIRESCRIPT("/soap/ajax/39.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/39.0/apex.js")} 


if("{!$Profile.Name}" == "System Administrator") 


if (confirm("Are you sure you want to Create an Account in Oracle?") == true) 


var acctObj = new sforce.SObject("Account"); 
acctObj.Id = '{!Account.Id}'; 

acctObj.Create_Account_in_Oracle__c = true; 

var result = sforce.connection.update([acctObj]); 

if (result[0].success=='false') 

alert(result[0].errors.message); 

else 

alert("Account Creation Process has been submitted to Oracle"); 
window.parent.location.href="/{!Account.Id}"; 



}
Hello Everyone,
I am working on one of the requirment where I am uploading files into salesforce and sending it to external server . While I cross verify in external server , I am able to open only text fomrat other than .txt none other format is opening and (point-2) another thing is if file size is more than 5 MB it is faling to send to external server . Need help if someone has ever faced similer challage.
Thanks.
Hi, 

 I want to write a login in class. Have a custom object with name Popup_Message__c it has two date fields. Start_Date__c and End_Date__c 

 Below is the code I have writen I want to display the rows when Start date <= today and do not display the message when end date is set 

 Example if Start date = 1-May-2019 it must dispaly the message. 
  if End date is  10-May-2019 it must not display the message 

How to add this condition in soql please suggest. 
public class PopupMessageController {
 @AuraEnabled
 public static list <Popup_Message__c> fetchMessage() {
   String profileName = [SELECT Name FROM Profile WHERE Id = :UserInfo.getProfileId() LIMIT 1].name;
  
 List<Popup_Message__c> lstOfMsg = [SELECT Message_Text__c, Start_Date__c, End_Date__c, Active_Status__c, Ordering__c, Profile__c FROM Popup_Message__c WHERE Active_Status__c = 'Active' and ( Profile__c = :profileName or Profile__c = null ) and Start_Date__c <= TODAY  Order by Ordering__c];  
   
  return lstOfMsg;
 }
}
Thanks
Sud
 
  • May 02, 2019
  • Like
  • 0
Onclick of button, it should update the owner field in opportunity and then show a toast message for user. This is what i have in my helper class.
Hi There, I am very new to this and am setting up an apex rest api to where I want to check the data from our 3rd party database against a custom object and match it based on an email address to a lead and either update the matched lead, or if there is no match create the lead.

Can someone help me out with what that would look like?
Hi All,

Please guide me in writting Test code for below code:

Code :

global class userSignoutScheduler implements Schedulable {
    //List<Business_Hours_Reference_Setup__mdt> businessHoursMDList = new List<Business_Hours_Reference_Setup__mdt>();
    List<String> timeZoneKeyList = new List<string>();
    global void execute(SchedulableContext SC) {
        List<User_Availability__c> userAvailList = new List<User_Availability__c>();
        for(Business_Hours_Reference_Setup__mdt bHRefList: [Select id, Business_Hours_Id__c, Timezone_Key__c from Business_Hours_Reference_Setup__mdt where Record_Type__c='User']){
            if(BusinessHours.isWithin(bHRefList.Business_Hours_Id__c, system.now())) {
                timeZoneKeyList.add(bHRefList.Timezone_Key__c);
            }
        }
        
        if(timeZoneKeyList.size()>0){
            for(User_Availability__c userAvailRec: [Select id, User__c, LD_Availability_User__c from User_Availability__c where LD_Availability_User__c=TRUE AND User__r.timezonesidkey in :timeZoneKeyList]){
                userAvailRec.LD_Availability_User__c=FALSE;
                userAvailList.add(userAvailRec);
            }
        }
        
        if(userAVailList.size()>0)
            update userAvailList;
    }    
    
}
trigger updateLeadTest on Lead (before insert) {

     //create a map to hold emails/lead                          
    Map<String, Lead> leadMap = new Map<String, Lead>();
    Lead lead2 = new lead();

    for (Lead Lead : System.Trigger.new) {
        
        // Make sure we don't treat an email address that  
        // isn't changing during an update as a duplicate.  
        if ((Lead.Email != null) && (System.Trigger.isInsert || (Lead.Email != System.Trigger.oldMap.get(Lead.Id).Email))) {
        
            // Make sure another new Contact isn't also a duplicate  
    
            if (leadMap.containsKey(Lead.Email)) {
                Lead.Email.addError('Another new lead has the '+ 'same email address.');
            } else {
                leadMap.put(Lead.Email, Lead);
            }
       }
    }

    //put new emails into set
    for(Lead l:Trigger.new){
      if(l.email != null)leadMap.put(l.email,l);
    }

    list<lead> deleteList = new list<lead>();//these are only new records (b)
    list<lead> updateList = new list<lead>();//these are only existing records (a)
    
    // Using a single database query, find all the Contacts in  
    
    // the database that have the same email address as any  
    
    // of the Contacts being inserted or updated.  
    
    for (Lead lead : [SELECT Email, Phone, Company FROM Lead WHERE Email IN :leadMap.KeySet()]) {
        lead2 = leadMap.get(lead.Email);
        if(lead2.email != null && lead2.email == lead.email && lead2.Company == lead.Company){

          // newLead.Email.addError('A Lead with this email address already exists.');
          lead b = new lead();
          b = leadMap.get(lead.email);
             

          // if(lead2.Email == lead.Email){
            
               
              //lets update lead2 with some items from Lead
              //Always update the phone number from Lead if it is not null

              if(b.Phone != null)lead.Phone  = b.Phone;
                
              //update the email from b --> a ONLY if a is null and b is not, so not overwrite a
          
              //now, add a to the list to be updated with new values.
              updatelist.add(lead);
              
               [Select Id From Company__c Where Id IN :Trigger.new];
              //now, lets get rid of B
              deleteList.add(b);
            
         // }
       }else{
           
       }

  }
  if(deleteList.size() > 0){
      delete deleteList;
  }
  if(updatelist.size() > 0){
    update updateList;
 }
}

I am trying to update a lead if the email address already exists. This trigger updates the old record but I need to delete the newly created record and it gives me the 'DML statement cannot operate on trigger.new or trigger.old site:developer.salesforce.com' error.

Any ideas?

 
Hi Team,

I need to make mandatory attachment Probability is 100 %, also Check box field(Invoiced__c) is true then attchment is mandatory.

I write the below trigger and it working fine. I don't how can i write the test class for that trigger.
 
trigger ClosedOpportunityTrigger on Opportunity (before update) {
    
    
    for(Opportunity o:Trigger.New) {
    if(o.Probability==100 && o.Invoiced__c == true)
    {
        
            
            Attachment a = new Attachment();
            try {
               a = [Select Id, Name from Attachment where ParentId =:o.Id];
            }
            catch(Exception e) {
               a = null;
            }
            
            if (a == null)
               o.addError('Add an attachment before you close the Opportunity');
        }
    }
   }
This my Test Class

@isTest
private class ClosedOpportuntyTriggerTest{
    
    static testmethod void methodOne(){
        
        /*contact objc = new contact();
        objc.Lastname = 'test';
        objc.Email ='umadevi.s@bookmyshow.com';
        insert objc;*/
        Opportunity objOpp = new Opportunity();
       objOpp.Name = 'test opp';
        objOpp.StageName = 'Payment Receiveed';
        objOpp.Probability = 80;
       // objOpp.Contact__c = objc.id;
        objOpp.CloseDate = system.today();
        objOpp.Booking_Ids__c ='12345';
        insert objOpp;
        
        blob attBlob;   
        
        attBlob = EncodingUtil.base64Decode('AA=='); // zero-length, null-terminated string
        
        Attachment objAttach = new Attachment();
        objAttach.OwnerId = UserInfo.getUserId();
        objAttach.Name = 'test.pdf';
        objAttach.ParentId = objOpp.Id; // the record the file is attached to
        objAttach.IsPrivate = true;
        objAttach.Body = attBlob;
        objAttach.ContentType = 'application/pdf';
        insert objAttach;
        
        objOpp.StageName = 'Payment Confirmation';
        objOpp.Probability = 100;
        objOpp.Invoiced__c = true;
        
        objOpp.Probability = 100;
        
        update objOpp;
        
    }
}
And i got Error Add one Product 
 
I tried the examples for application and component events from the documentation and made both of them lightning out app 

<aura:application  access="GLOBAL" extends="ltng:outApp">

When I run this compoents in a node.js app (in html) - $Lightning.createComponent("c:smContainer", {}, "lgtapp");  the component event fires/catches, but the application event does not fire ,the code that gets the event object is undefined in case of application events. 
var appEvent = $A.get("e.c:aeEvent");

Is this the expected behavior  because there is no parent container in case of a lighting  out app? is there a workaround to get the application events  working ? 


 
Challenge of Data Security, Controlling Access to Fields in the Developers Trailhead. I spent well over 2 hours on this exercise. It tells me at this time that the "The 'Account Rating' permission set did not have the appropriate field-level security for the Account object."

By now I have tred every combination of check marks and unchecks, and my work place is chaos. Can someone help me with this seemingly simple task?  

Thanks.