• Vignesh P 6
  • NEWBIE
  • 70 Points
  • Member since 2015

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 1
    Questions
  • 14
    Replies
Hi all,

I have a scenario, i am using <apex:outputText> to display the custom object fields on a vf page like, FirstName, LastName, DOB, Mobile etc..
My requirement is, i want to display the mandatory field on the vf page.

For example FirstName* or Firstname|(red vertical bar).

Please help on this..

Thanks in advance.

 
hi all, 
when opp stage is "closed won" then none of the fields should be editable. i have created a validation rule for this.
AND( ISPICKVAL( StageName ,"Closed won"),OR(ISCHANGED( Type ),  ISCHANGED( Amount ), ISCHANGED( LeadSource ), ISCHANGED( CloseDate )) )

now when i change the stage field from qualification to closed won along with the changes in any other field. record should be saved but its not getting saved.
what mistake i am doing ? pls help.. do let me know is there anyother way to do this..Thanks
Whenever the process builder get failed it send a email to set of users. But i want to  remove some user . can anyone help me out to solve this.
Hi all,

I created a custom field of data type 'Text area' in Event object which currently holds only 255 characters max. Is there any workaround for increasing more characters for that custom field? 

Thanks
Vivek
Hi all,

I have a scenario, i am using <apex:outputText> to display the custom object fields on a vf page like, FirstName, LastName, DOB, Mobile etc..
My requirement is, i want to display the mandatory field on the vf page.

For example FirstName* or Firstname|(red vertical bar).

Please help on this..

Thanks in advance.

 
The following code has been taken from https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/langCon_apex_dml_examples_merge.htm 
// Create master account
Account master = new Account(Name='Account1');
insert master;

// Create duplicate accounts
Account[] duplicates = new Account[]{
    // Duplicate account 
    new Account(Name='Account1, Inc.'),
    // Second duplicate account
    new Account(Name='Account 1')
};
insert duplicates;

// Create child contact and associate it with first account
Contact c = new Contact(firstname='Joe',lastname='Smith', accountId=duplicates[0].Id);
insert c;


// Merge accounts into master
Database.MergeResult[] results = Database.merge(master, duplicates, false);

for(Database.MergeResult res : results) {
    if (res.isSuccess()) {
        // Get the master ID from the result and validate it
        System.debug('Master record ID: ' + res.getId());
        System.assertEquals(master.Id, res.getId());                
        
        // Get the IDs of the merged records and display them
        List<Id> mergedIds = res.getMergedRecordIds();
        System.debug('IDs of merged records: ' + mergedIds);                
        
        // Get the ID of the reparented record and 
        // validate that this the contact ID.
        System.debug('Reparented record ID: ' + res.getUpdatedRelatedIds());
        System.assertEquals(c.Id, res.getUpdatedRelatedIds()[0]);               
    }
    else {
        for(Database.Error err : res.getErrors()) {
            // Write each error to the debug output
            System.debug(err.getMessage());
        }
    }
}

I have been trying to merge duplicates accounts, but I do not know how to make the correct SELECTs queries. 
I tried this: 
public List<Account> masterAccount;//Account 1
    public List<Account> accountstomerge;//Account 1
    public void MergeTesting()
    {
        //Account masteAcc = new Account(Name = 'Boolean Master');
        Account masteAcc = [Select id, name from Account where name = 'Account 1' Limit 1];
        //insert masteAcc;
        //masterAccount = [SELECT id, name, website, phone, fax, CreatedDate FROM Account WHERE name = 'Account1'];
        accountstomerge = [SELECT id, name, website, phone, fax, CreatedDate FROM Account where name like '%Boolean%'];

        // Merge accounts into master
        
        try
        {
            Database.MergeResult[] results = Database.merge(masteAcc, accountstomerge, false);
            for(Database.MergeResult res : results) {
            if (res.isSuccess()) {
                // Get the master ID from the result and validate it
                System.debug('Master record ID: ' + res.getId());
                System.assertEquals(masteAcc.Id, res.getId());                
                
                // Get the IDs of the merged records and display them
                List<Id> mergedIds = res.getMergedRecordIds();
                System.debug('IDs of merged records: ' + mergedIds);
                
            }
            else {
                for(Database.Error err : res.getErrors()) 
                {
                    //Error message
                }
            }
        }
        }
        catch(Exception e)
        {
            System.debug('The following error: ' + e.getMessage());
        }
But there is no succed. Does anyone know what should be the correct syntax on these scripts to merge accounts successfully?
 
Hello,
Here i am tried to write a test class for importing csv file.THere is no code coverage.Plese help me on this.

Controller Class-
public class adminPriorSale {
    public list<Sales__c> accon{get;set;}
    public Sales__c agnt{get;set;}
    
    public Blob csvFileBody{get;set;}
    public string csvAsString{get;set;}
    public String[] csvFileLines{get;set;}
    
    public adminPriorSale(apexpages.standardcontroller controller )
   {
     agnt = new Distributor_Prior_Sales__c();
     accon = New List<Distributor_Prior_Sales__c>(); 
     accon=[selectid,Name,SMS_sales_amount__c,SMS_Year__c,Exhibit_A_Customer__c,Calculation_Type__c from Distributor_Prior_Sales__c]; 
     csvFileLines = new String[]{};
     
     }

public void importCSVFile(){
        
       try{
              csvAsString = csvFileBody.toString();
              csvFileLines = csvAsString.split('\n'); 
              for(Integer i=0;i<csvFileLines.size();i++){
               Sales__c prisale = new Sales__c () ;
               string[] csvRecordData = csvFileLines[i].split(',');
               prisale.Year__c= csvRecordData[0] ;             
               prisale.sales_amount__c= Decimal.valueof(csvRecordData[1]);
               prisale.Customer__c= csvRecordData[2];
               prisale.Calculation_Type__c = csvRecordData[3];   
               accon.add(prisale); 
             
           }
        upsert accon;
        
        }
        catch (Exception e)
        {
            ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR,e.getMessage());
            ApexPages.addMessage(errorMessage);
        } 
        
  } 
}   



Testclass-
 @isTest
private class test_ExhibitAadminPriorSale {
    static testMethod void test_ExhibitAadminPriorSale4()
    { 
      //  Distributor_Prior_Sales__c   t1= new Distributor_Prior_Sales__c  ();
        //t1.Name='test1';
        //t1.SMS_sales_amount__c =123;
        //t1.SMS_Year__c='2014';
       // insert t1;
  
      
        Document lstDoc = [select id,name,Body from Document where name = 'accttest'];
 
        ExhibitAadminPriorSale file=new ExhibitAadminPriorSale ();
        file.fileAccess();
        Blob content= lstDoc.Body;
        file.csvFileBody = content; 
        file.importCSVFile(); 

file.csvAsString =content.toString();
String[] csvFileLines = new String[]{};
List accon;

accon = new List();
for (Integer i=1;i<csvFileLines.size();i++)
{
String[] csvRecordData = new String[]{};
csvRecordData = csvFileLines [i].split(',');
//Distributor_Prior_Sales__c a = new Distributor_Prior_Sales__c ();
Distributor_Prior_Sales__c   t1= new Distributor_Prior_Sales__c  ();
        t1.Name='test1';
        t1.SMS_sales_amount__c =123;
        t1.SMS_Year__c='2012';
        t1.Exhibit_A_Customer__c='I Architects';
        t1.Calculation_Type__c='Estimated Prior sales';
        t1.RecordTypeId = '0011900000AFc6c';

accon.add(t1); 
try{
      insert accon;
}
catch (Exception e)
{
      ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured. Please check the template');
      ApexPages.addMessage(errormsg);
}

}
}
 
  • October 12, 2015
  • Like
  • 0
hi all,
I need to lock the picklist vlaue after selecting the particular field value from the picklist..
Ex: picklist Alphabets is there. and A, B , C, D, ......           all these are values..
if any user selects suppose b value,  then lock that particular field..and no body in the future has the  permission to edit that field..
it has to show like formulae field..
if other than B is selected then it has to be edited in the future....

Pleas help me from this scenario..

Thanks and regards..
Hi all,

How can we write a formula on field update for a picklist in salesforce workflow?
Because i need to update dynamically with some other text field value

Need help asap guys.

Thanks
Anil.
hi all, 
when opp stage is "closed won" then none of the fields should be editable. i have created a validation rule for this.
AND( ISPICKVAL( StageName ,"Closed won"),OR(ISCHANGED( Type ),  ISCHANGED( Amount ), ISCHANGED( LeadSource ), ISCHANGED( CloseDate )) )

now when i change the stage field from qualification to closed won along with the changes in any other field. record should be saved but its not getting saved.
what mistake i am doing ? pls help.. do let me know is there anyother way to do this..Thanks
Hi All,

we need to display a custom button for some of the user only not all the users. what is the best way to achieve this functionality ?

I am trying to create a button for the on click javascript function, if the current user is xxx that clicking on button will display error, but seems this is not working. could some one please modify the code and update me.

===========
{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")};
{!REQUIRESCRIPT("/soap/ajax/25.0/apex.js")};

User Usr = new User();
Usr = [SELECT Phone, Id FROM User WHERE Id = : UserInfo.getUserId()];



if(Usr.ID= '005d0000002yJI4') {
    alert("You cannot use this button on this account.");
} else {
    window.open("https://www.google.co.in/?gfe_rd=cr&ei=TDrpVZXNDdHCuASCg5xA&gws_rd=ssl");
}
==============================
Regards,
Rahul
Hello,

I am trying to use API to retrieve some Case History fields from Salesforce, there are two fields i was not able to find their API names though: 'Edited By' and 'Edited Date'.

Any suggestions?

Thanks,

Udi

When someone takes the time/effort to repspond to your question, you should take the time/effort to either mark the question as "Solved", or post a Follow-Up with addtional information.  

 

That way people with a similar question can find the Solution without having to re-post the same question again and again. And the people who reply to your post know that the issue has been resolved and they can stop working on it.