• Muthuraj T
  • NEWBIE
  • 120 Points
  • Member since 2015

  • Chatter
    Feed
  • 4
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 41
    Replies

Hi
<apex:inputField value="{!Empolyee_Details__c.name}"/>
                  <apex:inputfile value="{!Empolyee_Details__c.ID}" filename="{!Empolyee_Details__c.name}"></apex:inputfile>
 i wrote the above statements which  will come as CHOOSE FILE option.Through CHOOSE FILE option i uploaded file but it was showing ERROR.please tell me solution.

THANKS

RANGA
        
        

Hai,
I want try actionpoller component in vf page but it is not working 
vf page code
<apex:page controller="ActionPollar_Controller" showHeader="true" tabStyle="case" sidebar="false">
<apex:form >
<apex:pageBlock >
<h1>Company Details</h1>
<apex:pageBlockTable id="compde" value="{!compdetails}" var="i">
<apex:column headerValue="Name"/>
<apex:outputLink value="/{!i.id}">{!i.Name}</apex:outputLink>

</apex:pageBlockTable>
</apex:pageBlock>
<apex:actionPoller action="{!pollAction}" reRender="compde" interval="10"/>
</apex:form>
</apex:page>
controller
-----------------

public class ActionPollar_Controller 
{

    public Account[] getCompdetails() {
         compdetails = Database.query(query);
        return compdetails;
    
    }

    Account[] compdetails;
    string query = 'select id,name from  Account limit 15';
    
    public pagereference pollAction()
    {
        compdetails = Database.query(query);
        return null;
    
    }

}

how can i do .please help me
Public Class JSONParseDisplay{


Public Static void ParseJSON() {

  
  String Jsonstrn = '{"userDevices":[{"asserts":[" 2015-8-06 22:48:00"," 2015-8-06 22:48:00"],"battery":{"percentage":20,"voltage":3745},"deviceId":29308103,"deviceSerialNumber":"12EB5676534B","deviceType":"Charge HR","deviceWireId":"eb5672212b12","fwVersionRaw":"APP18.84 BSL18.84","hardwareVersion":"9","lastSyncClient":"api/sync-CLIENT-VISIBLE/mobile-ios/401","lastSyncedAt":"2015-08-10T13:27:56.000Z","pairedAt":"2015-04-10T19:51:15.000Z","pairedToEmail":"afit@somewhere.com"}]}';

//String Jsonstrn = '{"userDevices":[' +'{"asserts":[" 2015-8-06 22:48:00"," 2015-8-06 22:48:00"],"battery":[' +'{"percentage":20,"voltage":3745}],"deviceId":29308103,"deviceSerialNumber":"12EB5676534B","deviceType":"Charge HR","deviceWireId":"eb5672212b12","fwVersionRaw":"APP18.84 BSL18.84","hardwareVersion":"9","lastSyncClient":"api/sync-CLIENT-VISIBLE/mobile-ios/401","lastSyncedAt":"2015-08-10T13:27:56.000Z","pairedAt":"2015-04-10T19:51:15.000Z","pairedToEmail":"afitbitter@somewhere.com"}' +']}';

   JSONParser parser = JSON.createParser(Jsonstrn);
   System.debug('parser' +parser);
   while (parser.nextToken() != null) {
   
     if (parser.getCurrentToken() == JSONToken.START_ARRAY) {
     
         while (parser.nextToken() != null) {
         
          if (parser.getCurrentToken() == JSONToken.START_OBJECT) {
          
          
          UserDevice usd = (UserDevice)parser.readValueAs(UserDevice.class);
          System.debug('usd++ : ' +usd);
          System.debug('pairedAt: ' +usd.pairedAt);
          
         // System.debug('Size of batteries: ' +usd.batteries.size());
          System.debug('batteries: ' +usd.batteries);
          
          String s = JSON.serialize(usd);
          System.debug('Serialized invoice: ' + s);
          
          parser.skipChildren();
              
           }
              
        }

     } 
    
   }

 }
 
 public class UserDevice {
        
        List<string> asserts;
       List<battery> batteries;
      // List<string> batteries;
        public Double deviceId;
        public string deviceSerialNumber;
        public string deviceType;
        public string deviceWireId;
        public string fwVersionRaw;
        public Double hardwareVersion;
        public string lastSyncClient;
        public string lastSyncedAt;
        public string pairedAt;
        public string pairedToEmail;
        
        public UserDevice(List<string> asser,List<battery> batt,Double devId,string deviceSerNumber,string devType,string devWireId,string fwVersRaw,Double hardVersion,string lastSyClient,string lastSyedAt,string paredAt,string paredToEmail){
        
        asserts = asser;
       batteries = batt.clone();
       // batteries = Double.parseDouble(batt);
      // batteries = batt;
      //  System.debug('batt.clone(): ' +batt.clone());
        deviceId = devId;
        deviceSerialNumber = deviceSerNumber;
        deviceType = devType;
        deviceWireId = devWireId;
        fwVersionRaw = fwVersRaw;
        hardwareVersion = hardVersion;
        lastSyncClient = lastSyClient;
        lastSyncedAt = lastSyedAt;
        pairedAt = paredAt;
        pairedToEmail = paredToEmail;
        
        System.debug('pairedToEmail: ' +pairedToEmail);
   }     
 
 }
 
 public class battery {
        public Double percentage;
        public Double voltage;
        //System.debug('voltage::' +voltage);     
 
 
 } 


}
Hi, I have what I think should be a very simple trigger that is intended to prevent users from deleting Events unless they are the user that created it. 

This is the code:
trigger NoDeleteonEvent on Event (before delete)
{

       
       for (Event a : Trigger.old)     

       {           

          if (UserInfo.getUserId() != a.CreatedBy.Id)

          {

             a.addError('You cannot delete an event that was assigned to you by another person');

          }
       }

}

The problem is that the code prevents all users from deleting Events, even if they are the CreatedBy user. So I assume the problem is with this line ( if (UserInfo.getUserId() != a.CreatedBy.Id) ), though I'm not sure what the problem with it is. 

Any advice is much appreciated. Thank you!
Hi,

Can we configure AllOrNone settings in Informatica? 

Data loaded to SFDC via Informatica tool, we are facing issue like if any one of the record failed to insert the whole 200 records also got failed.
To avoid that, Do we have any settings like All_Or_None to allow valid data to be processed and only the invalid data to be failed. 

If the whole batch of 200 records failed, it is very difficult to analyze 200 records and find the error.

Hi
<apex:inputField value="{!Empolyee_Details__c.name}"/>
                  <apex:inputfile value="{!Empolyee_Details__c.ID}" filename="{!Empolyee_Details__c.name}"></apex:inputfile>
 i wrote the above statements which  will come as CHOOSE FILE option.Through CHOOSE FILE option i uploaded file but it was showing ERROR.please tell me solution.

THANKS

RANGA
        
        

Hi All,

I am using below Trigger code to send notifications to external webservice
if(Trigger.isUpdate){
        contact old = Trigger.oldMap.get(c.Id);
        if (c.Email != old.Email||c.FirstName!=old.FirstName||c.LastName!=old.LastName||c.phone!=old.phone||c.Title__c!=old.Title__c||c.status__c!=old.status__c||c.AccountID!=old.AccountID||c.Accounts__r.Name!=old.Account__r.Name)
but my error is only in the last part  c.Accounts__r.Name!=old.Account__r.Name i want the trigger to fire when the account name is edited Like for Example when Account name "SFDC" is edited to "SFDC.COM" the related contacts of the account is also changed to SFDC.COM. i want the trigger to fire when this name change occurs in the account name field of contact object that is the reason for adding this  c.Accounts__r.Name!=old.Account__r.Name  but it is not working giving me Compile Error: Invalid foreign key relationship: Contact.Accounts__r

Please help me resolve this issue.

Thanks
Abraham
Hi All,

I have a batch class which runs to delete old records, which in turn triggers a trigger on before delete. Now when the trigger runs it hits dml limit as calling class dml statements is running inside loop.

Can anyone help how to resolve this issue.

Below is the class and trigger -

    trigger OpportunityTrigger on X_Opportunity__c (before delete) 
    {
        
            for (X_Opportunity__c o : Trigger.old)
            {
                OpportunityMethods.opportunityDeleted(o);
            }
        
    }


    public class OpportunityMethods
    {

    public static void opportunityDeleted(X_Opportunity__c o)
        {
            deleteOpportunityAccounts(o);
            deleteOpportunitySalesTeams(o);
            deleteOpportunityLineItems(o);
        }


    private static void deleteOpportunityAccounts(X_Opportunity__c o)
        {
            List<X_Opportunity_Account__c> opportunityAccounts = getOpportunityAccounts(o);
            delete opportunityAccounts;
        }

    private static void deleteOpportunitySalesTeams(X_Opportunity__c o)
        {
            List<X_Opportunity_Sales_Team__c> salesTeams = getOpportunitySalesTeams(o);
            delete salesTeams;
        }
        private static void deleteOpportunityLineItems(X_Opportunity__c o)
        {
            List<X_Opportunity_Line_Item__c> opportunityLineItems = getOpportunityLineItems(o);
            delete opportunityLineItems;
        }
    private static List<X_Opportunity_Account__c> getOpportunityAccounts(X_Opportunity__c o)
        {
            List<X_Opportunity_Account__c> opportunityAccounts =
                    [select Id, Account__c, Advertiser__c, Agency__c, Close_Date__c, 
                            Opportunity__c, Stage__c, Total_Amount__c
                     from   X_Opportunity_Account__c
                     where  Opportunity__c = :o.Id];
            
            return opportunityAccounts;
        }
    private static List<X_Opportunity_Sales_Team__c> getOpportunitySalesTeams(X_Opportunity__c o)
        {
            List<X_Opportunity_Sales_Team__c> salesTeams =
                   [select Id, Opportunity__c, Sales_Rep__c, Split_Percent__c, OwnerId
                    from   X_Opportunity_Sales_Team__c
                    where  Opportunity__c = :o.Id];

            if (salesTeams == null || salesTeams.size() == 0)
            {

                salesTeams = new List<X_Opportunity_Sales_Team__c>();
                X_Opportunity_Sales_Team__c ost = new X_Opportunity_Sales_Team__c();
                ost.Opportunity__c = o.Id;
                ost.Sales_Rep__c = o.OwnerId;
                ost.OwnerId = o.OwnerId;
                ost.Split_Percent__c = 100.00;
                
                insert ost;
                
                salesTeams.add(ost);
            }               
            return salesTeams;
        }
    private static List<X_Opportunity_Line_Item__c> getOpportunityLineItems(X_Opportunity__c o)
        {
            List<X_Opportunity_Line_Item__c> opportunityLineItems =
                    [select Id, Opportunity__c, Product__c, Product_Amount__c, Sales_Rep__c, OwnerId
                     from   X_Opportunity_Line_Item__c
                     where  Opportunity__c = :o.Id];
            
            return opportunityLineItems;
        }    
        

    }


  • September 22, 2015
  • Like
  • 0
I created a roll up smmary field to calclate the sum of detail record values whose created date is today().

Every day we create detail records so want to roll up the records whose created date is only today. (records which are created from 12:AM to 11:59 PM). I cold not use created date is eqal to today in filter criteria while creating the roll up summary fields.

Please help:

 

how to create the custom detail page when i click the ID .please send me the code.
Below  that i have posted the code.
  VF PAGE

<apex:page controller="Custom_pagenations" tabStyle="Empolyee_Details__c">
  <apex:form >
        <apex:pageBlock >
 <apex:pageBlockTable value="{!Flightinfo}" var="o">
             <apex:column >
                   <apex:outputLink value="/{!o.EmpId__c}">{!o.name}</apex:outputLink>
</apex:column>  
               <apex:column value="{!o.EmpId__c}"/>
                <apex:column value="{!o.FirstName__c}"/>
                  <apex:column value="{!o.LastName__c}"/>
                 <apex:column value="{!o.Mobile_Number__c}"/>
                  <apex:column value="{!o.E_mail_if_any__c }"/> 
 </apex:pageBlockTable>
            <apex:commandButton rendered="{!setCon.hasPrevious}" value="first" action="{!setCon.first}"/>
            <apex:commandButton rendered="{!setCon.hasPrevious}" value="Previous" action="{!setCon.previous}"/>
            <apex:outputText rendered="{!(setCon.pageNumber * setCon.pageSize) < setCon.ResultSize}" value="{!setCon.pageNumber * setCon.pageSize} Of {!setCon.ResultSize}"></apex:outputText
            <apex:outputText rendered="{!(setCon.pageNumber * setCon.pageSize) >= setCon.ResultSize}" value="{!setCon.ResultSize} Of {!setCon.ResultSize}"></apex:outputTex 
            <apex:commandButton rendered="{!setCon.hasNext}" value="next" action="{!setCon.next}"/>
            <apex:commandButton rendered="{!setCon.hasNext}" value="last" action="{!setCon.last}"/>
       </apex:pageBlock>
    </apex:form>
</apex:page>

CONTROLLER
public class Custom_pagenations {
    public List<Empolyee_Details__c> getFlightinfo() {
        setCon.setpagesize(10);
         return  setCon.getRecords();
    }
    public ApexPages.StandardSetController setCon {
        get {
            if(setCon == null) {
                setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
                      [select id, name, EmpId__c, FirstName__c,LastName__c,Mobile_Number__c,E_mail_if_any__c,Technologies__c  FROM Empolyee_Details__c]));
            }
            return setCon;
        }
        set;
    } 
}


User-added image

     
Above screenshot is the RECORD LIST PAGE. when i will click the FIRSTCOLUMN(UNDERLINE FIELD),it goes to related RECORD DETAIL PAGE.

THANKS

RANGA

























           

Hai,
How create custo record detail page by using standard controller (or) custom controller
here my vf page
<apex:page sidebar="false" standardController="Employee_Information__c" >
<apex:form >
<apex:pageBlock title="Record Detail Page">
<apex:pageBlockSection title="Record Page">
<p> First Name  :::   {!Employee_Information__c.First_Name__c} Employee_Information__c</p>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

please help me any one
I have a visualforce page to display some basic account data. The page uses the standard Account controller with a custom extension. Basically I just want the page to display the sum of all the related donations (Donation__c) via  {!TotalDonations }.
My custom controller is intended to get this information using a get method and SOQL query but I just can’t get it to work. I’ve tried several variations of code but have been unsuccessful. If anyone can help point me in the right direction it would be greatly appreciated.
 
 
 
 
 
public with sharing class MyTabbedExtension {
public MyTabbedExtension(ApexPages.StandardController controller) {
}
       
public integer totaldonations(){
return database.query(SELECT Sum(Donation_Amount__c) FROM Donation__c WHERE Parent_Account__c = :ApexPages.currentPage().getParameters().get('ID'));
}
 // THIS WAS JUST ANOTHER ATTEMPT THAT DID NOT WORK  
Public list <Donation__c> getTotalDonations(){    
return totalDonations = [SELECT Sum(Donation_Amount__c) FROM Donation__c WHERE Parent_Account__c = :ApexPages.currentPage().getParameters().get('ID')];
}
   
 
}
Hai,
I want try actionpoller component in vf page but it is not working 
vf page code
<apex:page controller="ActionPollar_Controller" showHeader="true" tabStyle="case" sidebar="false">
<apex:form >
<apex:pageBlock >
<h1>Company Details</h1>
<apex:pageBlockTable id="compde" value="{!compdetails}" var="i">
<apex:column headerValue="Name"/>
<apex:outputLink value="/{!i.id}">{!i.Name}</apex:outputLink>

</apex:pageBlockTable>
</apex:pageBlock>
<apex:actionPoller action="{!pollAction}" reRender="compde" interval="10"/>
</apex:form>
</apex:page>
controller
-----------------

public class ActionPollar_Controller 
{

    public Account[] getCompdetails() {
         compdetails = Database.query(query);
        return compdetails;
    
    }

    Account[] compdetails;
    string query = 'select id,name from  Account limit 15';
    
    public pagereference pollAction()
    {
        compdetails = Database.query(query);
        return null;
    
    }

}

how can i do .please help me
VF PAGE
<apex:page controller="OnloadCallPage" action="{!navigate}">
</apex:page>

CONTROLLER
public class OnloadCallPage{ public pageReference navigate(){ pageReference pagRef = New pageReference('/a05/eretURL=%2Fa05%2Fo'); return pagRef; } }
      Above code is PAGEREFERENCE code.i am not understanding the this URL: /a05/eretURL=%2Fa05%2Fo.Please tell me the how to get this URL.



'/a05/eretURL=%2Fa05%2Fo'


Hi all, 

     i have one field in child and parent, in child object i.e. bank_balance__C and in parent object i.e. Totalbankbalance__C. so, i need to get totalbankbalance__C from bank_balance__C .
 For example,
             record1------- bank_balance__C =100
             record2------- bank_balance__C =100
             record3------- bank_balance__C =100
my required field is totalbankbalance__C =bank_balance__C+bank_balance__C+bank_balance__C
                             totalbankbalance__C=300.

can any one help me.
thanks in advance
Thulasi