• RAJU_DEEP
  • NEWBIE
  • 50 Points
  • Member since 2010

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 29
    Questions
  • 24
    Replies

Hello,

 

I have created two custom object say A (Parent) and B (Child) with the Lookup relationship between them, whenever i create a new record in custom object B and click on the lookup field it displays the standard field of custom object A i.e. name but my requirement is whenever i click on the lookup field it should display the custom field (type__c) instead of the standard field (name) of custom object A.

 

Is there any way to achieve this.

 

Thanks in advance

Raju.

Hello,

          Here I am creating a custom component to perform the dml operation but whenever I click on Save button is show the following error:

System.LimitException: demoPackageTest:DML currently not allowed

 

showHere is the Custom Component code:

 

<apex:component controller="Customer">
  <fieldset>
      <apex:panelgrid columns="2">
            <p>Account Name:</p>
                <apex:inputText value="{!aName}"/>
            <p>No of Employees:</p>
                <apex:inputText value="{!aEmp}"/>
            <p>Phone:</p>
                <apex:inputText value="{!aPhone}"/> 
     </apex:panelGrid>
     <apex:commandButton action="{!saveNew}" value="Save"/>
  </fieldset>
</apex:component>

 

 

Here is the Controller code:

 

public class Customer {
    public String aName {get; set;}
    public Integer aEmp {get; set;}
    public String aPhone {get; set;}
    public void saveNew(){
        Account aa = new Account(
            Name = aName,
            NumberOfEmployees = aEmp,
            Phone = aPhone
        );
        insert aa;
    }
}

 

 

Here is visualforce page code:

 

<apex:page controller="Customer">
    <c:test />
</apex:page>

 

Guide me where I am going wrong and is it possible to perform dml operation through custom component.

 

Thanks in advance

Raju.

 

 

Hello,

In my case i want to populate one of the field value automatically and the value should be the id of the current user logged in i.e. username. For this i used formula field which should do this and it is working but the problem is whenever I open that particular record through different user login(means System Administrator login and the subordinate user login) this particular field value changes asper the user, as it should be constant after the record once inserted. Can anyone help me to sort out this issue.

The code which i used in the formula field is:

$User.Username

 

Regards

Raju

Hello,

          I am the user with the profile "System Administrator" and I have created a new users under me with the custom profile which have limited access. As per the default salesforce process System Administrator can see any users records but in my case its not happening. I am unable to see my subordinate users records.

Please guide me to resolve this issue its very urgent.

Thanks in advance
Raju.

Hello,

          I am the user with the profile "System Administrator" and I have created a new users under me with the custom profile which have limited access. As per the default salesforce process System Administrator can see any users records but in my case its not happening. I am unable to see my subordinate users records.

Please guide me to resolve this issue its very urgent.

Thanks in advance
Raju.

Hello,

           I created the controller class with lots of methods. The test code also needed for this class and i written the test code for the various methods which runs fine but I stuck in the creation of test code for this two methods. Here is the Controller code for that particular method.

 

 

public String valueOne { get; set; }
public String valueTwo { get; set; }
public String valueThree { get; set; }
Attendance_Detail__c attends;
public void saveAttend()
    {
        if(attends.SignOut_Time__c != null && attends.SignIn_Time__c < attends.SignOut_Time__c){
            List<Attendance_Detail__c> updateAttendance = [select name, SignOut_Time__c, SignIn_Time__c from Attendance_Detail__c where User_Email_Id__c = :attends.User_Email_Id__c and Current_Date__c =: onlyDate];
            for(Attendance_Detail__c aDetail : updateAttendance)
            {
                if(aDetail.SignIn_Time__c != null && attends.SignIn_Time__c < attends.SignOut_Time__c)
                {
                    aDetail.SignOut_Time__c = attends.SignOut_Time__c;
                    update aDetail;
                }
            }
        }else{
            if(attends.SignIn_Time__c != null){
            Attendance_Detail__c attInsert = new Attendance_Detail__c(
                User_Email_Id__c = attends.User_Email_Id__c,
                SignIn_Time__c = attends.SignIn_Time__c,
                SignOut_Time__c = attends.SignOut_Time__c,
                Current_Date__c = onlyDate
            );
            insert attInsert;
        }
        }
        
    }
public PageReference iWantMyJSValues() 
    {
        valueOne = Apexpages.currentPage().getParameters().get('one');
        valueTwo = Apexpages.currentPage().getParameters().get('two');
        valueThree = Apexpages.currentPage().getParameters().get('three');
        attends.SignIn_Time__c = [select SignIn_Time__c from Attendance_Detail__c where User_Email_Id__c =: valueOne and Current_Date__c =: onlyDate].SignIn_Time__c;
        attends.SignOut_Time__c = [select SignOut_Time__c from Attendance_Detail__c where User_Email_Id__c =: valueOne and Current_Date__c =: onlyDate].SignOut_Time__c;
        return null;
    }

 

 

Is there any help to write the test code for this two.

 

Thanks in advance.

Raju.

 

 

 

Hello,

          I am the user with the profile "System Administrator" and I have created a new user under me with the custom profile. I have a visualforce page performing dml operation which is visible to both the users. But the problem i am facing is the record inserted by the user with custom profile is not be able to view by the user with profile System Administrator. The object in which the dml operation is performed is created by the user(System Administrator profile). The record is created by both the user through the page is viewed by both users seperately in their standard UI but I want the record created by user(Custom Profile) should be viewed by the user(System Administrator Profile) which doesn't happens.

           Is there any way to sort out this issue. Any suggestion will be helpfull for me.

 

Thanks in advance

Raju.

Hello,

            I am in a problem which seems to be silly but any how i stucked to it. I have a javascript code

 

function saveRecord()
        {
          if (document.getElementById("{!$Component.pg.frm.in}").value > document.getElementById("{!$Component.pg.frm.out}").value)
              {
              alert('SignIn time should be less then SignOut time');
              }
            else if (document.getElementById("!$Component.pg.frm.in").value != '')
              {
              alert("Record Saved Successfully...");
              }
            else
              {
              alert("Enter the SignIn Time");
              }
       }

          In this function the two datetime inputFields values is been used for the validation purpose.

 

this function is called by the command button through onclick, when i click on the button asper the condition it displays the first alert but if the condition switches to the nested if-else it doesn't shows anything. I don't know where i am going wrong. Is there any way to solve this.

 

Thanks in advance.

Raju.

 

Hello,

           I am having a form with three input fields in which first field is set required="true" and a link to log out from the salesforce. So, when ever i click on the logout link the required field shows the error:Error: You must enter a value .But before setting the field property required="true" it was working fine.

 

 

So, is there any way to solve this issue.

 

Thanks in advance.

Raju.

 

Hello,

           I am in scenerio in which whenever a new record is inserted by the user with the last name 'kumar' an email should be send to the email after fetching the email id from the email field present in the new record. This thing i am trying through trigger and that code is:

 

 

trigger updateDml2 on dml2__c (after insert, after Update) {
String[] toAddresses;
string message;
for(dml2__c d2 : Trigger.new){
if(d2.Last_Name__c == 'kumar'){

String emailID = [select Email__c from dml2__c where Last_Name__c = 'kumar'].Email__c;
Messaging.SingleEmailMessage mail1 = new Messaging.SingleEmailMessage();
toAddresses = new String[] {emailID};
mail1.setToAddresses(toAddresses);
message = 'Email alert when the new record is populated with the last name kumar...!!!';
mail1.setHtmlBody(message);
Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail1});
}
}
}

 But the problem i am facing is:

             This code is running fine when the record is inserted by one user as it return by query only one email id, but it generates the error when the query return the multiple records.

 

For the mass email i tried this code but it show the following error. I think the query returning the records of Email__c should be placed into toAddresses but i unable to do this.

Error: Compile Error: Initial term of field expression must be a concrete SObject: LIST<demoPackageTest__dml2__c> at line 16 column 41

 

 

List<dml2__c> emailID = [select Email__c from dml2__c];
Messaging.MassEmailMessage mail1 = new Messaging.MassEmailMessage();
toAddresses = new String[] {emailID.Email__c};
mail1.setToAddresses(toAddresses);
message = 'Email alert when the new record is populated with the last name kumar...!!!';
mail1.setHtmlBody(message);
Messaging.sendEmail(new Messaging.MassEmailMessage[]{mail1});

 

I am unable to figure out the problem. Is there any way to solve this problem.

 

Thanks in advance.

Raju

Hello,

           I am in scenerio in which whenever a new record is inserted by the user with the last name 'kumar' an email should be send to the email after fetching the email id from the email field present in the new record. This thing i am trying through trigger and that code is:

 

 

trigger updateDml2 on dml2__c (after insert, after Update) {
String[] toAddresses;
string message;
for(dml2__c d2 : Trigger.new){
if(d2.Last_Name__c == 'kumar'){

String emailID = [select Email__c from dml2__c where Last_Name__c = 'kumar'].Email__c;
Messaging.SingleEmailMessage mail1 = new Messaging.SingleEmailMessage();
toAddresses = new String[] {emailID};
mail1.setToAddresses(toAddresses);
message = 'Email alert when the new record is populated with the last name kumar...!!!';
mail1.setHtmlBody(message);
Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail1});
}
}
}

 But the problem i am facing is:

             This code is running fine when the record is inserted by one user as it return by query only one email id, but it generates the error when the query return the multiple records.

 

For the mass email i tried this code but it show the following error. I think the query returning the records of Email__c should be placed into toAddresses but i unable to do this.

Error: Compile Error: Initial term of field expression must be a concrete SObject: LIST<demoPackageTest__dml2__c> at line 16 column 41

 

 

List<dml2__c> emailID = [select Email__c from dml2__c];
            Messaging.MassEmailMessage mail1 = new Messaging.MassEmailMessage();
            toAddresses = new String[] {emailID.Email__c};
            mail1.setToAddresses(toAddresses);
            message = 'Email alert when the new record is populated with the last name kumar...!!!';
            mail1.setHtmlBody(message);
            Messaging.sendEmail(new Messaging.MassEmailMessage[]{mail1});

 

I am unable to figure out the problem. Is there any way to solve this problem.

 

Thanks in advance.

Raju

 

Hello,

           I am having two custom object (dml1__c and dml2__c). The relation between these two object is Lookup Relationship. I want to update the record within the click. Here is the code which i tried.

 

 

public void updateDml2(){
        List<dml2__c> d2 = [SELECT name, Last_Name__c, Other__c, dml1__r.name, dml1__r.Summary__c FROM dml2__c WHERE name =: dName];
        for(dml2__c dm2 : d2){
            dm2.Last_Name__c = lName;
            dm2.Other__c = sum;
            dm2.dml1__r.Summary__c = sum;
            update dm2;
        }
    }

 

 

In the above code when I click the update button the record is updated successfully in dml2__c custom object but the record of dml1__c custom object remains unchanged. Is there any way to do this correctly or guide where I am going wrong.

Any help will be highly appreciable.

 

Thanks

Raju

Hello,

            I am in a requirement to insert the new record in two or more custom objects and for this if I use different queries then it insert the new record easily but I want to write the single query instead of the different queries. Is there any way to achieve this functionality. The code which i tried is:

 

 

public void save() {
MotorOwner__c mo = new MotorOwner__c(
name = Name,
Address__c = add);
insert mo;

Bike__c c = new Bike__c(
name = Name,
CC__c = cC,
Make__c = make);

/*Bike__c c = new Bike__c(
name = Name,
CC__c = cC,
Make__c = make,
MotorOwner__r.name = Name);*/

insert c;
}

In the above code the different query works fine but the commented single query doesnt works. So I there any way to insert the records in the single query, guide me where I am going wrong. Any suggestion will be helpfull for me.

 

Thanks & Regards

Raju Deep

 

 

Hello Team,

 

I want to populate one text field values depending on other text field values present on same page.

I have tried this but when i put the hard coded value in the soql query its working fine and when i use variable instead of hard coded value it throws exception.I have mentioned my code below please guide me to achieve desired functionality.

 

The code which I am trying is given below:

 

Visualforce Page Code:

 

<apex:page controller="ActionPageController">
    <apex:form >
        <apex:actionFunction name="hitMe" action="{!iWantMyJSValues}" rerender="jsvalues">
            <apex:param name="one" value="" />
            <apex:param name="two" value="" />
            <apex:param name="three" value="" />
        </apex:actionFunction>
        
        <apex:outputPanel id="jsvalues">
            Value one:<apex:inputText value="{!fName}" onclick="hitMe('{!fName}', '{!$User.FirstName}', '{!emp1}')"/><br/>
            Value two:<apex:inputText value="{!valueTwo}" /><br />   
            Employee Name:<apex:inputText value="{!valueThree}" /><br />
            Employee:<apex:inputText value="{!valueOne}" /><br />           
        </apex:outputPanel>
        <!--<span style="cursor: pointer;" 
            onclick="hitMe(Date(), '{!$user.FirstName}', '{!emp1}')">Hit Me</span>-->
    </apex:form>
</apex:page>

 

 

Controller Code:

 

 

public with sharing class ActionPageController {

    public String valueOne { get; set; }
    public String valueTwo { get; set; }
    public String valueThree { get; set; }
    public String fName { get; set; }
    
    public PageReference iWantMyJSValues() {
        valueOne = Apexpages.currentPage().getParameters().get('one') ;
        valueTwo = Apexpages.currentPage().getParameters().get('two') ;
        valueThree = Apexpages.currentPage().getParameters().get('three ');
        
        return null;
    }
    String emp1 = [select Last_Name__c from Employee_Detail__c where name =: fName].Last_Name__c;
  
  public String getEmp1(){
        return emp1;
    }
}

 Code which is underlined generates this exception.

 

 

System.QueryException: List has no rows for assignment to SObject

Class.demoPackageTest.ActionPageController: line 20, column 19 Class.demoPackageTest.ActionPageController: line 1, column 27

 


Regards,

Raju Deep

Hello Team.

 

           My requirement is "i want to populate one text field value in visualforce page by selecting another field(by clicking on enter key) in the same page".

 

Scenario :

 

1. I have three text fields in my page Employee Id, Employee FName, Employee LName.

2. Whenever user will put Employee Id and press enter key  on that field(Employee Id) the related data should be populated on another two fields(Employee FName, Employee LName) .

 

Please guide me how can i achieve this functionality.

 

Thanks & regards,

Raju Deep

Hello,

           here i am creating a visualforce page which is performing two task:

1. Display the search records in the pageBlockTable.

2. Display the whole recordsin the pageBlockTable.

           there are two different pageBlockTable to do this task, but i want this task to be rendered in the same pageBlockTable i.e by default the whole records are shown but as i click to the search button the search records should be shown in the same pageBlockTable instead of showing it in seperate table, the code which i have tried is given below. Is there any way to do this. Any idea related this will be greatly appreciated...

 

Visualforce page code:

 

 

<apex:page sidebar="false" showHeader="false" controller="ShippingApps">
<apex:form>
<center>
<h1 style="font-size:40px; font-family:Comic Sans MS; font-weight:bolder">Shipping Invoice</h1><br/><br/>
<apex:outputText value="Shipping Invoice Name :"/><apex:inputText value="{!shipName}"/><br/><br/>
<apex:commandButton value="Search" action="{!doSearch}" rerender="block1" status="status"/>
</center><br/><br/>
<apex:pageBlock mode="edit" id="block1">
<apex:actionStatus id="status" startText="requesting..."/>
<apex:pageBlockSection title="Results" id="results" columns="1">
<apex:pageBlockTable value="{!results}" var="l" rendered="{!NOT(ISNULL(results))}">
<apex:column value="{!l.name}"/>
<apex:column value="{!l.Subtotal__c}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>

<apex:pageBlock title="Shipping Invoice" id="block">
<apex:pageBlockTable value="{!invoice}" var="s">
<apex:column value="{!s.name}"/>
<apex:column value="{!s.Subtotal__c}"/>
</apex:pageBlockTable>
</apex:pageBlock>

</apex:form>
</apex:page>

 

 

The ShippingApps Controller code:

 

 

public class ShippingApps{
    public String shipName{get; set;}
    
    public List<Shipping_Invoice__c> getInvoice() {
        return [select id, name, Subtotal__c, GrandTotal__c, Shipping__c, ShippingDiscount__c, Tax__c, TotalWeight__c from Shipping_Invoice__c ];
    }
    
    List<Shipping_Invoice__c> results;
    public String getShipName() {
        return shipName;
    }
    public void setShipName(String s) {
        shipName = s;
    }
    public List<Shipping_Invoice__c> getResults() {
        return results;
    }
    public PageReference doSearch() {
        results = (List<Shipping_Invoice__c>)[FIND :shipName RETURNING Shipping_Invoice__c(name, Subtotal__c, GrandTotal__c, Shipping__c, ShippingDiscount__c, Tax__c, TotalWeight__c)][0];
        return null;
    }
}

 

Thanks...

 

Hello,

           I am creating a dropdown list which has to contain the resultant data from the query. Suppose i fire the query [select id, name from Items__c] after that i want to put the retrieved records of the name field in the drop down list. Is there any way to figure out this problem. Any suggestion regarding this will be helpfull for me...

Thanks.

Hello,

           here i am creating a visualforce page which is performing two task:

1. Display the search records in the pageBlockTable.

2. Display the whole recordsin the pageBlockTable.

           there are two different pageBlockTable to do this task, but i want this task to be rendered in the same pageBlockTable, the visualforce code which i have tried is given below. Is there any way to do this. Any idea related will be greatly appreciated...

 

 

<apex:page controller="theController">
<apex:form >
<apex:pageBlock mode="edit" id="block">
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel >Search Text</apex:outputLabel>
<apex:panelGroup >
<apex:inputText id="searchText" value="{!searchText}"/>
<apex:commandButton value="Go!" action="{!doSearch}" rerender="block" status="status"/>
</apex:panelGroup>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:actionStatus id="status" startText="requesting..."/>
<apex:pageBlockSection title="Results" id="results" columns="1">
<apex:pageBlockTable value="{!results}" var="l" rendered="{!NOT(ISNULL(results))}" id="searchLead">
<apex:column value="{!l.name}"/>
<apex:column value="{!l.email}"/>
<apex:column value="{!l.phone}"/>
</apex:pageBlockTable>
<apex:pageBlockTable value="{!invoice}" var="i" id="iName">
<apex:column value="{!i.name}"/>
</apex:pageBlockTable>
</apex:pageBlockSection>

</apex:pageBlock>
</apex:form>
</apex:page>

 

 

Hello,

           In my application I want to perform the search operation in which the user will put the search keywork in the text box and as the click of the button the related results or reords has to be displayed in the same page but I unable to do this. If I do so with the hard code it works but I want the results should be displayed through the dynamically search operation...

           Any code or idea related to this will be helpfull for me...

Thanks in Advance.

Hello,

           Here i am having a object named "item" which is having a Master-Details relationship field "Shipping Invoice". I am trying to add new record but the problem is that when I insert the other fields record are easily inserted but the "Shipping Invoice" field I unable. The code which i have tried to store the record including all the fields except "Shipping Invoice" is below:

 

 

public void saveItems(){
Item__c sItem = new Item__c(
name = iName,
Price__c = price,
Quantity__c = quantity,
Weight__c = weight,
//Shipping_Invoice__c = shipInvoice
);
insert sItem;
}

 

Please help me how to insert the record...

Thanks in advance.

 

Hello,

 

I have created two custom object say A (Parent) and B (Child) with the Lookup relationship between them, whenever i create a new record in custom object B and click on the lookup field it displays the standard field of custom object A i.e. name but my requirement is whenever i click on the lookup field it should display the custom field (type__c) instead of the standard field (name) of custom object A.

 

Is there any way to achieve this.

 

Thanks in advance

Raju.

Hello,

          Here I am creating a custom component to perform the dml operation but whenever I click on Save button is show the following error:

System.LimitException: demoPackageTest:DML currently not allowed

 

showHere is the Custom Component code:

 

<apex:component controller="Customer">
  <fieldset>
      <apex:panelgrid columns="2">
            <p>Account Name:</p>
                <apex:inputText value="{!aName}"/>
            <p>No of Employees:</p>
                <apex:inputText value="{!aEmp}"/>
            <p>Phone:</p>
                <apex:inputText value="{!aPhone}"/> 
     </apex:panelGrid>
     <apex:commandButton action="{!saveNew}" value="Save"/>
  </fieldset>
</apex:component>

 

 

Here is the Controller code:

 

public class Customer {
    public String aName {get; set;}
    public Integer aEmp {get; set;}
    public String aPhone {get; set;}
    public void saveNew(){
        Account aa = new Account(
            Name = aName,
            NumberOfEmployees = aEmp,
            Phone = aPhone
        );
        insert aa;
    }
}

 

 

Here is visualforce page code:

 

<apex:page controller="Customer">
    <c:test />
</apex:page>

 

Guide me where I am going wrong and is it possible to perform dml operation through custom component.

 

Thanks in advance

Raju.

 

 

Hello,

In my case i want to populate one of the field value automatically and the value should be the id of the current user logged in i.e. username. For this i used formula field which should do this and it is working but the problem is whenever I open that particular record through different user login(means System Administrator login and the subordinate user login) this particular field value changes asper the user, as it should be constant after the record once inserted. Can anyone help me to sort out this issue.

The code which i used in the formula field is:

$User.Username

 

Regards

Raju

Hello,

          I am the user with the profile "System Administrator" and I have created a new users under me with the custom profile which have limited access. As per the default salesforce process System Administrator can see any users records but in my case its not happening. I am unable to see my subordinate users records.

Please guide me to resolve this issue its very urgent.

Thanks in advance
Raju.

Hi,

 

Please someone tell me how to pass html input text value to my apex controller.PLease  give me an example of doing so if possible .

 

 

                                                                                                                                                                                  Thanks and regards

                                                                                                                                                                                                Anu...

 

Hello,

          I am the user with the profile "System Administrator" and I have created a new user under me with the custom profile. I have a visualforce page performing dml operation which is visible to both the users. But the problem i am facing is the record inserted by the user with custom profile is not be able to view by the user with profile System Administrator. The object in which the dml operation is performed is created by the user(System Administrator profile). The record is created by both the user through the page is viewed by both users seperately in their standard UI but I want the record created by user(Custom Profile) should be viewed by the user(System Administrator Profile) which doesn't happens.

           Is there any way to sort out this issue. Any suggestion will be helpfull for me.

 

Thanks in advance

Raju.

Hello,

            I am in a problem which seems to be silly but any how i stucked to it. I have a javascript code

 

function saveRecord()
        {
          if (document.getElementById("{!$Component.pg.frm.in}").value > document.getElementById("{!$Component.pg.frm.out}").value)
              {
              alert('SignIn time should be less then SignOut time');
              }
            else if (document.getElementById("!$Component.pg.frm.in").value != '')
              {
              alert("Record Saved Successfully...");
              }
            else
              {
              alert("Enter the SignIn Time");
              }
       }

          In this function the two datetime inputFields values is been used for the validation purpose.

 

this function is called by the command button through onclick, when i click on the button asper the condition it displays the first alert but if the condition switches to the nested if-else it doesn't shows anything. I don't know where i am going wrong. Is there any way to solve this.

 

Thanks in advance.

Raju.

 

Hello,

           I am having a form with three input fields in which first field is set required="true" and a link to log out from the salesforce. So, when ever i click on the logout link the required field shows the error:Error: You must enter a value .But before setting the field property required="true" it was working fine.

 

 

So, is there any way to solve this issue.

 

Thanks in advance.

Raju.

 

Hello,

           I am in scenerio in which whenever a new record is inserted by the user with the last name 'kumar' an email should be send to the email after fetching the email id from the email field present in the new record. This thing i am trying through trigger and that code is:

 

 

trigger updateDml2 on dml2__c (after insert, after Update) {
String[] toAddresses;
string message;
for(dml2__c d2 : Trigger.new){
if(d2.Last_Name__c == 'kumar'){

String emailID = [select Email__c from dml2__c where Last_Name__c = 'kumar'].Email__c;
Messaging.SingleEmailMessage mail1 = new Messaging.SingleEmailMessage();
toAddresses = new String[] {emailID};
mail1.setToAddresses(toAddresses);
message = 'Email alert when the new record is populated with the last name kumar...!!!';
mail1.setHtmlBody(message);
Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail1});
}
}
}

 But the problem i am facing is:

             This code is running fine when the record is inserted by one user as it return by query only one email id, but it generates the error when the query return the multiple records.

 

For the mass email i tried this code but it show the following error. I think the query returning the records of Email__c should be placed into toAddresses but i unable to do this.

Error: Compile Error: Initial term of field expression must be a concrete SObject: LIST<demoPackageTest__dml2__c> at line 16 column 41

 

 

List<dml2__c> emailID = [select Email__c from dml2__c];
Messaging.MassEmailMessage mail1 = new Messaging.MassEmailMessage();
toAddresses = new String[] {emailID.Email__c};
mail1.setToAddresses(toAddresses);
message = 'Email alert when the new record is populated with the last name kumar...!!!';
mail1.setHtmlBody(message);
Messaging.sendEmail(new Messaging.MassEmailMessage[]{mail1});

 

I am unable to figure out the problem. Is there any way to solve this problem.

 

Thanks in advance.

Raju

Hello,

           I am in scenerio in which whenever a new record is inserted by the user with the last name 'kumar' an email should be send to the email after fetching the email id from the email field present in the new record. This thing i am trying through trigger and that code is:

 

 

trigger updateDml2 on dml2__c (after insert, after Update) {
String[] toAddresses;
string message;
for(dml2__c d2 : Trigger.new){
if(d2.Last_Name__c == 'kumar'){

String emailID = [select Email__c from dml2__c where Last_Name__c = 'kumar'].Email__c;
Messaging.SingleEmailMessage mail1 = new Messaging.SingleEmailMessage();
toAddresses = new String[] {emailID};
mail1.setToAddresses(toAddresses);
message = 'Email alert when the new record is populated with the last name kumar...!!!';
mail1.setHtmlBody(message);
Messaging.sendEmail(new Messaging.SingleEmailMessage[]{mail1});
}
}
}

 But the problem i am facing is:

             This code is running fine when the record is inserted by one user as it return by query only one email id, but it generates the error when the query return the multiple records.

 

For the mass email i tried this code but it show the following error. I think the query returning the records of Email__c should be placed into toAddresses but i unable to do this.

Error: Compile Error: Initial term of field expression must be a concrete SObject: LIST<demoPackageTest__dml2__c> at line 16 column 41

 

 

List<dml2__c> emailID = [select Email__c from dml2__c];
            Messaging.MassEmailMessage mail1 = new Messaging.MassEmailMessage();
            toAddresses = new String[] {emailID.Email__c};
            mail1.setToAddresses(toAddresses);
            message = 'Email alert when the new record is populated with the last name kumar...!!!';
            mail1.setHtmlBody(message);
            Messaging.sendEmail(new Messaging.MassEmailMessage[]{mail1});

 

I am unable to figure out the problem. Is there any way to solve this problem.

 

Thanks in advance.

Raju

 

Hello,

           I am having two custom object (dml1__c and dml2__c). The relation between these two object is Lookup Relationship. I want to update the record within the click. Here is the code which i tried.

 

 

public void updateDml2(){
        List<dml2__c> d2 = [SELECT name, Last_Name__c, Other__c, dml1__r.name, dml1__r.Summary__c FROM dml2__c WHERE name =: dName];
        for(dml2__c dm2 : d2){
            dm2.Last_Name__c = lName;
            dm2.Other__c = sum;
            dm2.dml1__r.Summary__c = sum;
            update dm2;
        }
    }

 

 

In the above code when I click the update button the record is updated successfully in dml2__c custom object but the record of dml1__c custom object remains unchanged. Is there any way to do this correctly or guide where I am going wrong.

Any help will be highly appreciable.

 

Thanks

Raju

Hello Team.

 

           My requirement is "i want to populate one text field value in visualforce page by selecting another field(by clicking on enter key) in the same page".

 

Scenario :

 

1. I have three text fields in my page Employee Id, Employee FName, Employee LName.

2. Whenever user will put Employee Id and press enter key  on that field(Employee Id) the related data should be populated on another two fields(Employee FName, Employee LName) .

 

Please guide me how can i achieve this functionality.

 

Thanks & regards,

Raju Deep

We are using a rich text field called "Photo" on the contact record to display a photo of our students.  We are trying to create a photo directory that looks like what I have below, but that will automatically update if the photo on the contact record is changed.  Also the name beneath the photo should be updated if the contact's name changes.  Is it possible to create dynamic output fields that pull from many different records?  Please help if you can.  Also, I've attached the first bit of the code I used the create the visualforce page you see below.

 

 


 

 

<apex:page >
<apex:panelGrid columns="5" id="Grid" cellspacing="10" style="text-align:center">
<apex:image value="/servlet/rtaImage?eid=0038000000pNGC4&feoid=00N80000004jxdb&refid=0EM8000000000MW"/>
<apex:image value="/servlet/rtaImage?eid=0038000000jKEiu&feoid=00N80000004jxdb&refid=0EM8000000000RS"/>
<apex:image value="/servlet/rtaImage?eid=0038000000fW3Jn&feoid=00N80000004jxdb&refid=0EM8000000000RI"/>
<apex:image value="/servlet/rtaImage?eid=0038000000tiK9z&feoid=00N80000004jxdb&refid=0EM8000000000QE"/>
<apex:image value="/servlet/rtaImage?eid=0038000000rxa0l&feoid=00N80000004jxdb&refid=0EM8000000000Ow"/>
<apex:outputLink value="/0038000000pNGC4">Noreen Alladina</apex:outputLink>
<apex:outputLink value="/0038000000jKEiu">Ken Andersen</apex:outputLink>
<apex:outputLink value="/0038000000fW3Jn">William Arnold</apex:outputLink>
<apex:outputLink value="/0038000000tiK9z">Gregory Ayers</apex:outputLink>
<apex:outputLink value="/0038000000rxa0l">Austen Bannan</apex:outputLink>

 

 

I'm having trouble forcing these 2 pageBlocks to be the same size. Any suggestions?

I would like 'My Chatter' to take up 50% of the page and 'Whose following who?' to take 50% as well.

 

Hello,

           I am creating a dropdown list which has to contain the resultant data from the query. Suppose i fire the query [select id, name from Items__c] after that i want to put the retrieved records of the name field in the drop down list. Is there any way to figure out this problem. Any suggestion regarding this will be helpfull for me...

Thanks.

Hello,

           In my application I want to perform the search operation in which the user will put the search keywork in the text box and as the click of the button the related results or reords has to be displayed in the same page but I unable to do this. If I do so with the hard code it works but I want the results should be displayed through the dynamically search operation...

           Any code or idea related to this will be helpfull for me...

Thanks in Advance.

Hi,

    I have a visualforce page, in which two fields are present. One is 'Account Name' which is a look up on Account object, other field is a textbox named as Account number.

Is it possible on select of a particular account, automatically Account number also get populated to the input TextText.

 

Thanks,

Raj