• DeafForce
  • NEWBIE
  • 25 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 11
    Replies
Hi everyone,

I actually thought it`s an easy enough to solve requirement but I somehow can`t manage to get it done....Here we go..

All I need is the number of the quantity/revenue schedules attached to an opportunity line item. We set up schedules on a monthly basis. So if a quantity schedule has been set up from Jan - March, then it should return 3. If Jan - June, then 6 etc etc

I can easily view this number in a report but I need it as a physical value on the opp line item in order to set up further calculations.

I know there is an option to create a trigger on the opportunitylineitem object and the opportunitylineitemschedule can be queried within it but unfortunately I am too familiar with the whole apex stuff.

If there is an easier option than using apex, then even better.

Could someone guide me in the right direction on how to achieve this ?

Any help is very much appreciated!
Thanks and have a good day,
Christian
 
Hi everyone,

I hope you are well.

We want to provide the possibilty to our users to drag and drop attachments into an email. Ideally the standard "send email" layout remains and only the bottom section to "attach file" changes into a drag&drop section. Rebuilding the layout via VF shouldn`t be the problem and I know a 5MB VF upload apply which is fine. However, I am actually unsure on how to achieve the drag&drop part.

Does anyone have any guidance ?

Thanks,
Christian
Hi everyone,

I am actually just trying to add the "Related List Hover Links" to my account VF page.

User-added image

I looked at old threads but none of the suggested solutions seem to work. None of the threads have been marked as "resolved" either.

Could someone guide me into the right direction on how to achieve this?

Thanks a mil in advance and have a great day!
Christian 

Hello Gurus,

 

I hope you are well.

 

I got a request to attach inbound emails to certain SF records if the email has been sent from SF. Similiar to the email2salesforce functionality but for custom objects.

 

What I am trying to achieve is that I want to look for the record ID in the textbody of the email. The user sends out an email using a template containing the record ID and if someone respondes (which will be sent to a routing address)  the class should look for the record ID and attach it appropriately. I hope that made sense ?!

 

What I found is the following and it does work fine for contacts:

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_email_inbound_using.htm

 

I modified the following part to:

-------------------------------------

try {
      Contact vCustom = [SELECT Id, Name, Email
        FROM CustomObject__c
        WHERE Id = :email.TextBody
        LIMIT 1];
      
      // Add a new Task to the contact record we just found above.
      newTask.add(new Task(Description =  myPlainText,
           Priority = 'Normal',
           Status = 'Inbound Email',
           Subject = email.subject,
           IsReminderSet = true,
           ReminderDateTime = System.now()+1,
           WhatId =  vCustom.Id));
      insert newTask;    
-----------------------------------     

 

However, the error I am getting is "Variable does not exist: TextBody". According to the WSDL the field does exist though.

 

Can you please let me know what I do wrong? If you have an easier solution on how to attach incoming emails (to custom objects) , then please let me know!

 

Any questions please let me know!

 

Thanks in advance and have a great day,

Christian

 

Hi everyone,

 

I found a trigger online and modified it slightly. It simply edit/saves the account whenever I modify a related contact. Workflows and triggers get fired once the account has been modified afterwards.

However, I am having trouble with creating the test class. To be honest I always have issues with the "after insert, after update" test classes.

 

Can you guide me in the right direction to get the test class sorted? I checked the docs but if someone got a sample test class for after insert, after update, that would be great.

 

Here is the code:

 

trigger UpdateAccount on Contact (after update,after insert) {


        Contact [] con;
        con= Trigger.new;

set<Id> accIds = new Set <ID>();

for (Contact  ir : con) {
        
    accIds.add(ir.AccountId);

Map <ID, Contact > irforaccs = new Map <ID, Contact > (
    [select Id, accountId from Contact 
    where accountId in :accIds]);

Map<ID, Account> accsToUpdate = new Map<ID, Account> (
    [select Id  from Account
    where Id in :accIds]);

for (Account acc : accsToUpdate.values()) {
    acc.id = acc.id ;
    update acc;
}}}

 

 

If you believe you have an easier solution, then please let me know!

 

Your help is very much appreciated!

Thanks in advance,

Christian

 

Hello everyone,

 

All our accounts have one or several "primary" (simply checkbox) contacts related to to them. 

I want to retrieve all those emails and gather them in a long text area field on the account. I found some sample code which retrieves the email but only for the first contact it finds.

 

Little bit of background:

Whenever someone opens a ticket related to this account we want the email addresses of all primary contacts automatically populated into the "additional to" section. I got this part sorted but can`t seems to get the email addresses into the account.

 

Do you have some guidance on how to retrieve all emails ?

 

Code I found:

trigger RetrieveEmails on Account (before update) {
      for (Account acc : Trigger.new) {
           Contact[]contactR = [select ID, Email from Contact where Primary_Contact__c = true and AccountId= :acc.id ORDER BY Primary_Contact__c DESC, createdDate limit 1];

 

        if (contactR.size() > 0) {

             acc.Description = contactR[0].Email;
              }else{
             acc.description = 'DEBUG; CONTACT = null ';
}
}}

 

Thanks very much in advance!

Christian

Hi everyone,

I actually thought it`s an easy enough to solve requirement but I somehow can`t manage to get it done....Here we go..

All I need is the number of the quantity/revenue schedules attached to an opportunity line item. We set up schedules on a monthly basis. So if a quantity schedule has been set up from Jan - March, then it should return 3. If Jan - June, then 6 etc etc

I can easily view this number in a report but I need it as a physical value on the opp line item in order to set up further calculations.

I know there is an option to create a trigger on the opportunitylineitem object and the opportunitylineitemschedule can be queried within it but unfortunately I am too familiar with the whole apex stuff.

If there is an easier option than using apex, then even better.

Could someone guide me in the right direction on how to achieve this ?

Any help is very much appreciated!
Thanks and have a good day,
Christian
 
Hi everyone,

I hope you are well.

We want to provide the possibilty to our users to drag and drop attachments into an email. Ideally the standard "send email" layout remains and only the bottom section to "attach file" changes into a drag&drop section. Rebuilding the layout via VF shouldn`t be the problem and I know a 5MB VF upload apply which is fine. However, I am actually unsure on how to achieve the drag&drop part.

Does anyone have any guidance ?

Thanks,
Christian
Hi everyone,

I am actually just trying to add the "Related List Hover Links" to my account VF page.

User-added image

I looked at old threads but none of the suggested solutions seem to work. None of the threads have been marked as "resolved" either.

Could someone guide me into the right direction on how to achieve this?

Thanks a mil in advance and have a great day!
Christian 

Hello Gurus,

 

I hope you are well.

 

I got a request to attach inbound emails to certain SF records if the email has been sent from SF. Similiar to the email2salesforce functionality but for custom objects.

 

What I am trying to achieve is that I want to look for the record ID in the textbody of the email. The user sends out an email using a template containing the record ID and if someone respondes (which will be sent to a routing address)  the class should look for the record ID and attach it appropriately. I hope that made sense ?!

 

What I found is the following and it does work fine for contacts:

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_email_inbound_using.htm

 

I modified the following part to:

-------------------------------------

try {
      Contact vCustom = [SELECT Id, Name, Email
        FROM CustomObject__c
        WHERE Id = :email.TextBody
        LIMIT 1];
      
      // Add a new Task to the contact record we just found above.
      newTask.add(new Task(Description =  myPlainText,
           Priority = 'Normal',
           Status = 'Inbound Email',
           Subject = email.subject,
           IsReminderSet = true,
           ReminderDateTime = System.now()+1,
           WhatId =  vCustom.Id));
      insert newTask;    
-----------------------------------     

 

However, the error I am getting is "Variable does not exist: TextBody". According to the WSDL the field does exist though.

 

Can you please let me know what I do wrong? If you have an easier solution on how to attach incoming emails (to custom objects) , then please let me know!

 

Any questions please let me know!

 

Thanks in advance and have a great day,

Christian

 

Hi everyone,

 

I found a trigger online and modified it slightly. It simply edit/saves the account whenever I modify a related contact. Workflows and triggers get fired once the account has been modified afterwards.

However, I am having trouble with creating the test class. To be honest I always have issues with the "after insert, after update" test classes.

 

Can you guide me in the right direction to get the test class sorted? I checked the docs but if someone got a sample test class for after insert, after update, that would be great.

 

Here is the code:

 

trigger UpdateAccount on Contact (after update,after insert) {


        Contact [] con;
        con= Trigger.new;

set<Id> accIds = new Set <ID>();

for (Contact  ir : con) {
        
    accIds.add(ir.AccountId);

Map <ID, Contact > irforaccs = new Map <ID, Contact > (
    [select Id, accountId from Contact 
    where accountId in :accIds]);

Map<ID, Account> accsToUpdate = new Map<ID, Account> (
    [select Id  from Account
    where Id in :accIds]);

for (Account acc : accsToUpdate.values()) {
    acc.id = acc.id ;
    update acc;
}}}

 

 

If you believe you have an easier solution, then please let me know!

 

Your help is very much appreciated!

Thanks in advance,

Christian

 

Hello everyone,

 

All our accounts have one or several "primary" (simply checkbox) contacts related to to them. 

I want to retrieve all those emails and gather them in a long text area field on the account. I found some sample code which retrieves the email but only for the first contact it finds.

 

Little bit of background:

Whenever someone opens a ticket related to this account we want the email addresses of all primary contacts automatically populated into the "additional to" section. I got this part sorted but can`t seems to get the email addresses into the account.

 

Do you have some guidance on how to retrieve all emails ?

 

Code I found:

trigger RetrieveEmails on Account (before update) {
      for (Account acc : Trigger.new) {
           Contact[]contactR = [select ID, Email from Contact where Primary_Contact__c = true and AccountId= :acc.id ORDER BY Primary_Contact__c DESC, createdDate limit 1];

 

        if (contactR.size() > 0) {

             acc.Description = contactR[0].Email;
              }else{
             acc.description = 'DEBUG; CONTACT = null ';
}
}}

 

Thanks very much in advance!

Christian