• Raj V
  • PRO
  • 2453 Points
  • Member since 2016

  • Chatter
    Feed
  • 80
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 712
    Replies
Is there a way to remove commas from a text field using a custom field or a process?
For example if a field has the value "this is a test, okay." I want a new field to duplicate that without the comma. New value would be
"this is a test okay."
I am currently on a VisualForce course by Matt Lacey and having trouble with the Apex code for DataList / PageBlockTable. 
Though my apex code does not show any errors the page does not display any records. Any help/direction would be appreciated.

Here is the Code
=============

<apex:page standardController="Account" recordSetVar="accounts">
    <apex:pageBlock title="Account List">
        <apex:pageBlockTable value="{!accounts}" var="acct">
            <apex:column >
                <apex:outputField value="{!acct.Name}"/>
            </apex:column>
            <apex:column >
                <apex:outputField value="{!acct.Rating}"/>
            </apex:column>
        </apex:pageBlockTable>    
    </apex:pageBlock>
</apex:page>




Any idea what I may be doing wrong?  
Or is there a setup needed to display this data? 


Regards
Pallavi
Hi All!
I needed some assistance creating a simple validation rule, where if Campaign stage = Opportunity Created do not allow record to be saved without an opportunity link.

Thanks!
I cannot deploy version 3.156 of my managed package.  I am able to deploy a lower version (3.155) and then deploy 3.156 without issue.  When I deploy the most updated version I get the following error.

1. Dependent class is invalid and needs recompilation:
Class NameSpace.tLP_EmailNotificationList_Functions :
AND DISTANCE(NameSpace__Geolocation__c, GEOLOCATION(:lat
^
ERROR at Row:2:Column:45
No such column 'NameSpace__Geolocation__c' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
tLP_EmailNotificationList_Trigger: Dependent class is invalid and needs recompilation:
Class NameSpace.tLP_EmailNotificationList_Functions :
AND DISTANCE(NameSpace__Geolocation__c, GEOLOCATION(:lat


However the field 'NameSpace__Geolocation__c' has existed in the managed package since the earliest version (1.4) so I know that the field exists. As well I was able to create this package and subsequent packages and all test cases have passed with sufficient code coverage. I can't understand why installing 3.155 and then 3.156 works without issue but installing 3.156 fails with the above error.

Has anyone else encountered this problem?  Did you find a work around?  This is causing us some pretty major difficulties.
We have a preview option in Visualforce to check our changes. Do we have the same in Lightning?
this is my test component but I couldnt see any preview option to check its behaviour.
Suggestions please.
Thanks
<aura:component>
<div class="white">
Hello, HTML!
</div>
<h2>Check out the style in this list.</h2>
<ul>
<li class="red">I'm red.</li>
<li class="blue">I'm blue.</li>
<li class="green">I'm green.</li>
</ul>
</aura:component>
CSS source
.THIS {
background-color: grey;
}
.THIS.white {
background-color: white;
}
.THIS .red {
background-color: red;
}
.THIS .blue {
background-color: blue;
}
.THIS .green {
background-color: green;
}

 
As described in the following article:
​https://developer.salesforce.com/forums/?id=906F0000000BPXxIAO
I make the suggested validation to finind out if the uploaded file is ".csv" or not. Therefore I'm using the suggested try/catch in my controller class 
blob docBlob = doc.body;
string blobString;
try
{
blobString = docBlob.toString();
}
catch(Exception e)
    {
        ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL,'Please upload a valid CSV document');
        ApexPages.addMessage(myMsg); 
        return ;   
    }

The try/catch is working for specific file formats such as:
".pdf" , ".xlsx", ".docx".

But when I try to upload files with the following file formats:
".log", ".eml", ".cls"
they become successfully uploaded in Salesforce, creating hundreds of records in Salesforce which is totaly wrong and inadmissable.

Please advise how to adjust the try/catch block in order to allow only ".csv" file formats to be uploaded?
 
I have a list of Accounts with IDs that just had an account owner change.  I need to find the ID's of all OPEN opportunities related (child) to that list of account ids and be able to expert both the account id and open opportunity id, Is this possible through the Developer Console or another tool?  I have Demand Tools also.
How do I query for the name of role and UserRole.Id for the org using Developer Console?
Need help writing a validation rule - TCV and ACV fields are REQUIRED for Stage = Solution Design, Proposal, Negotiate and Commit for two specific roles.  We have many validation rules on our opportunity object and want to make sure I am thinking of all the variables, plus my weak spots are validation and formulas.

I am trying to use the CASE Function, but I don't think I have it right.

AND((CASE(StageName ,
"Solution Design",1,
"Proposal",1,
"Negotiate",1,
"Commit",1,
0)
>
+1), $UserRole.Id <> "00eG0000001GdpN",
$UserRole.Id<>"00eG0000001Gil0", ISBLANK(TCV__c),ACV__c )
I am trying to get the value of the aura:attribute in the js controller.
<aura:component>
  
  <aura:attribute name="falseValue" type="boolean" default="false" />
  
  <ui:button label="Log Value"  press="{!c.logValue}"/>

<aura:component>
js function
({    
  logValue : function(component, event, helper) {
        console.log(v.falseValue);
    }
})
What would I do to get the value false returned from the aura attribute.

 
  • February 07, 2018
  • Like
  • 0
Hey guys,

It's my first time working with the Einstein API through the Trailhead "Einstein Intent API Basics""

I've built the Dataset, and now i'm generating a model by requesting a training to the https://api.einstein.ai/v2/language/train

But when I check the status of my Model creation, the Status is always QUEUED.

How long usually does it take to the model be complete?

Best,
Lucas.
Hello,

I am having trouble showing a wrapper variable in a pageblocktable that iterate over a list of wrapper class objects. The structure is as follow, I have a aLeadRatingResult wrapper class with a list variable of another wrapper class (BusinessInfo). I managed to create the table to iterate over the BusinessInfo list but I keep getting an error when trying to access the variables in it...

controller
public with sharing class LeadRatingResultsView {
        public Lead ld {get;set;}
        public LeadRatingResult leadResults {get;set;}
        public LeadRating_BusinessInfo[] leadBusinessInfo {get{return leadResults.BusinessInfo;}set;}

    public LeadRatingResulstsView(ApexPages.StandardController controller) {
        controller.addFields(new List<String> {'Rating_Result_JSON__c'});
        ld = (lead) controller.getRecord();
        leadResults = (LeadRatingResult)JSON.deserialize(ld.Rating_Result_JSON__c, LeadRatingResult.Class);
    }
}
VF page:
<apex:page standardController="Lead" extensions="LeadRatingResulstsView">
 <apex:detail inlineEdit="true" relatedList="false" />
 <apex:pageBlock >
     <apex:pageBlockTable id="pgblkTbl" value="{!leadBusinessInfo}" var="bi">
         <apex:column headerValue="Id" >
             <apex:outputText  value="{!bi.Id}"/>
         </apex:column>
         <apex:column value="{!bi.ABN}" headerValue="ABN" />
         <apex:column value="{!bi.RatingAccuracy}" headerValue="Rating Accuracy" />
     </apex:pageBlockTable>
 </apex:pageBlock>
</apex:page>

ANY IDEAS AS TO WHAT COULD BE CAUSING THE FOLLOWING ERROR MSG: pages/LeadRatingResultsView.page: Unknown property 'LeadRating_BusinessInfo.Id'

I am trying to display a select list from a custom controller, and i get a "Read only property 'productsTitle'" error when trying to save the visualforce page.

My custom controller:
 

public class BpmIcountPayment{

    private final Account account;

    public String productsTitle {
      get { return 'products for sale'; }
    }
 
    public BpmIcountPayment() {
        account = [SELECT Id, Name, Site FROM Account
                   WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
    }

    public Account getAccount() {
        return account;
    }

    public List<SelectOption> getProductsLov() {
        List<SelectOption> products = new List<SelectOption>();
        List<Product2> productsList = [SELECT Name, Family 
                                      FROM Product2 
                                      WHERE (Family = 'ShopProduct') 
                                      OR (Family = 'CourseParent') 
                                      OR (Family = 'SFCourseProgram')];

        for (Product2 currProduct : productsList) {
            products.add(new SelectOption(currProduct.Id, currProduct.Name));
        }

        return products;
    }
}

And my visualforce page:

<apex:page Controller="BpmIcountPayment">
    <apex:param name="first_name" value="Account.FirstName"/>
    <apex:param name="last_name" value="Account.LastName"/>
    <apex:param name="id" value="Account.idnumber__c"/>
    <apex:param name="address" value="Account.Address"/>
    <apex:form>
        <apex:selectList value="{!productsTitle}" multiselect="false">
            <apex:selectOptions value="{!ProductsLov}"></apex:selectOptions>
        </apex:selectList>
    </apex:form>
</apex:page>
Hi all,

I was searching for a possibility to send a yearly email reminder when the 1st. February in that year comes.
The only criteria to fire the email reminder is that so long it is the 1st. February in the year, the reminder has to be fired.

I tried to let a workflow rule or process to make this using a Date formula field, but this didn't work.

I was then thinking of implementing a batch apex job and schedule it to run every 1st February of every year. But this batch job should only send an email, nothing else.
When I see batch job codes, they all include: 
 
...
global database.querylocator start(Database.BatchableContext BC)
{
    return Database.getQueryLocator(query);
}

global void execute(Database.BatchableContext BC, Sobject[] scope)
...

and the sendEmail is then used in a Finish part of the code.
The point is, I just want to send an email. The batch code doesn't need to be executed for specific or all accounts. It is about sending a notification like "Please don't forget to configure this on the 1st February", nothing else.

Would be enough if I write this code?:
 
private void sendEmail(){

        Messaging.reserveSingleEmailCapacity(2);
        

        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        
        // Strings to hold the email addresses to which you are sending the email.
        String[] toAddresses = new String[] {[Select EmailAddress__c From CS_EmailAddresses__c Limit 1].EmailAddress__c};
          
        // Assign the addresses for the To and CC lists to the mail object.
        mail.setToAddresses(toAddresses);
        
        // Specify the address used when the recipients reply to the email. 
        mail.setReplyTo('mycompany@mydomain.com');
        
        // Specify the name used as the display name.
        mail.setSenderDisplayName('Salesforce Email Reminder');
        
        // Specify the subject line for your email address.
        mail.setSubject('Yearly Email Reminder');
        
        // Set to True if you want to BCC yourself on the email.
        mail.setBccSender(false);
        
        // Optionally append the salesforce.com email signature to the email.
        // The email address of the user executing the Apex Code will be used.
        mail.setUseSignature(false);
        
        // Specify the text content of the email.
        //mail.setPlainTextBody('Please configure this');
        
        mail.setHtmlBody('Your Invitee batch job has been processed.<br/><br/>Best Regards);
        
        // Send the email you have created.
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
    }
}

 
I have a requirement to automate SSN structure.
example:
user input SSN: 123456789
automate output SSN format: 123-45-6789
with my below logic am not able to achieve the scenario, anyone please help.
Component:
<lightning:input aura:id="SSN__c" name="SSN" 
           label="SSN" 
           maxlength="9" onblur="{!c.formatSSN}"                                          
           value="{!v.newCallerModel.Ssn}" />  
JS Controller 
formatSSN: function(component, helper, event)  {   
     var patt = new RegExp("\d{3}[\-]\d{2}[\-]\d{4}");
     var x = document.getElementById("SSN__c");
     var res = patt.test(x.value);
        if(!res){
            x.value = x.value
            .match(/\d*/g).join('')
            .match(/(\d{0,3})(\d{0,2})(\d{0,4})/).slice(1).join('-')
            .replace(/-*$/g, '');
        }
    },  
Hi,

I'm trying to make a call out to the User Interface API in order to get metadata information on picklist values based on record types. I'm using session ID authentication by passing in the session id in the authorization header. This is all done inside a function in a apex utility class. I have that function called by another Apex function which is @AuraEnabled. The lightning component calls this aura enabled function.
When I call both utility and aura enabled function from dev console, everything works fine and I was able to pull the metadata information that I need. But when the method is called from lightning component as I use the application, it throws the error:

{"message":"This session is not valid for use with the REST API","errorCode":"INVALID_SESSION_ID"}

I'm getting session Id using UserInfo.getSessionId() method. I'm unable to print it as it displays, SESSION_ID_REMOVED when I try. Here is the snippet of the call out:
private static HttpResponse callOut(String relativeURL) {
      Http http = new Http();
      HttpRequest request = new HttpRequest();
      HttpResponse response;
      

      String host = System.Url.getSalesforceBaseURL().toExternalForm();
      String url = host + relativeURL;
      // set the end point
      request.setEndpoint(url);
      // set GET/POST method
      request.setMethod('GET');
      String sessionId = UserInfo.getSessionId();
      system.debug('Session Id = '+sessionId);

      // set authorization header
      request.setHeader('Authorization', 'OAuth '+UserInfo.getSessionId());
      system.debug('User Id = '+UserInfo.getUserId());
      system.debug('Profile Id = '+UserInfo.getProfileId());
      system.debug('Username = '+UserInfo.getUserName()+'. '+UserInfo.getUserType());

      system.debug('request = '+request);
      try {
        response = http.send(request);
      } catch(System.Exception e) {
        System.debug('ERROR: '+e);
        throw e;
      }

      return response;
     }

Here is what all I tried:
1. Replace OAuth in request.setHeader('Authorization', 'OAuth '+UserInfo.getSessionId()); to 'Bearer'.
2. Checked the user profile which is the system administrator and have API Enabled checked. 
3. Cheked the profile -> Session Settings and see if 'Session Security Level Required at Login' is set to None. 

Any help on this is greatly appreciated. 
 
I'm trying to create a trigger to create a task everytime the field 'Call Results' is changed. This is what I have, but doesn't work. I am not a developer by any means. Copied this from another trigger and trying to make it work.

trigger NewCreateTask on Contact (after insert, after update) {
    List<Task> listOfTaskToBeInserted = new List<Task>();
    Task newtask;
    
    if(trigger.isInsert){
        for(Contact con : trigger.new){
            if(con.Call_Result__c == 'N/A' || con.Call_Result__c == 'Requested More Info' || con.Call_Result__c == 'Left voicemail' || con.Call_Result__c == 'No Answer or VM' || con.Call_Result__c == 'Not Interested' || con.Call_Result__c == 'Wants Call Back' || con.Call_Result__c == 'Set Meeting'){
                newtask = new Task();
                newtask.WhatId = con.AccountId;
                newtask.Subject = 'Task';
                newtask.whoId = con.id;
                newtask.ActivityDate = system.today();
                newTask.Status = 'Completed';
                {
                 listOfTaskToBeInserted.add(newTask);
               }
             }
          }
       }
      if(listOfTaskToBeInserted.size() > 0){
     upsert listOfTaskToBeInserted;  
  }
}
 
I have a controller class with the following method implementation:
public String buildTemplate(Task task) {

    Id taskId = task.Id;

    List<Task_History__c> listTaskHistory = [SELECT Field1, Id, Field2, Username__c, LastModifiedDate FROM Task_History__c WHERE Task_ID__c = :taskId];
    String pageHTMLContent = '<HTML><HEAD><STYLE>{! $Resource.Stylesheet }</STYLE></HEAD><BODY><TABLE class="css_class">';
    pageHTMLContent += '<TR><TH>Comment1</TH><TH>Comment2/TH><TH>Last Modified By</TH><TH>Last Modified Date</TH>';

    for(Task_History__c taskHistory :listTaskHistory) {
        String oldValue = taskHistory.Old_Value__c;
        String newValue = taskActivityHistory.New_Value__c;
        String userName = taskActivityHistory.Username__c;
        DateTime lastModifiedByDate = taskActivityHistory.LastModifiedDate;
        pageHTMLContent += '<TR>';
        pageHTMLContent += '<TD>' + oldValue + '</TD><TD>' + newValue + '</TD><TD>' + userName + '</TD><TD>' + lastModifiedByDate + '</TD>';
        pageHTMLContent += '</TR>';
    }

    pageHTMLContent += '</TABLE></BODY></HTML>';

    return pageHTMLContent;
}
I'd like to know how to include the contents of a static resource file in controller class?
In the Static Resource I have a file called "Stylesheet" with content:
table.css_class , .css_class th, .css_class td { border: 1px solid black; padding: 10px; } table.css_class th { text-align: center; }
Please advise how to include the contents of a static resource file in controller class?

 
Hey all, 

I am having an issue with my test class I have created. I am only getting 44% code coverage with my test class and I am not sure why. Any help would be greatly appreciated.

Apex Class:
public class AssignedAdvisorController {
    @AuraEnabled
    public static User getAssignedAdvisor(Id recordId){
       Account account = [select Assigned_Adviser__c from Account where Id=: recordId];
        User user = [select Name, Phone from User where Id=: account.Assigned_Adviser__c];
        return User; 
       }  
    
    @AuraEnabled
    public static String getAdvisorPhone(Id recordId){
        Account account = [select Assigned_Adviser__c from Account where Id=: recordId];
        User user = [select Phone from User where Id=: account.Assigned_Adviser__c];
        String advisorPhone = user.Phone;
        return advisorPhone;
        
       }
}

Test Class:
@isTest
private class AssignedAdvisorControllerTest{
  @testSetup
  static void setupTestData(){
    test.startTest();
    User user_Obj = new User(FirstName = 'Test', LastName = 'User');
    Account account_Obj = new Account(Name = 'Test User', Assigned_Adviser__c = user_Obj.id);
    Insert account_Obj; 
    test.stopTest();
  }
  static testMethod void test_getAssignedAdvisor(){
     test.startTest();
    List<Account> account_Obj  =  [SELECT Id,Name,Assigned_Adviser__c from Account];
    System.assertEquals(true,account_Obj.size()>0);
    AssignedAdvisorController obj01 = new AssignedAdvisorController();
    AssignedAdvisorController.getAssignedAdvisor('01p90000006uk2w');
      test.stopTest();
  }
  static testMethod void test_getAdvisorPhone(){
      test.startTest();
    List<Account> account_Obj  =  [SELECT Id,Name,Assigned_Adviser__c from Account];
    System.assertEquals(true,account_Obj.size()>0);
    AssignedAdvisorController obj01 = new AssignedAdvisorController();
    AssignedAdvisorController.getAdvisorPhone('01p90000006uk2w');
      test.stopTest();
  }
}



 
How to Delete 100000 leads at once with criteria of created by a particular user and on a particular date
Hi,

I imported my contacts to Salesforce and I received an email when I did that, so apparently it works. Also my storage says that I uploaded contacts. However, I can't find them - when I go to Contacs or Accounts, I can only see the example contacts/accounts that are set up by Salesforce. Does anyone know how I can solve that?

Thank you!
Hello,

I was going through a Project module and I wasn't getting the desired results, and then I've found out that in the code displayed in the article it was missing a piece:
https://www.screencast.com/t/F4D2I8mR54B

On this page: https://trailhead.salesforce.com/projects/quickstart-lightning-components/steps/quickstart-lightning-components5

 
My training request has only gone from queue position 14 to 12  in over 4 hours. Is that normal?  
I would like to auto-populate slashes(/) in the date field, am unable achieve with below code.
Example:
Option 1: when user move cursor into date field Slashes(/) should be constant like __/__/____(MM/DD/YYYY)
Option 2: validate user date format: User should enter Date with Slashes and specified format(MM/DD/YYY) else field should throw an error with invalid date format.
Lighting Component
<ui:inputDate aura:id="Birthdate" label="Date Of Birth" 
                                                  value="{!v.value}" 
                                                  displayDatePicker="false" blur="{!c.formatDoB}"
                                                  format="MM/dd/yyyy" />
JS Controller
formatDOB: function(component, helper, event) {
        var DOB = component.find("Birthdate");
        var Date = DoB.get('v.value');
        var s = (""+Date).replace(/\D/g, '');
        var m = s.match(/^(\d{2})(\d{2})(\d{4})$/);
        var formattedDoB = (!m) ? null : + m[1] + "/" + m[2] + "/" + m[3];
        DoB.set('v.value',formattedDoB);
    },

any one please help?
Thanks
Hello,
I have an apex Emthod which calls a VF Page as a PDF and inserts the PDF to a record. Right now it is working as long as I don't call any Contact info for use in the PDF. As you can see in the VF Page I am trying to access the First Name of the Contact. The Error Log below I started where it starts looking at the PDF, then through where the Fatal Error comes in. The VF Page and Apex, I put in some comments in line. I have a feeling running the Method as static void has something to do with the error? Any suggestions much appreciated!!
Thanks,
Ryan
Error Log:
13:02:11.430 (5727412584)|STATEMENT_EXECUTE|[95]
13:02:11.430 (5727438344)|HEAP_ALLOCATE|[95]|Bytes:16
13:02:11.430 (5727493424)|VARIABLE_SCOPE_BEGIN|[95]|pdfPage|System.PageReference|true|false
13:02:11.430 (5728228256)|VARIABLE_ASSIGNMENT|[95]|pdfPage|"/apex/contactpdf"|0x70a80652
13:02:11.430 (5728244984)|STATEMENT_EXECUTE|[96]
13:02:11.430 (5728274749)|SYSTEM_METHOD_ENTRY|[96]|System.PageReference.getParameters()
13:02:11.430 (5728318848)|HEAP_ALLOCATE|[96]|Bytes:0
13:02:11.430 (5728348187)|SYSTEM_METHOD_EXIT|[96]|System.PageReference.getParameters()
13:02:11.430 (5728361632)|HEAP_ALLOCATE|[96]|Bytes:2
13:02:11.430 (5728411478)|SYSTEM_METHOD_ENTRY|[96]|Map<String,String>.put(Object, Object)
13:02:11.430 (5728453867)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:-4
13:02:11.430 (5728478883)|SYSTEM_METHOD_EXIT|[96]|Map<String,String>.put(Object, Object)
13:02:11.430 (5728490327)|STATEMENT_EXECUTE|[97]
13:02:11.430 (5728519858)|VARIABLE_SCOPE_BEGIN|[97]|pdfBody|Blob|false|false
13:02:11.430 (5728539640)|VARIABLE_ASSIGNMENT|[97]|pdfBody|null
13:02:11.430 (5728561572)|METHOD_ENTRY|[99]||System.Test.isRunningTest()
13:02:11.430 (5728593511)|METHOD_EXIT|[99]||System.Test.isRunningTest()
13:02:11.430 (5728603950)|STATEMENT_EXECUTE|[101]
13:02:11.430 (5728606748)|STATEMENT_EXECUTE|[102]
13:02:11.430 (5728618628)|SYSTEM_METHOD_ENTRY|[102]|System.PageReference.getContentAsPDF()
13:02:11.430 (5797457576)|FATAL_ERROR|Internal Salesforce.com Error
VF Page:
<apex:page standardController="Contact" applyBodyTag="false" renderAs="pdf">
<!--CSS Styling Removed-->
        <html>
            <body>
                 <!-- Breaks when trying to pull Contact First Name. If I do not pull the first name Apex and VF Page run perfectly -->
                I, {!Contact.FirstName} acknowledge blah blah blah
Apex:
public class EchoSignRG{
    public ApexPages.StandardController Controller;
    public EchoSignRG(ApexPages.StandardController Controller){
        this.Controller = Controller;}
    @InvocableMethod
    public static void SendPDF(List<ID> conid){
        Lead L = [SELECT Id,Name,Street,City,State,PostalCode,ConvertedContactId,ConvertedOpportunityId,LeadSource,ConvertedAccountId FROM Lead WHERE Id =: conid];
        Contact con1 = [SELECT Id,AccountId,email,Firstname,lastname FROM Contact WHERE Id =: L.ConvertedContactId];
//SOME OTHER CODE HERE
            pageReference pdfPage = Page.ContactPDF;
            pdfPage.getParameters().put('id',con1.Id);
            blob pdfBody;
            if(Test.isRunningTest()){
                pdfBody = blob.valueOf('Unit.Test');
            }else{
                pdfBody = pdfPage.getContentAsPDF();}
//Fatal Error LINE ABOVE
            attachment pdfFile = new attachment();
            pdfFile.isPrivate = false;
            pdfFile.body      = pdfBody;
            pdfFile.parentId  = agreementRec1.id;
            pdfFile.Name      = agreementRec1.Name+'.pdf';
            
            insert pdfFile;



 
Hello,
I was stupid and edited a process builder flow in visual flow which of course means that I can no longer see the flow in either. I tried using workbench to see the flow and its versions so I can at least make it inactive (since it is stopping all my other flows from running) but it doesn't show up. All my other flows are there but that one is missing. When I use Rest Explorer, I can find the active version of the flow since I have the id but I don't know the ids for the inactive versions so I can't delete anything or deactivate anything.

Can someone please tell me how I can either deactive an active version through Rest Explorer or how to find the ids of the inactive versions of the flow when it won't show up in workbench metadeta?

Thanks.
  • February 16, 2018
  • Like
  • 0

Hi,
I need to run some verifications in trigger "before update" against a remote API and perform future actions based on its response . I found that Apex class function cannot return any response due to synchronous / asynchronous issues between triggers and HttpResponse. Is there any way to go around?

Is there a way to embed a regular dashboard in our custom lightning component ?

As of now the only way to add dashboard is to create a new lighting app and drag the dashboard component to the widget and then manually select the dashboard which we want to display on the lightning app. 

I want to add the same dashboard by using the dashboard id in my custom lightning component. You can't use iframe because the dashboard exist in same domain and hence we get 'same-origin policy' error. Any ideas ?. 
Hello, 

I am having trouble getting my test class to work with my after update trigger. When I run my test it is showing 0% code coverage. Can anyone help me to understand why it is not working?

Here is the trigger code:
trigger FUS_UGGR_Application_Submitted on TargetX_SRMb__Application__c (After Update) {
	
    For (TargetX_SRMb__Application__c A : Trigger.New) {
    
    //Update Submitted Application Contact record to "Applicant"
    String ContactId = Trigger.newMap.get(A.ID).TargetX_SRMb__Contact__c;
    String New_Stage = Trigger.newMap.get(A.ID).TargetX_SRMb__Stage__c;
    String Old_Stage = Trigger.oldMap.get(A.ID).TargetX_SRMb__Stage__c;
    String App_Type = Trigger.newMap.get(A.ID).TargetX_SRMb__Application_Type__c;
        
    Contact C = [select id from Contact where id = :contactid];
    
 	IF(New_Stage <> Old_Stage && New_Stage == 'Submitted' && App_Type <> 'Undergraduate Non-Degree Post Secondary'){
    C.UGGR_Student_Stage__c = 'Applicant';
               	
    Update C;
            
        }        
    }
}

Here is my test class:
@isTest
public class FUS_Test_UGGR_App_Submit {

   //Perform Tests
    static testMethod void ValidateUGGRAppSubmit() 
    {

    Contact c = new Contact(
        FirstName = 'Test', 
        LastName = 'Test'
    );
    Insert c;
   
    TargetX_SRMb__Application__c a = new TargetX_SRMb__Application__c(
        TargetX_SRMb__Contact__c = c.Id, 
        TargetX_SRMb__Application_Type__c = 'Undergraduate',
        TargetX_SRMb__Stage__c = 'In Progress'
    );
    
    Insert a;
    
    Test.StartTest();
    	a.TargetX_SRMb__Stage__c = 'Submitted';
    	Update a;
    Test.stopTest();
    }
}

 
(Encrpting with key "1234567890123456" it is getting encrpted):
Blob key = Blob.valueOf('1234567890123456');  //WITH 16BYTES
String myStringToEncrypt = 'This is my String....'
Blob myBlobData = Blob.valueOf(myStringToEncrypt)
Blob myEncryptedString = Crypto.encryptWithManagedIV('AES256', key, myBlobData)

(Encrpting with key "INDIA" it is  not getting encrpted)  :
SHOWING ERROR: 
 Invalid private key. Must be 16 bytes.

Blob key = Blob.valueOf('INDIA'); //
String myStringToEncrypt = 'This is my String....'
Blob myBlobData = Blob.valueOf(myStringToEncrypt)
Blob myEncryptedString = Crypto.encryptWithManagedIV('AES256', key, myBlobData)

/// I KNOW THAT IT SHOULD BE 16 BYTES REQUIRED
//////bt in .net application they used the key "INDIA" and encrpted with 'AES256'.. need samekey "INDIA"   in salesforce ...MAY I GET THE SOLUTION
global class AcrUpdateContact implements Database.Batchable<SObject>, Schedulable{
     public Database.QueryLocator start(Database.BatchableContext BC)
    {
        //String query = 'SELECT ContactId FROM AccountContactRole WHERE Role := Primary Contact';
        String query = 'Select Id, (SELECT ContactId,Role FROM AccountContactRoles WHERE Role =: Primary Contact) from Account WHERE Id IN(Select AccountID from AccountContactRole)';
      
        return Database.getQueryLocator(query);
    }
    public void execute(Database.BatchableContext BC, List<Contact> cont)
    {
        for(Contact c : cont)
        {
            c.Status__c = 'Open';
            system.debug(c);
        }
        update cont;
    }
    global void execute(SchedulableContext sc){
        //Database.executeBatch(this);
    }
    global void finish(Database.BatchableContext BC) {
        
    }
}
The goal is when an account contact role is set to Primary Contact, update the associated Contact's status field to open.  I know that account contact roles is very limited in that we can not trigger anything off of that object.  Was wondering if the code above is correct.
 
Hi,

My lightning component started throwing an "invalid record id" error after the Spring '18 upgrade.  It turns out that I was passing an 18-char id in the recordId attribute of lightning:recordViewForm.  When I made that a 15-char id, the error went away. 

Isn't Salesforce supposed to accept both 18-char ids and 15-char ids?

Thanks,

- Randy
  • February 15, 2018
  • Like
  • 0
Is there a way to remove commas from a text field using a custom field or a process?
For example if a field has the value "this is a test, okay." I want a new field to duplicate that without the comma. New value would be
"this is a test okay."
Hi,
I am building a custom lightning component to show a contact record based on its record id.
I want to also show the activity composer for that particular contact. Is it possible ?
If not, is it possible to show the event related list to that contact ?
  • February 14, 2018
  • Like
  • 0
Hi ,

Can any one help me with the below .

I try to update all te account description with value "Testing 2" in my batches. I tried to update account description by picking 10 10 Acounts, But its updating only first 10 set of records and skipping remainign records.

Can you pls guide me where am wrong.

public class first_batch2_withuser_query implements Database.Batchable<sObject>{

  public final  String Field;
  public final  String Query;
  public final  String Value;
        public first_batch2_withuser_query (String f, String q, String v){
    Field =f;    Query =q;   Value =v;
    }
     public Database.QueryLocator start(Database.BatchableContext BC){
    return Database.getQueryLocator(Query);
    }
       public void execute(Database.BatchableContext BC, List<Account> Scope){
    for (Account a: Scope){
    a.put(Field,Value);
        }
    update Scope;    
    }
public void finish(Database.BatchableContext BC){
}
}

I tried with below methods but not updating all the accounts in batches.

String f='Description';
String q= 'Select Description from Account limit 10';
String v='Testing 2';
ID batchinstanceID= Database.executeBatch(new first_batch2_withuser_query(f,q,v),5);

​String f='Description';
String q= 'Select Description from Account limit 10';
String v='Testing 2';
ID batchinstanceID= Database.executeBatch(new first_batch2_withuser_query(f,q,v));

String f='Description';
String q= 'Select Description from Account limit 10';
String v='Testing 2';
ID jobID= Database.executeBatch(new first_batch2_withuser_query(f,q,v));
I'm using my 4th playground, I am able to add conName="standard:account" for the first step but unable to create a New Apex Class...  The Apex class "SearchResultsController " is not a legal name."

Any suggestions on a work around?
Getting Below error, component is working fine but cant complete the challenge. Any help is appreciated.

Error- Challenge Not yet complete... here's what's wrong: 
The campingList component either does not have an attribute named 'newItem' or it is not defined correctly. It should default to a Camping_Item__c object with the price and quantity set to 0.

Below is the Markup for camping list:

<aura:component >
    <aura:attribute name="items" type="Camping_Item__c[]"/>    
    
    <aura:attribute name="newItem" type="Camping_Item__c"  
                    default="{'sobjectType':'Camping_Item__c',                              
                                  'Name':'',
                                   'Quantitiy__c':0,
                                  'Price__c':0,                                  
                                  'Packed__c':false }"/>
    
    
    
    <!--<ol>
        <li>Bear Repellant</li>
        <li>Bug Spray</li>
        <li>Goat Food</li>
    
    </ol>-->
    
    <lightning:layout >
        
        <fieldset class="slds-box slds-theme--default slds-container--small">
            
            <legend class="slds-text-heading--small">
                
                Add Camping
            
            </legend>
            
            <form class="slds-form-stacked">
                
                <lightning:input aura:id="campingform"
                                 label="Name"
                                 name="name"
                                 value="{!v.newItem.Name}"
                                 required="true"/>
                
                <lightning:input aura:id="campingform"
                                 type="number"
                                 label="Price"
                                name="price"
                                value="{!v.newItem.Price__c}"
                                min="0.1"
                                formatter="currency"
                                step=".01"
                                 messageWhenRangeUnderflow="Enter amount greater than $.10"/>              
                                
                <lightning:input aura:id="campingform"
                                label="Quantity"
                                name="quantity"
                                value="{!v.newItem.Quantity__c}"
                                min="1"
                                type="number" messageWhenRangeUnderflow="Enter minimuim 1 Quantity"/>
                                
                 <lightning:input aura:id="campingform" 
                                  label="Packed"
                                  name="packed"
                                  value="{!v.newItem.Packed__c}"
                                  type="checkbox"/>
                
                <lightning:button label="Create Camping Item" 
                              class="slds-m-top--medium"
                              variant="brand"
                              onclick="{!c.clickCreateItem }"/>
            
            </form>
        
        
        </fieldset>
    
    
    </lightning:layout>

    <lightning:card title="Camping Item">
        <p class="slds-p-horizontal--small">
            
            <aura:iteration items="{!v.items}" var="item">
                <c:campingListItem item="{!item}"/>
            </aura:iteration>
            
        </p>
     
     </lightning:card>   
    
</aura:component>
 
I have a requirement that ananymous user who doesn't requre login to access a page, fills the details, saves to an object (custom, and it has lookup field  to contact) . For this I have done the below steps
  • Added Domain
  • Created new Site
  • Assigned the created VF page in to the list 'Site Visualforce Pages'
  • Activated the site
  • Gave perrmissions (RWA) to the custom object
But when I click on the page I got the following error
Authorization Required

You must first log in or register before accessing this page.
If you have forgotten your password, click Forgot Password to reset it.
We should directly access to the page without authorize, how can we do this?
Thanks,