• Onesh Reddy
  • NEWBIE
  • 360 Points
  • Member since 2015
  • Salesforce Developer
  • Solunus.Inc

  • Chatter
    Feed
  • 10
    Best Answers
  • 0
    Likes Received
  • 7
    Likes Given
  • 0
    Questions
  • 56
    Replies
Hi - I'm new to creating VF pages in salesforce.  I created a simple lead form that captures basic profile information.  I'm having issues with special character on the Company name and/or the city fields on the Lead object. It appears it doesn't save the record in this scenario - Company Name Re/Max Unlimited  City:  San Antonio

Here's the apex code for the page:

<apex:page standardController="Lead">
<apex:form >
    <apex:pageBlock mode="edit">
        <p/>
        <p/>
           <div align="center" draggable="false" >
        <apex:commandbutton action="{!save}" value="Save"/>
        <apex:commandbutton action="{!cancel}" value="Cancel"/>
        </div>
        <p/>
      
        <apex:pageBlockSection title="Lead Information" columns="1">
            <apex:inputField value="{!Lead.Salutation}"/>
            <apex:inputField value="{!Lead.FirstName}" required="true"/>
             <apex:inputField value="{!Lead.LastName}"/>
            <apex:inputField value="{!Lead.Suffix}"/>
            <apex:inputField value="{!Lead.Company}"/>       
 </apex:pageBlockSection>
 </apex:pageBlock>       
 <p/>
    <apex:pageBlock mode="edit">
        <apex:pageBlockSection title="Contact Information" columns="1">
                   <apex:inputField value="{!Lead.Email}" required="true"/>
                    <apex:inputField value="{!Lead.Phone}" required="true"/>
                    <apex:inputField value="{!Lead.MobilePhone}"/>
                    <apex:inputField value="{!Lead.Street}"/>
                    <apex:inputField value="{!Lead.City}" required="true"/>
                    <apex:inputField value="{!Lead.state}" required="true"/>
                    <apex:inputField value="{!Lead.postalcode}"/>
                    <p/>     
 </apex:pageBlockSection>
 </apex:pageBlock>   
</apex:form>
</apex:page>

I appreciate any assistance.

Thanks,

Marvin 
<apex:page standardController="contact">
    <apex:form>
        <apex:pageBlock title="Edit Contact">
            <apex:pageBlockSection Columns="1" >
                <apex:inputField value="{! Contact.FirstName}"/>
                <apex:inputField value="{! Contact.LastName}"/>
                <apex:inputField value="{! Contact.Email}"/>
            </apex:pageBlockSection>

            <apex:pageButtons>
                <apex:commandButton action"{!Save} value="Save"/>
</apex:pageButtons>apex:pageBlockButtons>
                                 
</apex:pageButtons>apex:pageBlock>
</apex:form>
</apex:page>


this is the code i had written but its got some error.error msg
Hi All,
  I created a lead assignment rule to assign to new user with rule criteria : Lead industry = "Insurance".
  This rule is active and there is only 1 active rule.
  When I create a new lead or update an existing lead on the industry field to "Insurance", the owner field of this lead is not changed to the assigned user in the rule.
What did I miss to do? Or what is the concept of lead assignment rule  using option assign to a new user or a queue?
Thank you for your help.

 
If I try the phone format in the field, it can provide a phone format.However, even I type in character, the system still accept it. If I use the number format, it can restrict users only to type number. However, the outlook of data will become a number format with this sign (","). How can I solve this problem? Thank you.

Has anyone completed the Security Superbadge since the updates by Trailhead?  I can't get the Apex tests to pass for Stage 2.  All I get is the (1/2) Test Methods Passed (i.e., 1 test failed) with absolutely no suggestion as to what to do.  

User-added image

Does anyone know what the Apex test is even looking for?  I can't fix what I don't know is broken, so I'm completely stuck.  

Maybe it's this part of the instructions?

"Configure other Salesforce settings related to record-level security to meet the business requirements."

That seems rather ambiguous so I'm not sure if I'm missing some part of the requirements.  

Hi All,


https://test.salesforce.com/
How to login or create account for this edition?

 
If any of the opportunities associated with Account has stage value is not "closed lost" then the Account cannot be deleted. 

How to achieve this ?
How to implement the below thing using Record Type.
Expenses can be of 2 types – Travel Expense, Other Expense

Expense must have a Category picklist field, as below:
Travel Expense: Tickets, Transit, Food, Toll, Fuel, Accommodation
Other Expense: Training, Relocation, Certification, Stationary
 
public class AddmultipleContactsController {

Contact con = new Contact();
public list<contact> listContacts{ get; set; }

public AddmultipleContactsController()
{
listContacts=new list<Contact>();
listContacts.add(con);
}

Public void addContacts()
{
Contact cc = new Contact();
listContacts.add(cc);
}
public PageReference saveContacts() {
for(Integer i=1; i<listContacts.size(); i++)
{
insert listContacts;
}
return Page.AllContactssaved;
}
}
Hi Everyone,

i m new to SFDC. I m writing a basic trigger by using handler class for avoiding duplicate values but it is giving an error.
my code is
 trigger AvoidingDuplicateValues1 on Account (Before Insert,Before Update)
{
    DuplicateValue dup=new DuplicateValue();
}

Error: Compile Error: Invalid type: DuplicateValue at line 3 column 28

Pls help.
want to add new user using Apex  I have try for it but new user dosnt get display with other user

Hello Team!

I am SF begineer and trying the below code, after creating Opportunity in SF, trigger automatically creates a contact but contact is not linking to Opportunity and not showing up as in related list.


trigger Op_Trigger3 on Opportunity (After Insert) {
Contact c = new Contact();
for(Opportunity o : Trigger.New)
{
c.AccountID = o.AccountID;
c.FirstName = 'Michael';
c.LastName = 'Scofield';
insert c;
}
}

I am not sure if something is missing in the trigger code or not. Please correct if I am making any mistake.

Thanks in Advance,
​Dheeraj
Originally we had the header in the API include a assignment rule ID. We want to use the functionality of useDefaultRules = True and remove the hardcoded value. But with this done, all the leads are not hitting the new active lead assignment rule and are instead going to the default owner.
I do have the page layout properties checkboxes for assignment checked. My new assignment rule is active. The assignment rules have been checked manually and they work, just not with the API sourced leads.

Do we need to hardcode the assignment rules? That is not a path I want to take. Do I have options to get this to work?
 
Hi all,
I want to download the PDF in the new tab when a button in custom vfpage is clicked. Can anyone help me over here.
How can i access Shopify Services API in Salesforce. And how can i get Shopify EndPoint URL .
Hi, I recently stepped into SF and working on BOX integration.
Here are the scenarios I used for Box integration.
1) Downloaded box app from appExchange and used two box accounts to setup (I have no clue why do we need user account for developing)
2) followed the instructions what document given.
3) Was uploaded files in box section of an object
But this solution is not sufficient since eveyuser is asked login to grant permissions to create folder

Scenario 2:
1) Downloaded box app from appExchange and used two box accounts to setup (I have no clue why do we need user account for developing)
2) Created custom object which resembles the Attachment object that will replace the standard attachments related list on the page layout.
3) Created VF for file upload page and Controller for that page
4) In the Controller I'll be able to attache files to SF File Storage but I'll not be able to upload to BOX, here is the error and code to box I used.
Error:

13:24:15:149 USER_DEBUG [19]|DEBUG|Toolkit:[AUTH_WRAPPER_PREPARE_FAIL_MESSAGE=Unable to use default credentials to make a callout to box (maybe this is in a trigger or constructor): , authWrapper=BoxAuthWrapper:[adminSettings=box__BoxUser_Settings__c:{}, client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, client_secret=yyyyyyyyyyyyyyyyyyyyyyyyyyyyyy, redirect_uri=null, resultMessage=, userSettings=box__BoxUser_Settings__c:{}], didAuthChange=false, existingFolderId=null, mostRecentError=, newFolderMetas=(), newFrups=(), newRootFolders=()]



Note: I replaced client_id and client_secrets with x and y respectively
and the box toolkit code I used to upload file..
 
//@future (callout=true)
    private void createAttachmentinBox(id attachmentid){
        System.debug('In HelperClass');
        String BoxFolderid='11476443045';
        box.Toolkit boxToolkit = new box.Toolkit();
        System.debug('boxtoolkit'+boxToolkit);
        Attachment Myattachment=[select name,body,parentid from attachment where id=:attachmentid];
        System.debug('Attachment '+Myattachment);
        String fileFromBoxID=boxtoolkit.createFileFromAttachment(Myattachment,null, BoxFolderid,null);
        System.debug('fileFromBoxID '+fileFromBoxID);
        boxToolkit.commitChanges();
        //delete [select id from Attachment where id=:attachmentid];
    }
Why am I not able to use default credentials to make a callout to box? Could you get me solition for my issue?

I would be appreciated if you could get me solution







 
Hello,
I'm new (like beginner) to Salesforce and we are trying to integrate BOX, I need to create and object which must have a file upload field and save that into BOX, please someone help me the procedure? I googled but no use (since I'm a new I have no clue where to find)
Appreciate your help..
Hi - I'm new to creating VF pages in salesforce.  I created a simple lead form that captures basic profile information.  I'm having issues with special character on the Company name and/or the city fields on the Lead object. It appears it doesn't save the record in this scenario - Company Name Re/Max Unlimited  City:  San Antonio

Here's the apex code for the page:

<apex:page standardController="Lead">
<apex:form >
    <apex:pageBlock mode="edit">
        <p/>
        <p/>
           <div align="center" draggable="false" >
        <apex:commandbutton action="{!save}" value="Save"/>
        <apex:commandbutton action="{!cancel}" value="Cancel"/>
        </div>
        <p/>
      
        <apex:pageBlockSection title="Lead Information" columns="1">
            <apex:inputField value="{!Lead.Salutation}"/>
            <apex:inputField value="{!Lead.FirstName}" required="true"/>
             <apex:inputField value="{!Lead.LastName}"/>
            <apex:inputField value="{!Lead.Suffix}"/>
            <apex:inputField value="{!Lead.Company}"/>       
 </apex:pageBlockSection>
 </apex:pageBlock>       
 <p/>
    <apex:pageBlock mode="edit">
        <apex:pageBlockSection title="Contact Information" columns="1">
                   <apex:inputField value="{!Lead.Email}" required="true"/>
                    <apex:inputField value="{!Lead.Phone}" required="true"/>
                    <apex:inputField value="{!Lead.MobilePhone}"/>
                    <apex:inputField value="{!Lead.Street}"/>
                    <apex:inputField value="{!Lead.City}" required="true"/>
                    <apex:inputField value="{!Lead.state}" required="true"/>
                    <apex:inputField value="{!Lead.postalcode}"/>
                    <p/>     
 </apex:pageBlockSection>
 </apex:pageBlock>   
</apex:form>
</apex:page>

I appreciate any assistance.

Thanks,

Marvin 
Hii All,
If the account record has any related contact records where Record Type = Worker Shift and Status = Pending or Scheduled, then the system displays an error saying "You cannot deactivate a account that has pending or scheduled shift."  System displays the view screen for the related contact.
Hi, 

I'm trying to have the subject field of a task that is triggered in a custom object using an Apex trigger populate with the the name of the opportunity the object is related to. I can get the unique ID to show  when i reference the lookup field in the custom object ('opportunity__c') but when I use 'object__r.name' it comes up blank. Does anyone know what could be causing this? My trigger code is:

trigger TaskAllocation on Action__c (after insert) {    
    List<Task> taskList = new List <Task>();
    for (Action__c a:Trigger.New)
        
    {
      
    {
    Task t = new Task();
    
        t.OwnerID = a.Action_owner__c;
        t.WhatId = a.Id;
        t.Subject =  a.opportunity__r.Name;
        t.description = a.action__c;
        t.Status = 'Not Started';
        t.ActivityDate = a.deadline__c;
        t.priority = 'Normal';
    taskList.add(t);
    }
    
    }
    if(taskList.size()>0)
    insert taskList;
   
    
}


Cheers, 

Tristan
Hello All,

I want to find out Sate and County name from Geolocation field coordinates and wanted to find current tax rates in these.How can I achieve this?

Thanks,
Nida
Hi guys.. I want to integrate facebook on salesforce.i want to know the process regarding this.
I want to fetch some data regaring the user..
pls tell me what things are required as i am using REST api.
 
Hi,

In my organization for 5 users their passwords should not be expire forever, for remaning users it should be expired for 1 month. Please help me out of this.

I created a custom object titled "Interview Results".

By default there is a required standard field that is either a text (80) or an auto-number. I want this field to auto-fill with whatever the user chooses for a picklist. Is this possible?

The picklist is titled "Interview Type".

Essentially I want the standard field "Interview Results" to equal whatever the user picks from the custom field "Interview Type".

Hi
I am updating account field rating='Hot' whenever Opportunity stageName='Closed won'.
I would like to understand 2 things
a) account field rating is not updated when I edit any opportunity record and set the StageName='Closed Won'
b) How to use Map function in order to avoid loop.correct me if I am wrong.
 
public class updateaccountrating
{
  public void updaterating(List<Opportunity> oppor)
  {
    // 1. Get opportunity accountID and store in a list.
    Set<ID> opporAccountID = new Set<ID>();
    
    for(Opportunity o:oppor)
    {
       opporAccountID.add(o.AccountID);
    } 
    
    List<Account> aFinal=new List<Account>();
    
    List<Account> acc=[select ID,rating from account where ID IN :opporAccountID];
    
    for(Opportunity o:oppor)
    {
      for(Account a:acc)
      {
         if (o.StageName == 'Closed Won')
         
             a.rating='Hot';
             aFinal.add(a);
         
      }
     
    }
    
    if (aFinal.size() > 0 && aFinal != NULL)
       Database.Insert(aFinal,false);
    }
}

trigger trg_updateaccountrating on Opportunity (before Insert,before Update)
{
  if (trigger.IsBefore)
  {
    if (trigger.IsUpdate)
    { 
     updateaccountrating a = new updateaccountrating();
     a.updaterating(Trigger.New);
    }
  }

}

Thanks
pooja
Hi All,

I have a situation where i need to insert 2 fields from account and the few fields from contact(related to account) to a custom object . Is it possible using triggers?