• Dhanik L Sahni
  • NEWBIE
  • 44 Points
  • Member since 2018
  • Conduent Business Service

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 34
    Replies
We are starting with new module on Lightning Web Compoent. Do we have any date when this will be rolled out in Prod orgs?
While trying to push code using SFDX. I am getting below error. Please help if any one faced this error.


WARNING: apiVersion configuration overridden at 44.0
PROJECT PATH ERROR
──────────── ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
N/A An object 'OrgComparer' of type LightningComponentBundle was named in package.xml, but was not found in zipped directory
02:26:12.128 sfdx force:source:push ended with exit code 1
We need to setup CI/CD for our salesforce development. We already have TFS for code versioning and using one VM we can do CI/CD also. In market there are other CI/CD tool also for salesforce like AutoRabit, Jenkin CI. We have to buy license for new tools. 

Can one suggest which tool i should in above scenerio? 
We have a lightning community portal with self registeration enabled.  Right now a single user can logged in multiple intances without issue. Is there any way to stop if he/she is already logged in Portal?
I am trying to create Customer portal User using Site.createExternalUser. But i am getting error "Your request cannot be processed at this time. The site administrator has been alerted." As per error i should get email for  reason, but i am not getting any email.

Please suggest.

HI team,

I have a requirement to export data into .csv from salesforce app.

We are using external API's to get the data from extrenal db and display it in table using LWC.

Now we want to exoprt the data showed in LWC to .csv file.

Can anyone help how can we achieve this using LWC and Apex.

Thank you.

In the code below a Visualforce was created to attach documents and photos in Salesforce in a customized way. However, when making the attachment, it is not returning the record id. Does anyone know why?

Visualforce Page in Case Object
<apex:page standardController="Case" tabStyle="Case" extensions="UploadAttachmentController">

 <apex:sectionHeader title="{!Case.CaseNumber}" subtitle="Attach File"/>
 
 <apex:form id="form_Upload">
 <apex:pageBlock >

 <apex:pageBlockButtons >
   <apex:commandButton action="{!back}" value="Back to {!Case.CaseNumber}"/>
   <apex:commandButton action="{!back}" value="Cancel"/>
 </apex:pageBlockButtons>
 <apex:pageMessages />
 
  <apex:pageBlockSection columns="1">
  
    <apex:pageBlockSectionItem >
      <apex:outputLabel value="File" for="file_File"/>
      <apex:inputFile id="file_File" value="{!fileBody}" filename="{!fileName}"/>
    </apex:pageBlockSectionItem>
  
    <apex:pageBlockSectionItem >
      <apex:outputLabel value="Type" for="type"/>
      <apex:selectList value="{!selectedType}" size="1" id="type"> 
        <apex:selectOption itemValue="Normal" itemLabel="Normal"/>
        <apex:selectOption itemValue="Jurídico" itemLabel="Jurídico"/>
      </apex:selectList>
    </apex:pageBlockSectionItem> 
    
    <apex:pageBlockSectionItem >
      <apex:outputLabel value="Description" for="description"/> 
      <apex:inputTextarea id="description" value="{!description}" rows="4" cols="50"/>
    </apex:pageBlockSectionItem>
    
    <apex:pageBlockSectionItem >
      <apex:outputLabel value="" for="uploadBtn"/> 
      <apex:commandButton id="uploadBtn" value="Attach File" action="{!processUpload}" />
    </apex:pageBlockSectionItem>    
    
  </apex:pageBlockSection>
 
 </apex:pageBlock>


 </apex:form>

</apex:page>

Controller in Case Object
 
public class UploadAttachmentController {
    
    public String selectedType {get;set;}
    public Boolean selectedAwesomeness {get;set;}
    public String description {get;set;}
    public Case caso{get;set;} 
    public String fileName {get;set;}
    public Blob fileBody {get;set;}
    
    public UploadAttachmentController(ApexPages.StandardController controller) { 
        this.caso = (Case)controller.getRecord();
        System.debug(this.caso);
    }   
    
    // creates a new Custom_Attachments__c record
    private Database.SaveResult saveCustomAttachment() {
        Custom_Attachments__c obj = new Custom_Attachments__c();
        obj.Case__c = caso.Id; 
        obj.description__c = description;
        obj.type__c = selectedType;
        // fill out cust obj fields
        return Database.insert(obj);
    }
    
    // create an actual Attachment record with the Contact_Attachment__c as parent
    private Database.SaveResult saveStandardAttachment(Id parentId) {
        Database.SaveResult result;
        
        Attachment attachment = new Attachment();
        attachment.body = this.fileBody;
        attachment.name = this.fileName;
        attachment.parentId = parentId;
        // inser the attahcment
        result = Database.insert(attachment);
        // reset the file for the view state
        fileBody = Blob.valueOf(' ');
        return result;
    }
    
    /**
    * Upload process is:
    *  1. Insert new Custom_Attachments__c record
    *  2. Insert new Attachment with the new Contact_Attachment__c record as parent
    *  3. Update the Custom_Attachments__c record with the ID of the new Attachment
    **/
    public PageReference processUpload() {
        try {
            Database.SaveResult customAttachmentResult = saveCustomAttachment();
        
            if (customAttachmentResult == null || !customAttachmentResult.isSuccess()) {
                ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 
                  'Could not save attachment.'));
                return null;
            }
        
            Database.SaveResult attachmentResult = saveStandardAttachment(customAttachmentResult.getId());
        
            if (attachmentResult == null || !attachmentResult.isSuccess()) {
                ApexPages.AddMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 
                  'Could not save attachment.'));            
                return null;
            } else {
                // update the custom attachment record with some attachment info
                Custom_Attachments__c customAttachment = [select id from Custom_Attachments__c where id = :customAttachmentResult.getId()];
                customAttachment.name = this.fileName;
                customAttachment.Attachment__c = attachmentResult.getId();
                update customAttachment;
            }
        
        } catch (Exception e) {
            ApexPages.AddMessages(e);
            return null;
        }
        
        return new PageReference('/'+caso.id);
    }
    
    public PageReference back() {
        return new PageReference('/'+caso.id);
    }     

}

Does anyone know how to solve the problem?
batchClass

global class BirthdayCard implements Database.Batchable<sObject> {
    
    global Database.QueryLocator start(Database.BatchableContext bc)
     {
        return Database.getQueryLocator([SELECT dateOfBirth__c,Id,Possible_Followup_Date__c FROM Lead WHERE dateOfBirth__c =  NEXT_N_DAYS:7 AND Possible_Followup_Date__c != null]);
    }
    global void execute(Database.BatchableContext bc, List<Task> scope)
    {
        for(Task l : scope)
        {
            Task B = new Task();
            B.Subject= 'Send Birthday Card';
            B.ActivityDate = date.today();
            B.OwnerId = l.OwnerId;
            B.WhoId=l.Id;
            
                   
       }
        insert scope;
    }
    global void finish(Database.BatchableContext bc){}
    
}

testClass:

@isTest
public class BirthdayCardTest{
    @isTest
    public static void BirthdayCard(){
        List<Lead> leadList = new List<Lead>();
        {
            Lead ld = new Lead();
            ld.lastname = 'test';
            ld.dateOfBirth__c = date.today().addDays(7);
            ld.Status = 'Unqualified';
            ld.State__c='Test';
            ld.Policy_DB_Amount__c=100000;
            ld.Company='Mirketa';
            ld.Possible_Followup_Date__c=date.today()
            
           leadList.add(ld);  
        }
        insert leadList;
        Test.startTest();
        Database.executeBatch(new BirthdayCard());
        Test.stopTest();
    }
}

 
Hello, My requirement is whenever we create a record in Salesforce, it should create an incident in external system populating salesforce fields I'm sending a post request to External webservice using REST API. I'm able to create an incident in external system and send salesforce record fields, how do i update an incident in external system because In trigger i have before insert and before update which creates a duplicate incident on update. I want to update the old incident with new values if there is any change in Salesforce record not create a new incident?
External system fields (Name and Incident group)
Salesforce fields( Multiple fields)
 
public class RadarUpdate {
@future (callout=true)
  public static void postcallout(string Id) {  
  Patient_Satisfaction__c c = [select id, Name,  Description_of_Feedback__c from Patient_Satisfaction__c where Patient_Relation__c ='Referred to Privacy Office' order by         createdDate desc limit 1];
    JSONGenerator gen = JSON.createGenerator(true);
    gen.writeStartObject();
    gen.writeObjectField('Name',c.Name);
    gen.writeObjectField('description',c.Description_of_Feedback__c);
    gen.writeObjectField('incident_group_id',7387);
    gen.writeEndObject();
    String jsonS = gen.getAsString(); 
    System.debug('jsonMaterials'+jsonS);
    Http http = new Http();
    HttpRequest request = new HttpRequest();
    request.setEndpoint('https://api.radarfirst.com/incidents');
    request.setMethod('POST');
    request.setHeader('Content-Type','application/json;charset=UTF-8');
    request.setHeader('User-agent', 'Salesforce-integration-client');
    request.setHeader('Authorization','Bearer  123');
    request.setBody(jsonS);
    // Set the body as a JSON object
    HttpResponse response = http.send(request);
    if (response.getStatusCode() != 201) {
    System.debug('The status code returned was not expected: ' +
        response.getStatusCode() + ' ' + response.getStatus());
    } else {
    System.debug(response.getBody());
    }
    }
}

 
Hi Every one  :  
I need to get the data from google fit app to salesforce , can any one help me
Hello everyone,how can i remove the cancel and save button that appear on inline edit in lightning web component datatable.
How we can get WhatsAPP Api key
Hi All,
I am generating  Pdf for Account object using lightning components.in that client side controller file it will through 
component.setParams() callback failed..i passed the accountId also but getting same error.can any one help me on this issue becuase i am new to lightning exp.
my code is
apex cls
public class TextVFPDFController {
    public Account acc{get;set;}
    public TextVFPDFController(){
        Id accId = apexpages.currentpage().getparameters().get('id');
        acc = [select id,Name from Account where id=: accId];
    }
}

vf page
<apex:page controller="TextVFPDFController" renderAs="PDF">
    {!acc.Name}
</apex:page>

component

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" controller="TestAppController" >
    <aura:attribute name = "accountId" type = "Account" />
    <lightning:button variant = "brand" label = "Generate Pdf" onclick = "{!c.savePDF}" />
</aura:component>

client-side controller.js

({
    savePDF : function(component, event, helper) {
        var action = component.get("c.savePDFAccount");
        action.setCallback(this, function(response) {
            component.setParams({"recordId" : component.get("v.accountId")});
            var state = response.getState();
            if (state === "SUCCESS") {
                component.set("v.recordId",response.getReturnValue());
                alert('Attachment saved successfully');
                              
            }        
               else {
                        console.log("Unknown error");
                    }
                
        });
        $A.enqueueAction(action);
    }
})

server-side controller.cls

public class TestAppController {
    @auraEnabled
    public static void savePDFAccount(String recordId){
        PageReference pdfPage = new PageReference('/apex/TextVFPDF');
        pdfPage.getParameters().put('Id',recordId);
        Blob pdfContent = pdfPage.getContent();
        Attachment attach1= new Attachment();
        //attach1.ParentId = parentId;
        attach1.Name = 'Test Attachment for PDF';
        attach1.Body = pdfContent;
        attach1.contentType = 'application/pdf';
        insert attach1;
        
    }
}

and the error is

Uncaught Error in $A.getCallback() [component.setParams is not a function]
Callback failed: apex://TestAppController/ACTION$savePDFAccount

can any one help this issue
thanks in advance
 
  • October 10, 2018
  • Like
  • 1
Hi All,
I am trying to create the pdf form for using  Quote/any object details in salesforce.for this i am using lightning components.I am new to the lightning components.can any one provide the lightning material to learn lightning components perfectly.can provide the some sample code to create the lighting components to generate the Pdf for Quote object.
thanks in advance
Hi,

What are the languages supported by Einstein chat bot? It looks like it is only English. Does it support Spanish?
Hi
Can I resize lightning:inputRichText like a textarea's resize option?
User-added image

 
Hi experts,

I would like to get all fields API names on specific page layout and use the fields in SOQL. Then I want to display the query results on Visualforce page.

I asked Salesforce Support for help but they cannot answer this question so I searched on Discussion Forums and found some articles about DescribeLayoutResult.
https://developer.salesforce.com/forums/?id=906F0000000AG13IAG

I read links for references but I'm just confused and not sure what to do.

Does anyone provide me simple but complete code to display field details on Visualforce page so that I can amend it for my use.
It would be nice if you can use Lead object and Name field.

Thank you in advance.


 
  • March 29, 2016
  • Like
  • 0
I have not been able to find any documentation regarding sharing OneDrive files using Apex. Does anyone have an example or a resource that they could give?

I would like to be able to use condition based triggers to attach particular files from particular folders from OneDrive to particular objects.

Thanks!

-Sean
Hello folks, 

Today we were trying to work on a utility that will list out all references to a field. This is intented to help the business to analyze a field before they plan to update/delete it. 

What we are trying to achieve?
- Once the user selects an object and one of its fields, we want to list out all possible components where the selected field is referenced. 

What were we able to achieve, using what?
- We first tried the Standard SOQL approach and queried objects such as ApexClass, ApexComponent, ApexPage and ApexTrigger : this helped us to find out references of a field in the code by scanning their body/markup. 
- We then thought of utilizing the Tooling API that has a SOSL feature, using which we were able to retreive all the codes where the field was referenced. 
Code snippet:
/services/data/v34.0/tooling/search/?q=FIND{BillingCity}

This gives me a list of all code where there is "BillingCity" referred. 

However, none of the approaches has helped us to touch other components such as:
- formula field
- report filters
- workflow field updates

Wanted to understand how do we get around this?
I know this is possible using Tooling API but then if I end up making one http callout for each component then I am going to make a lot of callouts. 
Is there something I am missing here? 
Need some guidance around this. 

Many thanks in advance!
We are looking at using Onedrive to store very large files/documents. Is there a way using files connect, we can upload files into Onedrive from salesforce?

Thanks.


Exception :
System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out*

**Visualforce Page**

    <apex:page controller="Controller" action="{!init}" showHeader="false" sidebar="false">
        <center>
            <apex:pageBlock title="Request Listener"></apex:pageBlock>         
        </center>
    </apex:page>
**Controller :**         


    PUBLIC with sharing class Controller
    {  
        PUBLIC String fromNumber      = ApexPages.currentPage().getParameters().get('From');
        PUBLIC String toNumber        = ApexPages.currentPage().getParameters().get('To');
        PUBLIC String body            = ApexPages.currentPage().getParameters().get('Body');  
        PUBLIC PageReference init()
        {          
            System.debug('From Phone Number :' +fromNumber);
            System.debug('To phone NUmber :' + toNumber);
            System.debug('Message Body :' + body);
                          
            TwilioRestClient Client = TwilioAPI.getDefaultClient();                                                  
                SYSTEM.DEBUG('FROM AND To  Number is NOT NULL');        
                String formattedNumber='+919876543210';   
                IF(body != NULL)
                    body = body;
                ELSE
                    body = '';
                Case c = NEW Case (Subject = formattedNumber,Description = body,Origin = 'Phone');
                INSERT c;                
               
                Map<String,String> params1 = new Map<String,String>
                {
                   'To'   => fromNumber,
                   'From' => '+1908280****',
                   'Body' => 'Conformation to customer'
                };
                TwilioMessage message = client.getAccount().getMessages().create(params1); /* Valid conformation SMS sent to the Customer.*/                                  
            return null ;
        }
    }
   

While login as admin then click preview on visualforce page executed but case is not created.I have checked the the debug log it throw the exception.

 

Can any body help me what are the differences between SOAP API and REST API..?

Hi,

 

I am developing an application in which on one of the pages i am going to capture an Image/picture using the Web Camera attached to the computer. I don't know how to do this can you please help me with this.

 

Thanks,

Akash Diwan