+ Start a Discussion
Deepak Pandey 13Deepak Pandey 13 

split back__c object long text field with (comma sepreted)

public with sharing class Backup_ExtensionController {
    public Backup__c  bkup{get;set;}
    public List<string> splitString {get;set;}
    
    public Backup_ExtensionController(ApexPages.StandardController controller) 
    {
    list<Backup__c> bk= new list<Backup__c>();
    
      controller.addFields(new List<string>{'splitemail__c'});
        Backup__c record = (Backup__c)controller.getRecord();

        splitString = new List<string>();

        if(!String.IsBlank(record.splitemail__c))
            splitString = record.splitemail__c.split(','); 
    }

}

pages-

<apex:inputfield value={!bkup.splitfield}/>
<apex:commanndutton action={!save} value="save"/>
Veenesh VikramVeenesh Vikram
Hi,

Just replace 
splitString = record.splitemail__c.split(',');
with
splitString = String.valueOf(record.splitemail__c).split(',');

I hope this helps. Kindly mark solved if it does.

Best Regards
Veenesh
Deepak Pandey 13Deepak Pandey 13
hi Veenesh Sir
system debug not showing 'splitString,  
page is-
<apex:page standardController="Backup__c" extensions="Backup_ExtensionController" sidebar="false">
  <apex:form >
  <apex:pageBlock >
   <apex:inputField value="{!bk.Name}"/>
   <apex:inputField value="{!bk.splitemail__c}"/>
   <apex:commandButton value="Save" action="{!Save}"/>
  </apex:pageBlock>
  </apex:form>
</apex:page>

class-
public with sharing class Backup_ExtensionController {
    public Backup__c  bk{get;set;}
    public List<string> splitString {get;set;}
    
    public Backup_ExtensionController(ApexPages.StandardController controller) 
    { 
      controller.addFields(new List<string>{'splitemail__c'});
        Backup__c record = (Backup__c)controller.getRecord();

        splitString = new List<string>();

        if(!String.IsBlank(record.splitemail__c))
           splitString = String.valueOf(record.splitemail__c).split(',');
           system.debug('----->splitString ' +splitString );
    }
     
}
Veenesh VikramVeenesh Vikram
Kindly check if your record has value in the field "record.splitemail__c".

In your class:
public with sharing class Backup_ExtensionController {
    public Backup__c  bk{get;set;}
    public List<string> splitString {get;set;}
    
    public Backup_ExtensionController(ApexPages.StandardController controller) 
    { 
      controller.addFields(new List<string>{'splitemail__c'});
        Backup__c record = (Backup__c)controller.getRecord();

        splitString = new List<string>();

        if(!String.IsBlank(record.splitemail__c)){
           splitString = String.valueOf(record.splitemail__c).split(',');
           system.debug('----->splitString ' +splitString );
		}
		else
			system.debug('----->splitString is blank' + );
    }
     
}

Hope this helps.

Veenesh
Deepak Pandey 13Deepak Pandey 13
hi sir  
splitString is blank.