• deepa_tansen
  • NEWBIE
  • 0 Points
  • Member since 2013

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

Hello,

 

If an opportunity = closed lost

 

"ABC" Field (Look up User) Account = Blank

 

please send an email to xyz@gmail.com and the "ABC"

Subject: Opportunity has been placed in Closed Lost 
Message: 

An opportunity on an account in (insert ABC)’s name has been placed in Closed Lost. Please follow up accordingly. 

Account name: (insert account name) 
Opportunity Link: (Insert: Opportunity link) 

 

Thanks,

D...

Hello Friends,

 

Hope You all are doing good.....I have little problem with one of the trigger I am working on....Please help me becuase I don't kno what to do....

 

Objective: To build an error management email to "custom object" 
feature.

Requirement: Whenever an error occurs during either an upsert function
or response (call-out) function in the Skyvva framework, we need an
email to be sent and also a case (request) record to be created in a
custom object called "SFDC User Requests
 in our SFDC Org. This required feature should be similar to a standard email to case feature.

Reason not to use the standard email to case feature: We do not use the
standard case object to create cases/ tickets related to Salesforce
requests and issues. Instead we use a custom object called "SFDC User
Requests."

 

Here the Trigger I wrote....

trigger trgMessage on skyvvasolutions__IMessage__c (after update) {

List<Salesforce_User_Request__c> lSFUserRequest = new List<Salesforce_User_Request__c>();

 for(skyvvasolutions__IMessage__c msg: Trigger.New){

        //populate value of failed message to custom object and add to list

        if(msg.skyvvasolutions__Status__c=='Failed'){

            lSFUserRequest.add(new Salesforce_User_Request__c(

                //assign value from skyvvasolutions__IMessage__c to custom object         
                   // Status__c = 'New',
                    Name = msg.skyvvasolutions__Target__c,
                    Salesforce_Request_Details__c = msg.skyvvasolutions__Comment__c
                   // Types_of_User_Requests__c = msg.skyvvasolutions__Type__c
                    
                   ));

            }

    }
     //insert, if external Id is specify external Id, you can upsert external_Id__c
   if(lSFUserRequest.size()>0)
    {
            insert lSFUserRequest;

    }
}

 

The problem is that when we are testing it from Skyvva framework It creates two records on The Custom Object, first I thought becuase of workflow but I deactivated the workflow and it is still creating two records I dont know what to do ...

 

Please let me know the perfect solution.. Thanks in advance.........

 

Hello,

 

I have a trigger that creates is supposed to create a new record based on a status field of a different custom object. When i run the trigger, it creates 2 new records in the second custom object. Help solving why it is creating two instead of one is appreciated.

 

My code below:

 

Trigger:

 

 

trigger CreateTicket on Maintenance_Request__c(after update)

{

    if(Trigger.isUpdate){
        for(Maintenance_Request__c m: Trigger.new)

       {

          if(m.Status__c == 'Pending Support')

          {

               Support_Team_Request__c st = new Support_Team_Request__c();

              

                  st.Your_name__c = m.Your_Name__c;
                  st.Client_reported_issue__c = 'No';
                   st.Short_description__c = m.Short_Description__c;
                   st.Client_Name__c = m.Client_Name__c;
                   st.Description_of_Issue__c = m.Detailed_Description__c;
                    st.Mailbox__c = m.Mailbox__c;
                    st.Priority__c = 'medium';
                    st.Created_From_MTR__c = 'Yes';
                    st.Request_Type__c = 'production' ;  
                    st.Participant_Name__c = m.Participant_Name__c;
                    st.Participant_ID__c = m.Participant_ID__c;
                    st.CC_Contact__c = m.CC_Contact__c;

                insert st;

          }
         
        }
    }  

}

 

 

 

Test Class:

 

 

@isTest
private class CreateTicketTriggerTest {

    static testMethod void myUnitTest() {
      
        Maintenance_Request__c mr = new Maintenance_Request__c();
    
        mr.Your_Name__c = 'Test User';
    mr.Short_Description__c = 'Test request';
    mr.Client_Name__c = '0015000000GibFx';
    mr.Detailed_Description__c = 'Test maintenance request';
    mr.Mailbox__c = 'test@example.org';
    mr.Participant_Name__c = 'Test Participant';
    mr.Participant_ID__c = '123';
      mr.Request_Type__c = 'Account Merge';
        mr.Request_Type__c = 'Account Merge';

        
    insert mr;
        
        mr.Status__C = 'Pending Support';
    update mr;
    }
}