• YogeshMore
  • NEWBIE
  • 435 Points
  • Member since 2015
  • Salesforce Developer
  • Salesforce


  • Chatter
    Feed
  • 14
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 70
    Replies
how to convert decimal numbers like (1234.12) to words in salesforce??

I need an output like this...

1234.12 = one thousand two hundred thirty-four. twelve paise (INR)
 I am getting this much of output 'one thousand two hundred thirty-four' but not getting how to append that "twelve paise" after the decimal point. 

Thanks in Advance...  
Hi,
My requirement was to redirect my page after the record gets saved without using VF page,
I am using Case object here. I need to send an agreement using custsom url, So Here What I needed is to redirect to the custom url when the records gets submitted. Please assist me.
 
Hello, let's say I have a custom object like Account. I receive a cvs file with the name and other data fields and an external ID.

I want to update if the Account already exists, or create a new Account if it doesn't.

I thought of putting all of the External IDs of the file in a list and then use Set or Map and then do a query to get the Accounts that have these External IDs so I don't do a new Account.

The problem is I don't know where to start :(

Can anyone give me a hand with a simple example?

I don't want to do a query inside the loop because I understand it's a bad practice.

Thanks!
"oppclass Compile Error: The method object <Constructor>(ApexPages.StandardController) is referenced by Visualforce Page (InvoicePDF) in salesforce.com."
Here is my class:

public class oppclass {
  public list<opportunity>opplist{get;set;}
   public ID opportunityid{get;set;}

    public oppclass() {
    
        opplist = new list<opportunity>();
        opplist = [select Name from opportunity];
        
    }

}
I have a trigger on Opps and need to execute some logic if the opp is associated to only one Account Record type. How do I do this?

trigger UpdateTeamMember on Opportunity (After insert, after update) {
    if(trigger.isUpdate){
        for(opportunity o : trigger.new){
            if(o.account.recordtypeid == 'xxxxx') >> does not work?

Any ideas?
  • April 03, 2017
  • Like
  • 1
Hi, I would like to update a field value when a user clicks on a link or button on a email sent out by salesforce. 

We have a workflow that sends out automatic reminders about certain jobs. I would like to setup a second workflow that sends an email 2 days later with a button or link (e.g. "Job completed? Yes, No?") for the user to click on. That button or link should then update a field value in salesforce to "Job completed" or "Job cannot be completed". It doesn't matter if it's a picklist or text field, - I just can't figure out a way to update a field by clicking on a button/link in an email. 

I greatly appreciate any help. 

Alex
public with sharing class RequestEditController {
private final Request_Cab__c request;
    public RequestEditController() {
       
    }
     public RequestEditController(ApexPages.StandardController standardPageController) {
        request = (Request_Cab__c)standardPageController.getRecord(); 
    }

    public Pagereference pageredir()
      {
           
         Request_Cab__c recordDetails = [SELECT Id FROM Request_Cab__c WHERE Id = :request.Id];
         PageReference returnPage = Page.RequestEditPage;
         returnPage.setRedirect(true); 
        return returnPage; 
}
     
    
    
}
Hallo all,
Is it possible to change the picklist value automatically, if current time exceeds the start time field(DateTime Datatype) value by 15 minutes. This condition should be automatically updated to all the records of the object.
Thank you.
How to write test class for this class?


public with sharing class AttachmentUploadController {

  public Attachment attachment {
  get {
      if (attachment == null)
        attachment = new Attachment();
      return attachment;
    }
  set;
  }

  public PageReference upload() {

    attachment.OwnerId = UserInfo.getUserId();
   // attachment.ParentId = Account.getId; // the record the file is attached to
    attachment.IsPrivate = true;

    try {
      insert attachment;
    } catch (DMLException e) {
      ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR,'Error uploading attachment'));
      return null;
    } finally {
      attachment = new Attachment(); 
    }

    ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,'Attachment uploaded successfully'));
    return null;
  }

}
Hi All, 

I created a visualforce page to display a related list from a custom object. It looks great and I was able to remove the edit links as well. I would like however for the list to be read only though. I want the page to show the columns and details but I do not want the user to be able to click on the record reference to try to navigate to it. If they click on the VF page I do not want anything to happen. 

Here is my code for the page. I tried readOnly="True" but it does not seem to work. 
<apex:page standardController="SBQQ__Quote__c" readOnly="true"> <apex:relatedList list="SBQQ__LineItems__r" /> <style> [Class*='actionColumn'] { display:none; visibility:hidden; } </style> <style> [Class*='linkSpan'] { display:none; visibility:hidden; } </style> </apex:page>

Any suggestions? 
LEN(ZIP_Code__c) > 0 &&
(Country__c = "USA" || Country__c = "US") &&
VLOOKUP(
$ObjectType.ZIP_Code__c.Fields.City__c,
$ObjectType.ZIP_Code__c.Fields.Name,
LEFT(ZIP_Code__c,5))
<> City__c

what is the error....??
thnx, in advance
I have a field web name on case object, which captures value like this Kumar, Anil @New Delhi, now I want to take out first and last name from this field. Eg: it should look like Anil Kumar. Can anyone suggest any formula or any other solution?
Hi,
I have a visualforce page that is going to call another visual force page after clicking a button in a <apex:pageBlockButtons >.
Where I click the button Enter Data the doUnlink function is executed and call a method in a another class. On that class I have a call to another visualforce page. The issue is that I'm tying to pass Prod.Id to used when calling the new visualforce page but for some reason the id is  not passing to the class.

Here is the part of the code 
<apex:actionFunction name="doUnlink" action="{!openPage}" rerender="refresh" />
<apex:pageBlockTable value="{!listProducts}" var="Prod">
         <apex:column headerValue="Click to add info">
        <apex:commandButton value="Enter Data" onclick="doUnlink();" >
        <apex:param id="oppProdId" value="{!Prod.Id}" assignTo="{!oppprorec}"/>
        </apex:commandButton>
    </apex:column>
    
</apex:pageBlockTable>
Thanks
 
We have an application that is making use of Apex Triggers and HTTP Callouts to notify our web service when an action happens in Salesforce.

For example:

1. An admin in Salesforce changes a `School` object
2. The Apex Trigger for the `School` object makes an HTTP Callout to our website

During testing the HTTP Callout happened immediately after the object was changed, usually in under 1 second. However, recently we are noticing that it is taking anywhere from 10 seconds to 200 seconds for the HTTP Callout to happen, e.g:

1. An admin in Salesforce changes a `School` object
2. ...100 seconds pass...
3. The HTTP Callout is made

Why is this? The Apex Trigger documentation does not mention any sort of delay in executing the HTTP Callout, and the delay is inconsistent: sometimes it is a few seconds and sometimes it is a few minutes. Our longest documented instance is ~200 seconds from the action happening to the HTTP Callout being triggered.

Thanks.
Hello
I am new to writing test class. I need help in writing test class for the following code.
scenairo: when I create a new account from UI, a nee opportunity record gets created under the account.
public class CreateNewOpportunity
{
   public List<Opportunity> oppList=new List<Opportunity>();
   
   public void CreateOpportunity(List<Account> accList)
   {
     for(Account a:accList)
     {
       Opportunity o = new Opportunity();
       o.AccountID=a.ID;
       
       o.Name=a.Name;
       o.CloseDate=System.Today().addDays(3);
       
       o.StageName='Prospecting';
       
       oppList.add(o);
     }
     
     if (oppList.size() > 0)
         Database.Insert(oppList);
   }
}

trigger trg_createnewoppor on Account (after Insert,after update)
{
  if ((Trigger.isInsert) || (Trigger.IsBefore))
  {
    CreateNewOpportunity o = new CreateNewOpportunity();
    o.CreateOpportunity(Trigger.New);
  }
}


Thanks
smita
how to convert decimal numbers like (1234.12) to words in salesforce??

I need an output like this...

1234.12 = one thousand two hundred thirty-four. twelve paise (INR)
 I am getting this much of output 'one thousand two hundred thirty-four' but not getting how to append that "twelve paise" after the decimal point. 

Thanks in Advance...  
Hi,
My requirement was to redirect my page after the record gets saved without using VF page,
I am using Case object here. I need to send an agreement using custsom url, So Here What I needed is to redirect to the custom url when the records gets submitted. Please assist me.
 
I tried below code but i'm not getting o/p
Apex trigger:

trigger Rollup_Acc on Opportunity (After insert,After update,After delete,after undelete) {
    if(trigger.isinsert && trigger.isupdate && trigger.isdelete && trigger.isundelete){
    List<Account> accs=new List<Account>();
    Set<Id> ids=new Set<Id>();
    for(opportunity o:trigger.new){
        ids.add(o.AccountId);
        
    }
    decimal sum;
    for(Account acc :[select id,name,Amount__c,(select id,name,amount from opportunities ) from Account where id =:ids]){
        sum=0;
        for(opportunity op:acc.opportunities){
            sum+=op.Amount;
        }
        acc.AnnualRevenue=sum;
        accs.add(acc);
        
        
    }
   
    update accs;
    }
   
    
}
Hello, let's say I have a custom object like Account. I receive a cvs file with the name and other data fields and an external ID.

I want to update if the Account already exists, or create a new Account if it doesn't.

I thought of putting all of the External IDs of the file in a list and then use Set or Map and then do a query to get the Accounts that have these External IDs so I don't do a new Account.

The problem is I don't know where to start :(

Can anyone give me a hand with a simple example?

I don't want to do a query inside the loop because I understand it's a bad practice.

Thanks!
i need one solution on one of my app which i have created,

I have two custom fields, From_Date__c & To_Date__c on(Annual Leave object) , if suppose one user has applied a leave on that date field , the record will get save,, suppose if the same user tries to apply some another leave on same date it should throw some error like leave is already applied on the date.t .how it can be done..

How it can be solved..

Regards
Pranav Shah
Hello Everyone,

Is there any way to find out the currently logged in users of the org.

Requirement :- When a lead is created,I need to assign the lead dynamically to only to the logged in users(Need to fetch all the logged in users of the org programatically).

Salesforce has mentioned in one of the ideas that they have implemented it - https://success.salesforce.com/ideaView?id=08730000000BpPOAA0

Executed the SOQL query - Select a.UsersId, a.IsCurrent, a.UserType, a.SourceIp, a.SessionType, a.SessionSecurityLevel, a.ParentId, a.NumSecondsValid, a.LoginType, a.LastModifiedDate, a.Id, a.CreatedDate From AuthSession a

But,it returned only my user record.It didn't not returned the other users who have logged in the orge.

All the logged in users can be accesed at the UI level --> security controls --> session Management.

Any idea/help is appreicated.

Thanks & Regards,
Harsha BR 
Hi,

I am facing an issue in assigning attribute value for a component in saveResult method, inside helper class:
Component:
 <aura:attribute name="isOwnerDefined" type="String" default=""/>

<force:recordData aura:id="CntctTypeRecordCreator"
                          targetRecord="{!v.newContact}"
                          targetFields="{!v.CntctTypeResultFields}"
                          layoutType="FULL"
                          mode="EDIT" />
JS Controller :
component.find("CntctTypeRecordCreator").saveRecord($A.getCallback(function(saveResult) {
                if(saveResult.state === "SUCCESS" || saveResult.state === "DRAFT"){
                   for(var key in component.get("v.cntctTypesMap")){
                        if(component.get("v.selectedOption") == key){
                            helper.setContactTypeMAppingRec(component,key,saveResult.recordId);
                            break;
                        }
                    }
             }))
Helper:
setContactTypeMAppingRec : function(component,mappingName,recordId) {
        component.set("v.newCntctMappingField.Contact__c",recordId);
        component.set("v.newCntctMappingField.ContactType__c",component.get("v.cntctTypesMap")[mappingName]);
        component.set("v.newCntctMappingField.Name",mappingName);
        component.find("cnTypeRecordLoader").saveRecord($A.getCallback(function(saveResultContact) {
            if(saveResultContact.state === "SUCCESS" || saveResultContact.state === "DRAFT"){
                component.set("v.isOwnerDefined",'myTest');     // I have assigned string value to component attribute
                console.log('====' + component.get("v.isOwnerDefined")); // But here it returns "undefined"
                console.log('Contact Type mapping Saved!!');
            }
            else if (saveResultContact.state === "INCOMPLETE") 
                console.log('Server could not be reached. Check your internet connection!');
            else if (saveResultContact.state === "ERROR") 
                console.log('Exception Found!');
            else
                console.log('Error while loading Current Processor Picklist. Please contact your System Administrator.');
        }))
    }


Any Help?
trigger UpdateStage on Account (after insert, after update, before insert, before Update) {   // Performs Custom actions after Record gets saved.
   
    List<Id> accountId = new List<Id>(); // get the list of all Account's ID to be Updated.
    
    for(Account acc : Trigger.new)
    {
        if(acc.All_Opportunities_Won__c==True)   // Checks if the Condition is True. 
            accountId.add(acc.Id);
    }
    
    List<Opportunity> oppsToUpdate = new List<Opportunity>();
    
    for(Opportunity opp : [select id, StageName, Amount from Opportunity where AccountId in: accountId AND Amount != 0]) // used to get all records from above ID.
    {
        opp.StageName='Closed-Won';   //Update StageName in Opportunity
        oppsToUpdate.add(opp); 
    }
    
    update oppsToUpdate;   // Update all Opportunity in List.
}

 
I have a method created to handle the creation of a case and many other DML activities.
public PageReference SaveAndAssignIncToMe() String rValue; rValue = PullSelectAssignCase.AddCaseTeamMember(ObjCase.id, System.UserInfo.getUserId(), SEConstants.CASEOWN, SEConstants.USER); if(rValue == SEConstants.RETURN_TRUE){ //** So it was ok } else { //** So it was not ok ... }
The method is inside another (global) extention class ...
public static String AddCaseTeamMember(Case c, User u , String mRole, String tUser) { Database.SaveResult caseUpdateResult; String rValue; ///// ///// return rValue; } // End of AddCaseTeamMember
When I call the method from another VF page ... there's no issue ... it's been bugging me for some time now but I can't figure out what is wrong here...
 
Hi Friends, 

Need Visualforce page with search option account.
Should Use Current loggedin User Phone and Account phone. 
if iam trying to search with my account id = 12345.
if Account has phone number (900000001) and 
Current Loggedin User Phone number (900000001) 
Then
 User.phone==account.phone(if user phone and account phone both are same) then Account(12345) should disply on visualforce. except Account(12345) no one other account should not display. 
Please do help. this is an urgent thing need to have. 
Thanks in Advance.
  • December 27, 2017
  • Like
  • 0