• neophyte
  • NEWBIE
  • 235 Points
  • Member since 2010

  • Chatter
    Feed
  • 9
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 54
    Replies

Hi folks,

 

I'm looking for a way to email the custom object record owner when a note is added to that custom object record. My intial thoughts are that a) a trigger that operates on notes would cause an email to be sent to the record owner any time a note is added to any record, so... b) it might be a good idea to set up some kind of dummy variable that changes when a new note is added to a custom object record and from there, use a workflow to trigger this email alert. Question is... how can I query for new notes added to my custom object? Any ideas? I'd be eternally grateful. I'll buy you chocolate/beer/a similar value gift of your choosing...

 

Thanks,

Lee

Hi,

 

i have a custom field called "url" on Product2 i just want to set it to my OpportunitLineItem when i'll add one to my opportunity.

i wrote the trigger below:

 

trigger SetSpecialProductInfo on OpportunityLineItem (before insert) {
    for(OpportunityLineItem op : Trigger.new){
    	if(op.Id_uad__c == 0){
    		String url = [Select URL__c From Product2 Where Id = :op.PricebookEntry.Product2Id limit 1];
			op.Image_Url__c = url;
			update op;
    	}
    }
}

i got this error: Save error: Illegal assignment from LIST<Product2> to String

i was thinking that if i use the "limit 1" i'll prevent the multiple result but it looks like doesn't work =/

 

Thanks

If  we can't use private variables on visualforce pages then where we can use it ?

An image should  appear as link and it should redirect to another visualforce page.

How can I achieve this?

  • September 24, 2012
  • Like
  • 0

My Org has more than 100k leads and I need to make a SOQL query on the Lead Object.

 

My question is, if query on the standard email field, will I hit the governor limit ?

My query would look like :

for(Lead lid  : [SELECT email,OwnerId FROM Lead WHERE email != null AND email =:setLeadEmail     AND IsDeleted = false AND IsConverted = false ]

I am working on a VF page and want to control the cursor after I call the calcRevenue method in the controller. Currently, when the panel refreshes, the cursor is stuck at the upper left-hand of the screen. I want to tab through each field, change values, if necessary, then tab to the next field. I figure there is some javascript involved, but I'm not sure how to invoke it. 

 

Any help would be greatly appreciated. I'll even buy you a beer. 

 

<apex:outputPanel Id="GPS_Print_Area">
 <apex:PageBlockSection title="GPS Print Products" id="schedulePrintProducts_GPSD" columns="1" rendered="{!is_GPS_Distribution_OppRecType}" >
  <apex:pageBlocktable value="{!schedulePrintArray}" var="e_GPSD" style="width:100%" >
				
   <apex:column headerValue="Product"  >
    <apex:outputText styleClass="myClass"  value="{!e_GPSD.iProdName}" />
   </apex:column>
   <apex:column headerValue="Rate/Copy" Id="GPSD_RateCopy">
    <apex:inputField value="{!e_GPSD.iOLI.Rate__c}">
     <apex:actionSupport event="onchange" action="{!calcRevenue}" reRender="GPS_Print_Area">
     </apex:actionSupport>
    </apex:inputField>                         
   </apex:column>
   <apex:column headerValue="Avg Copies/Pub Day" Id="GPSD_AvgCopies">
    <apex:inputField value="{!e_GPSD.iOLI.AvgUnits__c}" >
     <apex:actionSupport event="onchange" action="{!calcRevenue}" reRender="GPS_Print_Area" />
    </apex:inputField>
   </apex:column>

   <apex:column headerValue="# Pub Days/Year" Id="GPSD_PubDays" >
    <apex:inputField value="{!e_GPSD.iOLI.DaysInTimePeriod__c}" >
     <apex:actionSupport event="onchange" action="{!calcRevenue}" reRender="GPS_Print_Area" />
   </apex:inputField>
  </apex:column>

  <apex:column headerValue="Contract Duration (Months)" Id="GPSD_Duration" >
   <apex:inputField value="{!e_GPSD.iOLI.Contract_Duration_Months__c}" >
    <apex:actionSupport event="onchange" action="{!calcRevenue}" reRender="GPS_Print_Area" />
   </apex:inputField>
  </apex:column>

  <apex:column headerValue="Projected Revenue" Id="GPSD_Revenue" >
   <apex:inputField value="{!e_GPSD.iOLI.UnitPrice}" >
						   
   </apex:inputField>
  </apex:column>
					
  <apex:column headerValue="Override" >
   <apex:inputField value="{!e_GPSD.iOLI.UnitPriceIsOverridden__c}" />
  </apex:column>					

  <apex:column headerValue="Start Date">
   <apex:inputField value="{!e_GPSD.iOLI.ServiceDate}" required="false" />
  </apex:column>

  

	
  </apex:pageBlocktable>
 </apex:PageBlockSection>
</apex:outputPanel>

 

Thanks, 

 

Chuck

 

I need an apex trigger that will send an email alert to both the Lead owner and the Lead Owners Manager when a lead has not been read for 2 days after the created date. 

 

Can anyone help me write the trigger and the Test Class for the trigger. 

  • September 20, 2012
  • Like
  • 0

Hi,

 

I have an external wsdl which has been parsed into apex classes. There is an endpoint to it and the end point is different for production and sandbox. The sandbox should point out to sandbox endpoint of the external wsdl and the production points out to the production wsdl endpoint. Is there any way so that i can write a code which can help me in detecting the environment  so that the code determines if the environment is sandbox then endpoint points to the sandbox wsdl.

Hi,

 

I want to send emails through Exact Target using Exact Target's WSDL. I am not able to find any documentation related to this. Please elp me in doing this in APEX.

 

  • September 20, 2010
  • Like
  • 0

I am facing the exact problem being described here.

 

My header looks like this:

 

<env:Header>
<Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-ecext-1.0.xsd">
<UsernameToken><Username>username</Username>
<Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest" />
</UsernameToken>
<TimeStamp />
</Security>
</env:Header>

 

This is when the class is :

public class Password_element {
public String Type_x;
private String[] Type_x_att_info = new String[]{'Type'};
private String[] apex_schema_type_info = new String[]{'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd','true','false'};
private String[] field_order_type_info = new String[]{};

public Password_element(String typeOfpwd)
{
this.Type_x = typeOfpwd;
}
}

 

If I add an extra element in the class: Like: 

 public String Password;

 private String[] Password_type_info = new String[]{'Password','http://www.w3.org/2001/XMLSchema','string','0','1','false'};

 

Then the header looks like :

<Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest" > <Password> Password </Password></Password>

 

How do I set the password without adding an additional tag?

 

Thanks,

Anand

Hi,

 

I am trying to create a word file attachment in the visualforce email template. The code I use inside the template is as follows:

 

<messaging:attachment filename="{!relatedTo.name}.doc" > 
    <html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word">
    <head>
    <meta name="contentType"
    <meta name="ProgId" content="Word.Document" />
    <meta name="Generator" content="Microsoft Word 12" />
    <meta name="Originator" content="Microsoft Word 12" />
    
    </head>
    
    <body>
<div>
<table>       
<apex:repeat var="cx" value="{!relatedTo.ChildRelationName__r}">
<tr>
<td> <apex:outputField value="{!cx.field1__c}"/> </td>
<td> <apex:outputField value="{!cx.field2__c}"/> </td>
<td> <apex:outputField value="{!cx.field3__c}"/> </td>
</tr>
</apex:repeat>
</table>
</div>
</body>
</html>

</messaging:attachment>

 

 

But the attached word file always shows error when I try to open it.

 

We could set the attribute contentType="application/msword" for apex:page, but I don't seem to find any such attribute for messagin:attachment.

 

I just wanted to know if anyone has done this? Any help is appreciated!!

 

Thanks!!

 

Hello All,

 

I need youe help.

 

I am writing an VF page which does need to diplay " Account and Contact "   Name in seperate columns in the same pageBlockTable.

 

I am geeting error 

 

Error: Could not resolve the entity from <apex:outputField> value binding '{!showData.catchAcc.name}'. <apex:outputField> can only be used with SObject fields.

 

 

Here is the below code snippet.

 

<apex:page controller="AllData" sidebar="false" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!passingData}" var="showData">
<apex:column headerValue="AccountName">
<apex:outputField value="{!showData.catchAcc.name}"/>
</apex:column>
<apex:column headerValue="ContactName">
<apex:outputField value="{!showData.catchCon.name}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

Apex Controller-

 

public class AllData
{
    public List<innerClass> passingData { get; set; }
    public List<Account> allAcc {get;set;}
    public List<Contact> allCon{get;set;}
    
    
    public AllData()
    {
       passingData=new List<innerClass>();
       allAcc=[select id,name from Account limit 10];
       allCon=[select id,name from Contact limit 10];
       innerClass allAddData=new innerClass(allAcc ,allCon);
       passingData.add(allAddData);
    
    
    }
    
    public class innerClass
    {
         
        public List<Account> catchAcc {get;set;}
        public List<Contact> catchCon {get;set;}
        public innerClass(list<Account> gettingaccs,list<Contact> gettingcons)
        {    
            catchAcc = gettingaccs;
            catchCon = gettingcons;
        }
    
    }
    
    
    
    
    
    
    
    
}

 

 

Thanks for your all valuable suggestions.

 

it will help me to improve the way of coding .

 

 

Thanks,

JaanVivek

 

Hi folks,

 

I'm looking for a way to email the custom object record owner when a note is added to that custom object record. My intial thoughts are that a) a trigger that operates on notes would cause an email to be sent to the record owner any time a note is added to any record, so... b) it might be a good idea to set up some kind of dummy variable that changes when a new note is added to a custom object record and from there, use a workflow to trigger this email alert. Question is... how can I query for new notes added to my custom object? Any ideas? I'd be eternally grateful. I'll buy you chocolate/beer/a similar value gift of your choosing...

 

Thanks,

Lee

Hi,

 

I need to pass some records selected using an input checkbox field on a visualforce page to a controller. The list of selected records have to be updated with already selected lookup field value on the same visual force page.

 

Hence, the list of selected records and lookup field value should be passes over to a controller class.

 

Please find below code and suggest if there is an idea.

 

VFCODE:

 

<apex:page StandardController="User" id="thePage" Extensions="UserData">
  <apex:form >
  <apex:pageBlock title="SelectUsers" id="USERSLIST" mode="edit">
    <h1>Update Sales Co-ordinator for the users in Particular Region</h1>
  <br></br>
  <br></br>
   Select Region of the user:
    
   <apex:inputField id="startMode" value="{!User.Region__c}" />
   <br></br>
      <apex:commandButton action="{!doSearch}" value="Search" >               
   </apex:commandButton>
  <br></br> 
  <apex:pageBlockSection >
   <apex:inputField value="{!User.ManagerId}" id="Check"/>
  </apex:pageBlockSection>       
  <apex:pageBlockTable value="{!results}" var="t">
        <apex:column headerValue="Select">
        <apex:inputCheckbox id="checkedone">
        </apex:inputCheckbox></apex:column>
        <apex:column value="{!t.Name}"/>
        <apex:column value="{!t.Email}"/>
        <apex:column value="{!t.Region__c}"/>
        <apex:column value="{!t.Manager__c}"/>
      
  </apex:pageBlockTable> 
  <apex:commandButton value="UpdateManager" action="{!UpdateManager}"/>
  </apex:pageblock>    
  </apex:form>
  </apex:page>

 

CONTROLLER:

 

public class UserData {
PUBLIC String usr{get;set;}
PUBLIC List<selectOption> usrs;
List<User> results=new List<User>();

public User user;
String Regionid;
String Region;
  public UserData(ApexPages.StandardController controller)
   {
     this.user= (User)controller.getRecord();
   }
    
  public Pagereference doSearch()
     {
      results = [select Name,Region__c,Email,LanguageLocaleKey,Manager__c from User Where Region__c  =:User.Region__c];
     
      system.debug('USERSLISTFOR REGION$$$$'+results);
      return null;
     }

 

public List<User> getResults()
    {
        return results;
    }
     
     
   Public Pagereference UpdateManager()
   {
    for(User sluser: selectedusers)
    {
       

     //Update the all the selected users with the  manager id highlighted in the VF page.

 

    }
    return null;
   }
       
    
 }

 

 

 

 

Hi,

 

i have a custom field called "url" on Product2 i just want to set it to my OpportunitLineItem when i'll add one to my opportunity.

i wrote the trigger below:

 

trigger SetSpecialProductInfo on OpportunityLineItem (before insert) {
    for(OpportunityLineItem op : Trigger.new){
    	if(op.Id_uad__c == 0){
    		String url = [Select URL__c From Product2 Where Id = :op.PricebookEntry.Product2Id limit 1];
			op.Image_Url__c = url;
			update op;
    	}
    }
}

i got this error: Save error: Illegal assignment from LIST<Product2> to String

i was thinking that if i use the "limit 1" i'll prevent the multiple result but it looks like doesn't work =/

 

Thanks

Hi friends,

 

Can u tell me, How can i show the bold font in javascript alert message?

 

I tried with both <strong> and <b> tags, But these are not helpful. Can u share a sample code to show the bold font in javascript alert message?

 

 

 

Hi,

 

I've created below class and want to display records in Visual source page.

 

And my jSon :

{
   "data": [
      {
         "name": "dsvsd",
         "id": "5275838"
      },

 

 

 

public class JSON2Apex1{

    public class Data {
        public String name;
        public String id;
    }

    public class Paging {
        public String next;
    }

    public List<Data> data;
    public Paging paging;

    
    public static JSON2Apex1 parse(String json) {
        return (JSON2Apex1) System.JSON.deserialize(json, JSON2Apex1.class);
    }
    }

  • September 24, 2012
  • Like
  • 0

Hello,

I've a custom object named 'Project_Party' and his related list named 'quotes'. I'd like to make an update of the field 'visible' of the related list records from the VFpage. Each time I'm saving nothing happens and the field value comes back to the prior state. Here is my code.

Can anybody help me ?

Thx

 

<apex:page standardController="Project_Party__c" showHeader="false" sidebar="false" standardStylesheets="true">
<apex:form >
     <apex:pageBlock >
        <apex:pageMessages />
        <apex:pageBlockButtons >
          <apex:commandButton value="Save" action="{!quicksave}"/>
        </apex:pageBlockButtons>
        <apex:pageBlockTable value="{!Project_Party__c.quotes__r}" var="quotes__r" >
             <apex:column value="{!quotes__r.name}" headerValue="Offertenr" width="30%" />
             <apex:column value="{!quotes__r.PLGROUPQUOTE__c}" headerValue="Productfamilie" width="30%"/>
             <apex:column value="{!quotes__r.quote_amount_manual__c}" headerValue="Bedrag"  width="20%"/>
             <apex:column value="{!quotes__r.Gross_Price__c}" headerValue="Brutoprijs ?" width="13%"/>
             <apex:column headerValue="Zichtbaar ?" width="7%">
             <apex:inputCheckbox value="{!quotes__r.Visible__c}" />
             </apex:column>
        </apex:pageBlockTable>
     </apex:pageBlock>
</apex:form>
</apex:page>

  • September 23, 2012
  • Like
  • 0

Hey i'm trying to clone an account.

There are no errors in my code but he wont insert the copied account.

My second step is to edit some fields so it wont be exactly the same account.

Does someone know what i need to do?

My code is:

 

Public class InsertClass{


Public string InsertAccount{

Get{

Database.DMLOptions dmo = new database.DMLOptions();
dmo.AssignmentRuleHeader.UseDefaultRule= true;

///list<Account> WillBeClonedAccount = new list<Account>();

Account IsClonedAccount = [SELECT Account.Name, Account.Billing_Term__c FROM Account WHERE Id = :ApexPages.currentPage().getParameters().get('id')];

Account CopiedAccount = new Account();
CopiedAccount.Name = IsClonedAccount.Name;
CopiedAccount.Phone = '020384732';
CopiedAccount.Billing_Term__c = IsClonedAccount.Billing_Term__c;


///WillBeClonedAccount.add(CopiedAccount);

CopiedAccount.SetOptions(dmo);
insert(CopiedAccount);

/// insert(WIllbeClonedAccount);
return CopiedAccount.name ;
}
}
}