• Deepak Gulian
  • SMARTIE
  • 1610 Points
  • Member since 2014
  • Salesforce Lightning Developer
  • Trantor

  • Chatter
    Feed
  • 50
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 329
    Replies

This is the apex clas i need to deploy 

I dont know muth about apex code and i need help deploy

  1. Public class AutoConvertLeads
  2. {
  3.     @InvocableMethod
  4.     public static void LeadAssign(List<Id> LeadIds)
  5.     {
  6.             Database.LeadConvert Leadconvert = new Database.LeadConvert();
  7.             Leadconvert.setLeadId(LeadIds[0]);
  8.             LeadStatus Leads= [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
  9.             Leadconvert.setConvertedStatus(Leads.MasterLabel);
  10.             Leadconvert.setDoNotCreateOpportunity(TRUE); //Remove this line if you want to create an opportunity from Lead Conversion 
  11.             Database.LeadConvertResult Leadconverts = Database.convertLead(Leadconvert);
  12.             System.assert(Leadconverts.isSuccess());
  13.    }
  14. }
public static String getProjectNumber( String id ) {
List<Opportunity> values = new List<Opportunity>();
values =
// return
[SELECT Id, Name, (SELECT PricebookEntry.Product2.Serial_Number__c,
PricebookEntry.Product2.Stock_ID__c,
PricebookEntry.Product2.RecordType.Name
FROM OpportunityLineItems
where PricebookEntry.Product2.RecordType.Name = 'Service Body' )
FROM Opportunity WHERE Id = :id limit 1];
return values.PricebookEntry.Product2.Serial_Number__c;
}

Get error Variable does not exist: PricebookEntry

Here is the data:
PricebookEntry.Product2.Serial_Number__c             STETEST
PricebookEntry.Product2.Stock_ID__c                             PricebookEntry.Product2.RecordType.Name             Service Body
Hi All,

I have created the Single Page with Input text, Button & Output text field. The user enters some value in a text box after clicking on the button the output shows in below. But I am getting an error. Pls find the snippet code below
 
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    
 <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
   	<div class="row">
        <h2 class="header">Basic Input Text</h2>
        <lightning:input aura:id="text" name="input1" label="Enter some text" />
        <!-- Brand variant: Identifies the primary action in a group of buttons -->
    <lightning:button variant="brand" label="Brand action" title="Brand action" onclick="{! c.handleClick }" />
    </div>
    You entered: <ui:outputText aura:id="ou"/>	
    
</aura:component>

JS Controller:
 
({
    doInit  : function(component, event, helper) {
    
    
    
},
	handleClick  : function(component, event, helper) {
        var ip = component.find("text");
        var op = ip.get("v.value");
        alert(op);
        var ot = component.find("ou");
        	ot.set("v.value",op);
		
    
	}
    
    
})

Error:


Error

Pls help me on this.

Adv Thanks,
VSK98
  • July 16, 2018
  • Like
  • 0
Hello, 

I'm a beginner admin for a non-profit and am hoping I can get a little assist.

I have the following formula for a data validation check on a text field when a condition is met.
AND( ( Closed__c), ISBLANK( Partner_Impact_Details__c ), (npe01__SYSTEMIsIndividual__c = FALSE ))

The condition we check for is to see if our Active Parnter field (API name Close_C) is checked or not. If the Active Partner field is checked, we want this field to be required. So just making the field required doesn't work since we have many instances of our Accounts where we don't want to force the Sales team to make an entry in the Partner Impact Score field.

When I try this formula for a picklist customized field called "Parter Impact Score", I get an error message that the formula doesn't work for picklist fields. I haven't been able to figure out how to devise a formula that if the Active Partner field is true, then require this picklist field.

This formula doens't work:
AND( ( Closed__c), ISBLANK( Partner_Impact_Score__c ), (npe01__SYSTEMIsIndividual__c = FALSE ))

 
Hey All, 

I have embedded a VF page into the home screen that allows our sales users to inline edit their opportunities.  However, when they click on the opportunity name, it opens the opportunity in the embedded window and I would like it to open it up in a new tab.  The code is below, can I get some assistance on how to do this? 

Appreciate all the help!
 
<apex:page standardController="Opportunity" recordSetVar="opportunities" 
              tabStyle="Opportunity"
    sidebar="false">
    <apex:form >
        <apex:pageBlock >
            <apex:pageMessages />
            <apex:pageBlock >
                <apex:panelGrid columns="2">
                    <apex:outputLabel value="View:"/>
                    <apex:selectList value="{!filterId}" size="1">
                        <apex:actionSupport event="onchange" rerender="opp_table"/>
                        <apex:selectOptions value="{!listviewoptions}"/>
                    </apex:selectList>
                </apex:panelGrid>
            </apex:pageBlock>

            <apex:pageBlockButtons >
            <apex:commandLink value="Save" action="{!save}" target="_parent" styleClass="btn" style="text-decoration:none;padding:4px;">
            </apex:commandLink>
            </apex:pageBlockButtons>
            <apex:pageBlockTable value="{!opportunities}" var="opp" id="opp_table">
                <apex:column headerValue="Opportunity Name">
                <apex:outputLink value="https://ap2.salesforce.com/{!opp.Id}" id="theLink">{!opp.name}</apex:outputLink>
                </apex:column>
                    
                <apex:column headerValue="Stage">
                    <apex:inputField value="{!opp.stageName}"/>
                </apex:column>
                <apex:column headerValue="Sub Stage">
                    <apex:inputField value="{!opp.Deal_Desk_Sub_Stage__c}"/>
                </apex:column>
                <apex:column headerValue="Implementation Date">
                    <apex:inputField value="{!opp.Implementation_Kick_Off_Date__c}"/>
                </apex:column>
                <apex:column headerValue="Date of Demo">
                    <apex:inputField value="{!opp.Date_of_Demo__c}"/>
                </apex:column>
            </apex:pageBlockTable>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 
I am not looking for a Process Builder as I want to this update automatically and not wait until the Record is saved for this to be updated.  Here is what I ahve started with.  Any help would be greatly appreciated!

trigger <addaccount> on Opportunity (after insert,after update) {

for (Opportunity op : [select Account.Name from Contact.id])
I've developed a VisualForce page which I'm adding as a Salesforce homepage component. It all works fine. The only issue is that from a layout persepctive, there's not enough room vertically between one component and the next  and the content in my VF compoent (which are links) are not starting from the top of the component but lower down. Therefore it could be easy for the user to miss. I'm attaching screenshot of the compoentn and my VisualForce page code is below. If any additional coding is required to enhance, I would appreciate if someone can provide this for me as I'm a salseforce admin and don't know much of development language. You'll see that my first screenshot has the link Passwords:SouthAfrica at the bottom of the component. I'd like it further up to allow room t view additional links. My second screeshot (with the "sanctuary" link includes to links where you need to scroll down to view because there's not enough room on the component. The size of this component is too small if I can't fit at least 3 links without having to scroll. How can i make it so that we can enlarge it to fit three links?

<apex:page >
<style>
.linksWrap a {color:#1797c0; font-weight:bold; text-decoration:none;}
</style>

<div class="linksWrap">
   
      
        <apex:outputLink target="_blank" rendered="{!IF($User.Username == 'robrien@abercrombiekent.com', true, false)}" value="/005?setupid=ManageUsers&isUserEntityOverride=1&fcf=00BE0000003ly4M">Passwords: Active Users</apex:outputLink>
       <BR></BR>
        <apex:outputLink target="_blank" rendered="{!IF($User.Username == 'robrien@abercrombiekent.com', true, false)}" value="/005?setupid=ManageUsers&isUserEntityOverride=1&fcf=00BE0000004MnFD">Users' Time Zones</apex:outputLink>
      <BR></BR>
        <apex:outputLink target="_blank" rendered="{!IF($User.Username == 'robrien@abercrombiekent.com', true, false)}" value="https://abercrombiekentgroup.sharepoint.com/sites/DBA/Lists/TS%20%20IT%20Admins/AllItems.aspx">IT and Travel Studio TS Admins</apex:outputLink>
      
        <!-- this is here b/c this user is not a Local admin profile so wouldnt see the link if it was with the others in the outputpanel below where 2 conditions need to be meet Local admin and username -->
        
     <apex:outputPanel rendered="{!IF($Profile.Name == 'Source Market Local Admin', true, false)}">
         <apex:outputLink target="_blank" rendered="{!IF($User.Username == 'afadmin1@abercrombiekent.com', true, false)}" value="/005?setupid=ManageUsers&isUserEntityOverride=1&fcf=00B44000004O0Wy" >Passwords: European and Sanctuary</apex:outputLink>
      <BR></BR>
<apex:outputLink target="_blank" rendered="{!IF($User.Username == 'afadmin1@abercrombiekent.com', true, false)}" value="https://abercrombiekentgroup.sharepoint.com/sites/DBA/Lists/TS%20%20IT%20Admins/AllItems.aspx">IT and Travel Studio TS Admins</apex:outputLink>

      <BR></BR>
       
        
 </apex:outputPanel>    
        
        
                
<apex:outputPanel rendered="{!IF($Profile.Name == 'Source USA Non Retail Local Admin', true, false)}">
        <apex:outputLink target="_blank" rendered="{!IF($User.Username == 'lsayers@akdmc.com', true, false)}" value="/005?setupid=ManageUsers&isUserEntityOverride=1&fcf=00BE0000002uKbi">Passwords: USA Non Retail</apex:outputLink>
        <BR></BR>
      <apex:outputLink target="_blank" rendered="{!IF($User.Username == 'lsayers@akdmc.com', true, false)}"  value="https://abercrombiekentgroup.sharepoint.com/sites/DBA/Lists/TS%20%20IT%20Admins/AllItems.aspx">IT and Travel Studio TS Admins</apex:outputLink>
        
 </apex:outputPanel>   
 
 <apex:outputPanel rendered="{!IF($Profile.Name == 'Source USA Retail Local Admin', true, false)}">
       
        <apex:outputLink target="_blank" rendered="{!IF($User.Username == 'plangeloh@abercrombiekent.com', true, false)}" value="/005?setupid=ManageUsers&isUserEntityOverride=1&fcf=00BE0000002uKbn">Passwords: USA Retail</apex:outputLink>
        
        <apex:outputLink target="_blank" rendered="{!IF($User.Username == 'kaylward@abercrombiekent.com', true, false)}" value="/005?setupid=ManageUsers&isUserEntityOverride=1&fcf=00BE0000002uKbn">Passwords: USA Retail</apex:outputLink>
        
 </apex:outputPanel>   
 
 
 
 <apex:outputPanel rendered="{!IF($Profile.Name == 'DMC Local Admin', true, false)}">
        <apex:outputLink target="_blank" rendered="{!IF($User.Username == 'zsogoni@abercrombiekent.co.za', true, false)}" value="/005?setupid=ManageUsers&isUserEntityOverride=1&fcf=00BE0000003mw49">Passwords: Southern Africa</apex:outputLink>

 </apex:outputPanel>       
      
        
        <!--
        Here is a sample link broken down, copy this link and put it under the last link above and change the data to match.
        - [USERNAME OF USER] replace this with the username of the user you want to be able to see the link.
        - [LIST VIEW ID] replace this with the Id of the List view you want it to show.
          Remember that when you navigate to the Manage Users page, you will need to re-select the group you want from the picklist so it will show the ID of the listview
          at the end of the URL. Just copy everything after the &fcf= in the URL and that should be the Group ID) (after the last = sign)
        - [LINK TEXT] replace this with whatever text you want to show for the link.
        - target="_blank" means the link will open in a new tab or window

        <apex:outputLink target="_blank" rendered="{!IF($User.Username == '[USERNAME OF USER]', true, false)}" value="/005?setupid=ManageUsers&isUserEntityOverride=1&fcf=[LIST VIEW ID]">[LINK TEXT]</apex:outputLink>      
        -->
</div>
</apex:page>
User-added image

User-added image
I am wanting to create a custom button for the lead detail page that updates the owner to the user who clicked the button and passes a true value to a checkbox field.  have tried to hack together with no luck.
Trying to build a validation rule so sales rep cannot mark the Closed Date on Opp in the past.  Must be today or future

My error Condition formula 
AND (CloseDate < TODAY (), ISPICKVAL(StageName, "Closed Won), $User.ProfileId = "00ei0000001FT2k")

I check syntex and receive Error: Syntax error. Missing ')'    What am I overlooking?
I am trying to build two buttons that executes JavaScript.
The function of the first button is to remove multiple items below a related list.
The function of the second button is to update a field on multiple records below a related list.
The related list is a custom object that links Contacts with a Delivery custom object (many to many relationship)

The functionality of the first button, what I am trying to create, is to select multiple rows and press a button to delete the selected rows.
The code I am using is below
{!REQUIRESCRIPT('/soap/ajax/35.0/connection.js')}

var selectedDeelnemers = {!GETRECORDIDS(   $ObjectType.Deelnemer__c   )};
sforce.connection.deleteIds(selectedDeelnemers);
navigateToUrl (window.location.href);
However I get the following error: 
User-added image

The second button should update a checkmark field called "Aanwezig" on the selected records. However I get the same error for the second button with the following code:
 
{!REQUIRESCRIPT('/soap/ajax/35.0/connection.js')}

var selectedContactIds = {!GETRECORDIDS( $ObjectType.Deelnemer__c )};
var contactsForUpdate = [];

if (selectedContactIds[0] == null) {
    alert(“You must select at least one record”);
} else {
    for (var i = 0; i < selectedContactIds.length; i++) {
       var contact = new sforce.SObject(“Contact”);
       contact.Id = selectedContactIds[i];
       {!Deelnemer__c.Aanwezig__c} = true ;
       }
}

var saveResult = sforce.connection.update(contactsForUpdate);
location.reload(true);
What am I doing wrong here?
 
I have a developer edition and while beginning this module, I cannot get past the very first step. I am trying to activate Wave Analytics, however, it does not even appear for me when I search within setup.

Is there a known issue? Thanks for any help.

Brian

Hi, 
 
 In account we need to add a validtion on email domain field which is in email format eg. sudhir@gmail.com

 Field name is Email_Domain__c

 if any of the mail contains “gmail.com”, “hotmail.com”, “yahoo.com”, “gmx.de”, “googledomain.com”, “mail.ru”, “web.de”, “live.com”, “aol.com”, “gmx.net”, “yandex.ru”, “me.com”, “msn.com”, “comcast.com”, “hushmail.com”, “yahoo.de”, “hotmail.co.uk”, “lavabit.com”, “sbcglobal.net”, “safe-mail.net”, “ymail.com”, “yahoo.co.uk”

It should through message saying personal email cannot be entered.

Thanks
Sudhir

Hello,

I am having some trouble completing a section of the process automation module in the Developer's training. The section is Automating Processes with the Lightning Process Builder. Has anyone completed this? If so, can you tell me how you did it? I have tried many different variations to solve this but its not syncing and the error message is not of much help.

Thanks
I'm working on a trigger where i need to convert month name to integer value and i dont want to hard code like 'jan' = 1. Plz suggest.
I'm new to Salesforce and I'm having issues with a formula to calculate fees based on number of units. The current formula is simple and works.
if(Account.Units_NA__c>0,
if(Account.Units_NA__c>50,
46000+(Account.Units_NA__c-50)*200,46000),Null)
If the units are less than 50,  it is null, if they are greater than 50, it is 46000 plus 200 for each unit over 50 - otherwise display 46000.
There is new criteria - we have multiple specialties and one of them has a different fee calculation. I tried multiple times to add that criteria and calculation but I keep getting errors - to add a ) or remove a , but I just can't make it work. I think I've butchered it so much that it doesn't bear any resemblance to what it should look like. Any help will be greatly appreciated!
if(Account.Units_NA__c>0,
if(Account.Units_NA__c>50,
46000+(Account.Units_NA__c-50)*200,46000),Null)
or(if(ispickval( Account.Specialty_Branding_NA__c ,"Best"),
If(Account.Units_NA_c> 0,
If(Account.Units_NA_c > 200,
20000+(Account.Units_NA__c-200)*5,20000)))

 
I am wanting to create a validation rule that forces the date selected by a user to be a Monday.  Any suggestions?
Hello,
This is my code for the Creating and Editing Visualforce Pages Module:

User-added image


And here is the error I'm getting:

User-added image

Am I missing something or is the error checker off?

Thanks for any/all help!

Best,
jacob
I have one custom object and trigger for insert and inside trigger there is future call  and one batch class  doing insert on same object so to prevent recursion  how will i handle it out of box, no business logic.
Is there any way we can handle it from Out of box without writing any custom logic?
I have a list and list should Contain a certain document that has an ID 


    List<String> blst = new List<String>();
    

      System.debug('inside the empty folder to set up the proposal');
                c = [SELECT Id, Name, Body
                         from Document
                        Where Id =: FoId];  
                        System.debug('Adding one file to the PDF ');
                blst.add(EncodingUtil.base64Encode(c.Body)); 
        

my unit test its keep telling me the id is empty even tho I make sure FoID is assign

Unit test FoId= '123456';

how can I test that 
Hello, 

I believe that I have completed all of the requirements within the Create Object Relations Trail - BUT - when I "Check Challenge" - I receive the error message below. 

Error Message:
"Challenge Not yet complete... here's what's wrong: There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, User: id value of incorrect type: 00536000001A7k9AAC: [User__c]" 

Error Screen Shot:
User-added image
Additionally - below is a screen shot of the customer object I have created (i.e. Campsite Reservations). 

Please let me know and thanks in advance for the help!

Custom Object Screen Shot ("Campsite Reservations"):

User-added image
 

I was learning about the Lightning Data Service from this module over trailhead, I have implemented the same as suggested, during "Save a New Record" I was just trying to fetch a "recordId" of new record using the below line of code.

var recId = result.recordId;
alert(recId);

When I execute this code over Salesforce web, it simply returns 18 digit Record Id in the following format "a05############QAU", but If I execute the same over Salesforce1 Mobile app it returns me Record Id in this format "a05___#########AUQ".  As a result, I am not able to navigate to a newly created record in a mobile app.

I am not sure if this is a bug in Lightning or am I missing something to consider for Mobile App? Please suggest.

 

I need a solution for this Business Process.
1. User searches for an Opportunity. They would like to ask that this Opportunity (We call Opps Applications) be transfered to them (Requires a Manager Approval).
2. They click a Button called "Request Application Reassignment" (Lightning Action).
3. Lightniing Action calls a "Flow"
4. Flow opens a screen with two 92) fields.
4a. Application Reassignment Reason (Picklist. Already Created on the Object)
4b. Application Reassignment Comments (Open text field)
Both of these fields will need to update the Record with the data that the User entered in the Screen.
5. The Flow now updates the record (Oppty) and launches an Approval process (already created).
6. Flow stops.
The Approval Process locks the record and sends an email notification to the Manger that they need to approve or decline this request.
7. If they approve the request, the file is Unlocked, and the Manager will update the Application (Opportunity) Owner and update two (2) fields on the record.
8. The new Application (Opportunity) Owner now has access to complete the processing of the order.
This should be so simple but I keep getting an error with the Flow. Apparently the Flow is not Grabbing the record that the is being Requested to be Reassigned.
Help please??
Thank you,
Shawn

This is the apex clas i need to deploy 

I dont know muth about apex code and i need help deploy

  1. Public class AutoConvertLeads
  2. {
  3.     @InvocableMethod
  4.     public static void LeadAssign(List<Id> LeadIds)
  5.     {
  6.             Database.LeadConvert Leadconvert = new Database.LeadConvert();
  7.             Leadconvert.setLeadId(LeadIds[0]);
  8.             LeadStatus Leads= [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
  9.             Leadconvert.setConvertedStatus(Leads.MasterLabel);
  10.             Leadconvert.setDoNotCreateOpportunity(TRUE); //Remove this line if you want to create an opportunity from Lead Conversion 
  11.             Database.LeadConvertResult Leadconverts = Database.convertLead(Leadconvert);
  12.             System.assert(Leadconverts.isSuccess());
  13.    }
  14. }
is it possible to create table like below on the task description text area?

Task Visual force page
I need to grab a few fields from a custom account for my lightning componnet doInit method.  Currently I do about 4 apex calls and each returns a single field.  This approach is working fine.  But I would like the apex method to return the whole record .  this is not working
/////////////////////////////////////
@AuraEnabled
public static String getRoyaltyAccount(Id raId) {
        List<Royalty_Account__c> x = [Select r.Proposed_Email__c, r.Name, r.Id, r.Number__c, r.active__c From Royalty_Acct__c r where Id=:raId];
        String response = JSON.serialize(x);
        system.debug('### response '+response);
        return response; 
}
/////////////////////////////////////
10:08:31:014 USER_DEBUG [287]|DEBUG|### response [{"attributes":{"type":"Royalty_Acct__c","Name":"Al Hansen","Id":"a0t0v000001M","Number__c":"12345538836389","Email__c":"aa@aardvark.org","Phone_Type__c":"landline",
/////////////////////////////////////
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,lightning:actionOverride" access="global" 
                controller="RoyaltyServicesController_RR"> 
    <aura:attribute name="record" type="Object" 
    <aura:attribute name="simpleRecord" type="Object" />
    <aura:attribute name="recordError" type="String" 
    
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
    
    <div class="slds-clearfix">
        <div class="slds-float_right">
            <lightning:button label="Edit" variant="neutral" onclick="{!c.handleClick}"/>    
            <lightning:button label="Generate Cardless " aura:id="generateCardBtn" variant="neutral" onclick="{!c.generateCard1}" />
   
        </div>
    </div>
    
    <force:recordData aura:id="currentRecord"
                      recordId="{!v.recordId}"
                      targetRecord="{!v.simpleRecord}"
                      targetError="{!v.error}"
                      layoutType="FULL" 
                      recordUpdated="{!c.recordUpdated}" />

/////////////////////////////////////                      
doInit  : function(component, event, helper) {
        var action = component.get("c.getAcctRec");
        action.setParams({raId : component.get("v.recordId") });
        action.setCallback(this, function(a){
            var state = a.getState(); // get the response state
            if(state === 'SUCCESS') {
                var responseObj = JSON.parse(a.getReturnValue());
            component.set("v.simpleRecord",responseObj);
            /////////////NEXT LINE DOES NOT WORK /////////////////
        var pe = component.get("v.simpleRecord").fields.Proposed_Email__c.value; // uses RecordData
            }});
        $A.enqueueAction(action);
    } 
/////////////////////////////////////
here is what I see in Inspect on the responseObj
responseObj = "[{"attributes":{"type":"Royalty_Acct__c","Name":"Al ...

so the string is being returned into the controller I just need to know how to parse it to get the four fields
How to display the value of a checkbox from the AccountContact Relationship Object on the Account or Opportunity page?

I have created a checkbox on the Account Relationship object and would like to display the vaule of the checkbox on the Account page and the Opportunity. 

The checkbox on the Account/Rel Object is a formula. The formula is 
Contact.Account.Name = "a certain name"

I would like this to show on the account and opportunity.
 
public static String getProjectNumber( String id ) {
List<Opportunity> values = new List<Opportunity>();
values =
// return
[SELECT Id, Name, (SELECT PricebookEntry.Product2.Serial_Number__c,
PricebookEntry.Product2.Stock_ID__c,
PricebookEntry.Product2.RecordType.Name
FROM OpportunityLineItems
where PricebookEntry.Product2.RecordType.Name = 'Service Body' )
FROM Opportunity WHERE Id = :id limit 1];
return values.PricebookEntry.Product2.Serial_Number__c;
}

Get error Variable does not exist: PricebookEntry

Here is the data:
PricebookEntry.Product2.Serial_Number__c             STETEST
PricebookEntry.Product2.Stock_ID__c                             PricebookEntry.Product2.RecordType.Name             Service Body
Hi,
  
 In below code it converts list to a comma seprated value problem here it added comma at the end please suggest me how to remove the end comma 
Boolean chkcomma = false;

// a list of string, you wanna display

list<String> QtAprd = new list<string>{'A','B','C','D','E','F'};

// making a single string with comma seprated from above list

String commaSepratedList='';

for(String str : QtAprd)

{
 if (chkcomma)
     
 commaSepratedList += str + ',' ;
  chkcomma = true;
}

system.debug(commaSepratedList);

Thanks
Sudhir
I created a "contacted" custom field that will say yes or no if a call is more than/less than 2 minutes. However, this field is in the Activities since call duration is there and call duration was the basis of the formula field for "contacted." The challenge is I need to bring this "contacted" field under Lead details but I cannot create a custom field since it will have syntax error: check spelling because call duration is not a field in Lead. How can I achieve this? Any ideas? 
A lightning:recordForm component is showing old data.
The SF database definitely has fresher data, a SELECT confirms the server has newer data.
Destroying & re-creating the lightning:recordForm doesn't have an affect, it still shows old data. Refreshing the entire browser page does refresh the component.

On a high level there are two components. 
A parent accountManager that creates a child accountForm
The child accountForm contains the Lightning:recordForm and comms with an external server.
The child will detect when it needs to refresh and will emit an event, the parent handles the event by destroying the child and creates a new child.
This new child is the problem child, it keeps showing stale data. 

Any way to switch off caching, or refresh a recordForm component?

Parent Component
<!-- AccountManager.cmp -->
<aura:component controller='CRAccountGetService' 
                implements='flexipage:availableForRecordHome,force:hasRecordId,force:hasSObjectName' 
                access='global'>

    <!-- Attributes-->
    <aura:attribute name='recordId' type='string' default='{! v.recordId }' access='global' />
    <aura:attribute name='sObjectName' type='string' access='global' />

    <!-- Handlers -->
    <aura:handler name='init' value='{! this }' action='{! c.handleInit }' />
    <aura:handler name="refreshAccountForm" event="c:CRRefreshAccountForm" action='{! c.handleRefreshAccountForm }' />

    <!-- Screen -->
    <div>
      <!-- AccountForm dynamically injected here  -->
        {! v.body }
    </div>
</aura:component>

// AccountManagerController.js
({
    handleInit: function(component, event, helper) {
        helper.newAccountForm(component);
    },

    // handler for child component refresh event. Destroy & recreate account form component
    handleRefreshAccountForm: function(component, event, helper) {
        var eventMsg = event.getParam('message');
        helper.showToast('Account', eventMsg, 'error', 5000, 'sticky' );
        
        // destroy existing Account form child component
        var body = component.get("v.body");
        var arrayLength = body.length;
        for (var i = 0; i < arrayLength; i++) {
            body[i].destroy;
        }
        component.set('v.body',[]);

        // create new Account form child component
        var recId = component.get('v.recordId');
        $A.createComponent("c:AccountForm", { 'recordId': recId }, 
                            function (newAccountForm, status, errorMsg) {
                                if (status === "SUCCESS") {
                                    component.set("v.body", newAccountForm);
                                } else {
                                   // show error
                                }
                            });
    },
})

CHILD COMPONENT
<!-- AccountForm.cmp -->
<aura:component controller='CRAccountGetService' 
                implements='flexipage:availableForAllPageTypes, flexipage:availableForRecordHome, force:hasRecordId, force:hasSObjectName' 
                access='global' >

    <aura:handler name='init' value='{! this }' action='{! c.handleInit }' />

    <!-- Event to let parent (manager) know we need to be refreshed -->
    <aura:registerEvent name="refreshAccountForm" type="c:CRRefreshAccountForm" />
    <aura:attribute name='recordId' type='string' default='{! v.recordId }' access='global' />
    <aura:attribute name='mode' type='string' default='view' access='global' />

    <!-- Screen -->
    <lightning:messages />
    
    <lightning:recordForm 
        aura:id='accountForm' 
        objectApiName='Account'
        recordId='{! v.recordId }'
        layoutType='Full'
        columns='2'
        mode='{! v.mode }'
        onsuccess='{! c.handleSuccess }' 
    />
</aura:component>

// AccountFormController.js
({
    // After a successful save to SF database, call external service
    handleSuccess: function(component, event, helper) {
        helper.callExternalService(component, event, helper).then (
            // promise resolved: external server accepted data. SF database unchanged
            $A.getCallback(function () {
                helper.showToast('Account Save', 'All good', 'success', 1000);
            }),

            // promise rejected: external server rejected data and overwrote values in SF database, 
            // fire event so the Manager (the parent component) refreshes the form view
            $A.getCallback(function (message) { 
                var refreshMeEvent = component.getEvent("refreshAccountForm");
                refreshMeEvent.setParam("message", message);
                refreshMeEvent.fire();
            })
        );
    },
})
 
// AccountFormHelper.js
({
    callExternalService: function(component,event, helper) {
        return new Promise($A.getCallback(function(resolve, reject) {

            var externalService = component.get('c.callExternalService');
            externalService.setParams({
                'accountId': component.get('v.recordId')
            });

            externalService.setCallback(this, function(response) {
                if (response.getState() === "SUCCESS") {
                    var rspMsg = JSON.parse(response.getReturnValue());
                    if (rspMsg.success) {
                        resolve();
                    } else {
                        reject(rspMsg.message);
                    }
                } else {
                    reject('Controller failure:' + response.getState()); 
                }
            });
            $A.enqueueAction(externalService);
        }));
    },
})

 
Hi All,

I have created the Single Page with Input text, Button & Output text field. The user enters some value in a text box after clicking on the button the output shows in below. But I am getting an error. Pls find the snippet code below
 
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
    
 <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
   	<div class="row">
        <h2 class="header">Basic Input Text</h2>
        <lightning:input aura:id="text" name="input1" label="Enter some text" />
        <!-- Brand variant: Identifies the primary action in a group of buttons -->
    <lightning:button variant="brand" label="Brand action" title="Brand action" onclick="{! c.handleClick }" />
    </div>
    You entered: <ui:outputText aura:id="ou"/>	
    
</aura:component>

JS Controller:
 
({
    doInit  : function(component, event, helper) {
    
    
    
},
	handleClick  : function(component, event, helper) {
        var ip = component.find("text");
        var op = ip.get("v.value");
        alert(op);
        var ot = component.find("ou");
        	ot.set("v.value",op);
		
    
	}
    
    
})

Error:


Error

Pls help me on this.

Adv Thanks,
VSK98
  • July 16, 2018
  • Like
  • 0

I was learning about the Lightning Data Service from this module over trailhead, I have implemented the same as suggested, during "Save a New Record" I was just trying to fetch a "recordId" of new record using the below line of code.

var recId = result.recordId;
alert(recId);

When I execute this code over Salesforce web, it simply returns 18 digit Record Id in the following format "a05############QAU", but If I execute the same over Salesforce1 Mobile app it returns me Record Id in this format "a05___#########AUQ".  As a result, I am not able to navigate to a newly created record in a mobile app.

I am not sure if this is a bug in Lightning or am I missing something to consider for Mobile App? Please suggest.

 

Hi,
  We have developed .NET Application & included it in Call center CTI Adapter Url . All the things are working well, when the call comes its searches phone field in objects , get the results & open the record in new tab in Service cloud console with the ANI no.  With standard all the things are working as expected.

But the issue we want to open our Custom VF page when the call comes instead of standard one.So created VF page & controller & that page is poping up instead of standard one. Now the main problem is we are not getting ANI no. neither in VF page nor in Controller .
1 ) We tried get ANI no. in Apex controller via url, host url, current url etc...but nothing is working.
2) In Vf page we tried to get via including interaction.js file & using its methods , but those methods are not getting called on page load.

Has anyone face the same issue in using open CTI in salesforce?

 Can anyone please help me to fix this error.