• Subodh Shukla
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
public void updateAttachmentWithLDCNumber(Map<String, String> mapAccount_LDCValue){
        List<Attachment> lstAttachmentToUpdate = new List<Attachment>();
        List<Attachment> lstAttachment = [SELECT Id, 
                                                 Name, 
                                                 Body,
                                                 ParentId
                                            FROM Attachment 
                                           WHERE ParentId IN: mapAccount_LDCValue.keySet()];
        if(lstAttachment.isEmpty()) return;
        for(Attachment objAttachment : lstAttachment){
            Blob csvBody = objAttachment.body;
            if(csvBody == null) continue;
            String strCSVBody = csvBody.toString();
            List<String> lstRows = strCSVBody.split('\n');
            Integer columnIndex = null;
            String finalCSV = lstRows[0];
            List<String> lstHeader = finalCSV.split(',');
            for(Integer i = 0; i < lstHeader.size(); i++){
                if(lstHeader[i].contains('LDCNumber')){
                    columnIndex = i;
                    break;
                }
            }
            if(columnIndex == null) continue;
            for(Integer i = 1; i < lstRows.size(); i++){
                List<String> lstCoumn =  lstRows[i].split(',');
                lstCoumn.set(columnIndex, mapAccount_LDCValue.get(objAttachment.ParentId));
                finalCSV += '\n' + String.join(lstCoumn, ',');
            }
            objAttachment.body = Blob.valueOf(finalCSV);
            lstAttachmentToUpdate.add(objAttachment);
        }
        update lstAttachmentToUpdate;
    }

 
Hi all,

I want to send/upload  salesforce data and files to sharepoint.
how can i Achieve these please let me know, i already use file connect but  i am not able to upload salesforce data or file to sharepoint. 
Hi all,

I have a vf page where i have 2 selectlist.
1.Shows all object
2.shows the field of selected object.
i want to search a given string in selected object selected field how can i achieve these any suggestion plz.
Apex class: 
public class objectController
{


   public Map <String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();

   public String selectedObject {get; set;}

   public String selectedField {get; set;}
   
   public String newValue {get; set;}
   
   public String searchValue{get;set;}

   Public objectController()
   {   
   
   
       selectedObject = 'account';
   }

   public List<SelectOption> getObjectNames() 
   {
       List<SelectOption> objNames = new List<SelectOption>();
       List<String> entities = new List<String>(schemaMap.keySet());
       entities.sort();
       for(String name : entities)
       {
           objNames.add(new SelectOption(name,name));
       }
       return objNames;
    }

    public List<SelectOption> getObjectFields() 
    {
           Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
           Schema.SObjectType ObjectSchema = schemaMap.get(selectedObject);
           Map<String, Schema.SObjectField> fieldMap = ObjectSchema.getDescribe().fields.getMap();
           List<SelectOption> fieldNames = new List<SelectOption>();
           for (String fieldName: fieldMap.keySet()) 
           {  
               fieldNames.add(new SelectOption(fieldName,fieldName));
             //fieldMap.get(fieldName).getDescribe().getLabel();//It provides to get the object fields label.
           }
           return fieldNames;
     }     
     
     
    public PageReference submit() {
        String temp = selectedObject + '  ' + selectedField;
        DetailTest__c omc = new DetailTest__c();
        omc.Obj_field__c= temp;
        omc.New_Value__c= newValue ;
        
        insert omc;
    
        return null;
    } 
    
    public void search(){
    
       /*  String queryStr='select '+ id + 'from ' + selectedObject;

List<Sobject> results=Database.query(queryStr);
        */
    }
    
}
Visualforce page:
<apex:page showHeader="false" standardStylesheets="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0" controller="objectController">    
<apex:form >
<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">    

<head>
    <apex:stylesheet value="{!URLFOR($Resource.SLDS103, 'assets/styles/salesforce-lightning-design-system-vf.css')}" />
</head> 
 
  <div class="slds">
  <form class="slds-form--inline"> 
  <div class="slds-form-element">
    <div class="slds-form-element__control">
        <label class="slds-form-element__label slds-m-left--xx-large" for="select-01">Select Object</label>
            <apex:actionRegion >      
                           <apex:selectList value="{!selectedObject}" size="1">
                                    <apex:selectOptions value="{!ObjectNames}"/>
                                    <apex:actionSupport event="onchange" rerender="myFields"/>
                            </apex:selectList>
          </apex:actionRegion>
          
        <label class="slds-form-element__label slds-m-left--xx-large" for="select-01">Select Field</label>
  
        <apex:actionRegion >  
            <apex:outputPanel id="myFields">  
                           <apex:selectList value="{!selectedField}" size="1">
                                <apex:selectOptions value="{!ObjectFields}"/>
                            </apex:selectList>
           </apex:outputPanel>                  
        </apex:actionRegion>   
           
            <label class="slds-form-element__label slds-m-left--xx-large" for="text-input-01">Input Value</label>
                  <apex:inputText label="New Value" value="{!newValue }"/>
    
           
         
       </div>
         <label class="slds-form-element__label slds-m-left--xx-large" for="text-input-01">Search Value</label>
                <apex:inputText label="New Value" value="{!SearchValue }"/>  
           
  </div>
  <div class="slds-button slds-m-left--xx-large">
  
  <apex:commandButton value="Submit" action="{!submit}"/>
  
  </div>
  </form>
 </div>
 </html>
 </apex:form>
</apex:page>


 
Hi all,

I want to send/upload  salesforce data and files to sharepoint.
how can i Achieve these please let me know, i already use file connect but  i am not able to upload salesforce data or file to sharepoint. 
Hi all,

I have a vf page where i have 2 selectlist.
1.Shows all object
2.shows the field of selected object.
i want to search a given string in selected object selected field how can i achieve these any suggestion plz.
Apex class: 
public class objectController
{


   public Map <String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();

   public String selectedObject {get; set;}

   public String selectedField {get; set;}
   
   public String newValue {get; set;}
   
   public String searchValue{get;set;}

   Public objectController()
   {   
   
   
       selectedObject = 'account';
   }

   public List<SelectOption> getObjectNames() 
   {
       List<SelectOption> objNames = new List<SelectOption>();
       List<String> entities = new List<String>(schemaMap.keySet());
       entities.sort();
       for(String name : entities)
       {
           objNames.add(new SelectOption(name,name));
       }
       return objNames;
    }

    public List<SelectOption> getObjectFields() 
    {
           Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
           Schema.SObjectType ObjectSchema = schemaMap.get(selectedObject);
           Map<String, Schema.SObjectField> fieldMap = ObjectSchema.getDescribe().fields.getMap();
           List<SelectOption> fieldNames = new List<SelectOption>();
           for (String fieldName: fieldMap.keySet()) 
           {  
               fieldNames.add(new SelectOption(fieldName,fieldName));
             //fieldMap.get(fieldName).getDescribe().getLabel();//It provides to get the object fields label.
           }
           return fieldNames;
     }     
     
     
    public PageReference submit() {
        String temp = selectedObject + '  ' + selectedField;
        DetailTest__c omc = new DetailTest__c();
        omc.Obj_field__c= temp;
        omc.New_Value__c= newValue ;
        
        insert omc;
    
        return null;
    } 
    
    public void search(){
    
       /*  String queryStr='select '+ id + 'from ' + selectedObject;

List<Sobject> results=Database.query(queryStr);
        */
    }
    
}
Visualforce page:
<apex:page showHeader="false" standardStylesheets="false" sidebar="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0" controller="objectController">    
<apex:form >
<html xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">    

<head>
    <apex:stylesheet value="{!URLFOR($Resource.SLDS103, 'assets/styles/salesforce-lightning-design-system-vf.css')}" />
</head> 
 
  <div class="slds">
  <form class="slds-form--inline"> 
  <div class="slds-form-element">
    <div class="slds-form-element__control">
        <label class="slds-form-element__label slds-m-left--xx-large" for="select-01">Select Object</label>
            <apex:actionRegion >      
                           <apex:selectList value="{!selectedObject}" size="1">
                                    <apex:selectOptions value="{!ObjectNames}"/>
                                    <apex:actionSupport event="onchange" rerender="myFields"/>
                            </apex:selectList>
          </apex:actionRegion>
          
        <label class="slds-form-element__label slds-m-left--xx-large" for="select-01">Select Field</label>
  
        <apex:actionRegion >  
            <apex:outputPanel id="myFields">  
                           <apex:selectList value="{!selectedField}" size="1">
                                <apex:selectOptions value="{!ObjectFields}"/>
                            </apex:selectList>
           </apex:outputPanel>                  
        </apex:actionRegion>   
           
            <label class="slds-form-element__label slds-m-left--xx-large" for="text-input-01">Input Value</label>
                  <apex:inputText label="New Value" value="{!newValue }"/>
    
           
         
       </div>
         <label class="slds-form-element__label slds-m-left--xx-large" for="text-input-01">Search Value</label>
                <apex:inputText label="New Value" value="{!SearchValue }"/>  
           
  </div>
  <div class="slds-button slds-m-left--xx-large">
  
  <apex:commandButton value="Submit" action="{!submit}"/>
  
  </div>
  </form>
 </div>
 </html>
 </apex:form>
</apex:page>