• srivani
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
Hello,
I have created a custom button on Opportunity. The custom button has following javascript code. When the user clicks on the button, the email should be sent. And it is working fine. But i want to send email conditionally like if(Stage = "Provisional - Awaiting Deposit") then this custom button should send an email.
Any suggestion would be helpful.
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/30.0/apex.js")} 
(function() {
sforce.connection.sessionId = "{!$Api.Session_ID}";
var message = new sforce.SingleEmailMessage();
message.targetObjectId = "{!Opportunity.ContactId__c}";
message.templateId = "00X7E000000EF6w";
message.whatId = "{!Opportunity.Id}";
message.saveAsActivity = true;
var result = sforce.connection.sendEmail([message]);
  if(result[0].success == 'true') {
     alert("Email has sent succesfully...");
  } else {
     alert("Failed...");
  }
alert(result);
}());

Thank you,
Yunus Kalam
Hi
I have 2 custom objects say Book1 and Book2 and I insert exactly same records in both the objects.
There is no relaitonship between Book1 and Book2.
Both objects have same fields Name and price respectively.
My requirement is when I update a record in Book1, then it should update the matching record in Book2.

I am stuck at the update level, pls help me out
here is the code
public class Book1Scenarios
{
  
  Book2__c book2=new Book2__c();      

//Insert is working
  public void Create(List<Book1__c> book1)
  {
    for(Book1__c b1: book1)
    {
      book2.Name=b1.Name;
      book2.price__c=b1.price__c;
      
    }
    
    insert book2;
   } 
   

// update operation.
   public void UpdateRecord(List<Book1__c> oldbook1)
   {
    List<Book2__c> oldbook2=[select Name,price__c from Book2__c];
    
    for(Book1__c b1:oldbook1)
    {
      for(Book2__c b2:oldbook2)
      {
         if((b1.Name == b2.Name) && (b1.price__c == b2.price__c))
         {
            b2.Name=b1.Name;
            b2.price__c=b1.price__c;
         }
      }
    }
    Database.update(oldbook2);
   }
   
}


trigger trg_Book1Scenarios on Book1__c (after Insert)
{
   Book1Scenarios b1=new Book1Scenarios();
   
   if (trigger.isInsert)
   {
    b1.create(Trigger.New);
   }
   
  if (trigger.isUpdate)
  {
    b1.UpdateRecord(Trigger.Old);
  }

   
}

sonali verma
divya

 
HI,

I want to copy one custom fields value to another custom fileds with a suffix value.For example
Code = 65892001
I want to put one A before this number and save it to another filed.(Like New code = A65892001).Is it possible??
Hi guys! I am working on an internal project and I find myself with 7 different record types. I have created around 25 validation rules that I want them to apply to all record types except one. 

I have tried something like this: 
AND( ABI_SFA_Record_Type_Name__c  <> 'ABI_SFA_Template', ISPICKVAL(ABI_SFA_Country__c ,'GB'), LEN( ABI_SFA_ZIP_Postal_Code__c ) > 9)

Unfortuntely, it is not properly working. 

Any hints?

Thank you!!