• sfdc98
  • NEWBIE
  • 105 Points
  • Member since 2021

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 14
    Replies
Hi there,
In this visualforce page there are two inputs and one button name as swap. How the swap the values in given two inputs from input-1 to input-2. Please provide suggestions

I tried the above code
VF code:-
<apex:page controller="Swap_Values">
<apex:form >
<apex:outputLabel >Enter Value</apex:outputLabel>
<apex:inputText value="{!x}"/>
<apex:inputText value="{!y}"/>
<apex:commandButton value="Swap" action="{!SV}"/>
</apex:form>
</apex:page>
Apex code:-
public class Swap_Values {

    public String y { get; set; }

    public String x { get; set; }

    public PageReference SV() {
        x=y;
        y=x;
        return null;
    }

}


 
Hi experts,
how to load records from production to sandbox using dataloader please help me out..

Thanks in Advance
  • January 27, 2022
  • Like
  • 0
Hi everyone ,i need to display list of account records with a button beside  the records when i click on that button it should open a contact form and able to save the record.
tried so far..

class:
public class Displayrecs {
   public String firstName{get;set;}
    public String lastName{get;set;}
    public String phone{get;set;}
    //list <contact> conList;
     public ApexPages.StandardSetController stdCntrlr {get; set;}

 
    
    public Displayrecs(ApexPages.StandardSetController controller){
        stdCntrlr = controller;
    }
    
    public pageReference Save(){
        Contact con = new Contact(firstname=firstname, lastname=lastname, phone=phone);
        //conList.add(con);
        insert con;
        return null; 
   }
}

vf:
<apex:page standardController="Account" recordSetVar="accounts" extensions="Displayrecs" >
    <apex:form>
        <apex:pageBlock>
             <apex:pageBlockTable value="{!accounts}" var="a" id="list">
        <apex:column value="{!a.name}"/>
                 <apex:column value="{!a.rating}"/>
                 <apex:column>
                     <apex:commandButton action="{!save}" value="save"/>
                 </apex:column>
      </apex:pageBlockTable>
            
        </apex:pageBlock>
       
         
    </apex:form>
</apex:page>

User-added imageable to view like above screenshot.
Thanks in Advance
  • January 27, 2022
  • Like
  • 0
how to delete permissionsetA to the user when user changes roleA changes to roleB using trigger.

Thanks in Advance.
  • January 19, 2022
  • Like
  • 0
Hi everyone ,when i click on one of the record related to the object in my org it throws an error:list has no rows for assignment to Sobject..
what might be the issue please help me out.

Thanks in Advance.
  • January 07, 2022
  • Like
  • 0
Hi every one ,tried sending email through vf am not getting any errors and i have given active mail id, but am not receiving the mail when i click on the send button through vf,below is the code..

apex:
public class sendEmailthroughvf {
    public string subject {set;get;}
    public string Body {set;get;}
    List<string>emails=new List<string>{'abc1@gmail.com'};
    
    
    public PageReference sendEmail(){
       
          messaging.SingleEmailMessage mail=new messaging.SingleEmailMessage();
        mail.setSubject(subject);
        mail.setHtmlBody(Body);
        mail.setToAddresses(emails);
        Messaging.SendEmailResult[] r=Messaging.sendEmail(new messaging.SingleEmailMessage[] {mail});
       //Messaging.sendEmail(new Messaging.singleEmailMessage[] { mail });
        return null;
    }
}
vf:

<apex:page controller="sendEmailthroughvf">
    <apex:form >
        <apex:pageBlock >
            <b>Enter Subject:</b> <apex:inputText value="{!subject}"/><p/>
            
                       <b>Enter Body:</b><apex:inputText value="{!Body}"/>
            <apex:pageBlockButtons location="top">
                <apex:commandButton value="send" action="{!sendEmail}"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>
  • December 31, 2022
  • Like
  • 0
Hi everyone ,i have tried below trigger ,Account should have only one active oppotunity ,but it is not working as expected ,not hitting error.help me..
trigger:
trigger onlyonechildactive on Opportunity (before insert,before update) {
set<Id>accountId=new set<Id>();
    for(opportunity o:trigger.new){
        if(o.AccountId!=null){
            accountId.add(o.id);
        }
    }
    List<Account>acclist=[select id,name,(select id,stageName,closeDate,name,Active__c from opportunities where Active__c=true)from Account where Id=:accountId];
    map<id,boolean> bb=new map<id,boolean>();
    //for each account
    for(Account a:acclist){
        bb.put(a.id,a.opportunities.size()>0  );
            
        }
    for(opportunity op:trigger.new){
        if(bb.get(op.AccountId)==true && op.Active__c==true){
           op.addError('there is already a Active opp'); 
        }
    }
    }
Thanks in Advance
  • December 30, 2022
  • Like
  • 0
while updating the field from workbench getting error like below,please help me .

Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
heroku logs --tail

Thanks in Advance.

 
  • December 22, 2021
  • Like
  • 0
Hi everyone,am new to salesforce,can anyone please provide some real time scenarios related  to salesforce ,and lwc .

Thanks in Advance
  • December 15, 2021
  • Like
  • 0
Hi All,
I want to send an email with an Attachment from Notes and Attachment related list.
 
i.e. i have few attachments inside Notes and Attachment related list of a custom Object.. and on a button click i need to send an email with attachment.
Can someone please write a code for me . It will be a great help
Hi experts,
how to load records from production to sandbox using dataloader please help me out..

Thanks in Advance
  • January 27, 2022
  • Like
  • 0
Hi everyone ,i need to display list of account records with a button beside  the records when i click on that button it should open a contact form and able to save the record.
tried so far..

class:
public class Displayrecs {
   public String firstName{get;set;}
    public String lastName{get;set;}
    public String phone{get;set;}
    //list <contact> conList;
     public ApexPages.StandardSetController stdCntrlr {get; set;}

 
    
    public Displayrecs(ApexPages.StandardSetController controller){
        stdCntrlr = controller;
    }
    
    public pageReference Save(){
        Contact con = new Contact(firstname=firstname, lastname=lastname, phone=phone);
        //conList.add(con);
        insert con;
        return null; 
   }
}

vf:
<apex:page standardController="Account" recordSetVar="accounts" extensions="Displayrecs" >
    <apex:form>
        <apex:pageBlock>
             <apex:pageBlockTable value="{!accounts}" var="a" id="list">
        <apex:column value="{!a.name}"/>
                 <apex:column value="{!a.rating}"/>
                 <apex:column>
                     <apex:commandButton action="{!save}" value="save"/>
                 </apex:column>
      </apex:pageBlockTable>
            
        </apex:pageBlock>
       
         
    </apex:form>
</apex:page>

User-added imageable to view like above screenshot.
Thanks in Advance
  • January 27, 2022
  • Like
  • 0
 Write trigger that handles the following. Whenever a case is created with origin as ‘Phone’, set status as ‘New’ and Priority as ‘High’ and assign it to the user ‘XXXXX’. Retrieve the details of user using the user name ‘XXXXX’.
 @HttpPost
    global static Contact CreateContacts(){
        RestRequest request = RestContext.request;
        String requestBody = request.requestBody.toString();
       
        list<Contact> con = (List<Contact>) JSON.deserialize(requestBody, list<Contact>.class);
        insert  con;
        return con;
    }

Passing Request Body>>

{"records" :[ { "FirstName": "test1", "LastName": "hello", }, { "FirstName": "test2", "LastName": "hello", }, { "FirstName": "test3", "LastName": "hello", }]

this code is not working.
how to delete permissionsetA to the user when user changes roleA changes to roleB using trigger.

Thanks in Advance.
  • January 19, 2022
  • Like
  • 0
Hi every one ,tried sending email through vf am not getting any errors and i have given active mail id, but am not receiving the mail when i click on the send button through vf,below is the code..

apex:
public class sendEmailthroughvf {
    public string subject {set;get;}
    public string Body {set;get;}
    List<string>emails=new List<string>{'abc1@gmail.com'};
    
    
    public PageReference sendEmail(){
       
          messaging.SingleEmailMessage mail=new messaging.SingleEmailMessage();
        mail.setSubject(subject);
        mail.setHtmlBody(Body);
        mail.setToAddresses(emails);
        Messaging.SendEmailResult[] r=Messaging.sendEmail(new messaging.SingleEmailMessage[] {mail});
       //Messaging.sendEmail(new Messaging.singleEmailMessage[] { mail });
        return null;
    }
}
vf:

<apex:page controller="sendEmailthroughvf">
    <apex:form >
        <apex:pageBlock >
            <b>Enter Subject:</b> <apex:inputText value="{!subject}"/><p/>
            
                       <b>Enter Body:</b><apex:inputText value="{!Body}"/>
            <apex:pageBlockButtons location="top">
                <apex:commandButton value="send" action="{!sendEmail}"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>
  • December 31, 2022
  • Like
  • 0
Hi there,
In this visualforce page there are two inputs and one button name as swap. How the swap the values in given two inputs from input-1 to input-2. Please provide suggestions

I tried the above code
VF code:-
<apex:page controller="Swap_Values">
<apex:form >
<apex:outputLabel >Enter Value</apex:outputLabel>
<apex:inputText value="{!x}"/>
<apex:inputText value="{!y}"/>
<apex:commandButton value="Swap" action="{!SV}"/>
</apex:form>
</apex:page>
Apex code:-
public class Swap_Values {

    public String y { get; set; }

    public String x { get; set; }

    public PageReference SV() {
        x=y;
        y=x;
        return null;
    }

}


 
Hi,

Here i want to calculate distance please help me.

I have few records and i have location filed reuirement is i have 5 records

A, B, C, D, E here i want distance between 
A to B , B to C, C to D, D to E how it will be possible? please help me.

Thanks,
Dhilip Dussa.