• Force Techie
  • NEWBIE
  • 27 Points
  • Member since 2013
  • Certified Force.com Developer


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 5
    Questions
  • 23
    Replies

Hi Everyone,

                      How can I add an event for a current custom object (not just a calender event) ?

trigger SiteEvent on Site__c (after insert, after update) 
  {
    List<Event> eventList = new List<Event>();
    
      for(Site__c site : Trigger.new)
        { 
          if(site.Date_Of_Next_Level_Of_Construction__c != null)
          {
              Event event = new Event();
              event.Subject = site.Name;
              event.StartDateTime = site.Date_Of_Next_Level_Of_Construction__c;
              event.EndDateTime = site.Date_Of_Next_Level_Of_Construction__c;
              event.OwnerId = UserInfo.getUserId();
              event.IsReminderSet = true;
              event.ReminderDateTime = site.Date_Of_Next_Level_Of_Construction__c;
              
              eventList.add(event);
              
          }
        }
           if(eventList.size()>0)
           {
           insert eventList;
           }
    }

 What I want is to insert this event in the current site record itself(trigger.new)

 

Thanks in advance

  • November 23, 2013
  • Like
  • 0
Hi Everyone,

I am system administrator in developer sandbox. When I redirect to Profile detail of current user or any other users got "Insufficient Privileges" error page. One more thing there no option in global search box for Profile. I am not confirm but I think some updates of Summer 15 release is effecting this. Please share your thoughts, if you find something corrections.

Thank you!
Hi All,

I am having a requirement to integrate QuickBooks online with Salesforce. In this, I am successfully getting authorized from Salesforce to my app on QuickBooks. I am using version V1 to getting request token and access token, secret credentials. But, when I am trying to make a request to getting all Accounts from QuickBooks app with using V3, got the Authentication error: Unauthorized. If anyone faces this type of exception and got success to make request from SF to QB please help me to getting out from this exception.

Thanks in advance!
Hi,

When a record of Case is Assigned to (Change the OwnerId field) customer portal user Case's Contact Name(ContactId) is populated with Portal User's Contact. But when Case is assigned to Partner Community Login licensed User the Contact Name field is not populated. I am not getting the reason of this. Please help me, If anyone konws the reason.

Thanks in advance!

Hi!

 

I am new to salesforce. I have " A custom button 'welcome' on standard Object(Account) detail page. This button have execute JavaScript behavior onclick. This button has JavaScript function name getMsg(). This getMsg only popup alert('hello'). The modal popup also have a button 'cancel'. When user clicks on 'welcome', popup is open. On popup user clicks 'cancel' , we want to execute the getMsg() method when cancel is clicked from modal popup."

Please help me to understand how to do this.

Thank You!

Hi!

 

I am new to salesforce. I have a functionailty with one custom button 'welcome' on Standard Object (Account) detail page with behavior of onclick execute JavaScript of popup modalDialogebox in the popup. I have one button 'cancel' on it and when click on 'cancel' a JavaScript function 'getMsg()' is called from Custom Button 'welcome' with alert of 'Hello' but I am unable to do this. Please help me to come out from this issue.

 

Thank you !

We have two Salesforce appexchange product for developers. We need sharp developers on a part-time basis. You will spend 3-4 hours everyday responding to customer requests.

It is okay to have another job.

We are looking for A players. If you are just starting out with Salesforce, please feel free to pass this offer.
Your main task will be:
1. Test our product
2. Respond to customer support requests.

You will not be responsible for development.

We need someone with the following qualities:
1. You are a fast learner.
2. You must have good communication skills.
3. You are great at Salesforce.
I'm getting connected to QB Online and authenticated, but now I'm trying to get a list of accounts.  I'm getting an invalid version on my return.

Here is the request that I'm using....
system.HttpRequest[Endpoint=https://sandbox-quickbooks.api.intuit.com/v3/company/13860xxxxx/query?query=SELECT * FROM Account, Method=GET]

The header is this:
OAuth oauth_consumer_key="qyprdkbWYESxxxxxxxxxxxxxH", oauth_nonce="-1898820638843667087", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1454507703", oauth_token="qyprdswhS3apsDvUS3HmHxxxxxxxxxxxxxxx7X0tKGxBj3oCmnU", oauth_version="1.0", Host="qbo.intuit.com", Connection="Keep-Alive", oauth_signature="rgnqOLJqe11xxxxxxxoyG82voyMg%3D"

And my response is:
System.HttpResponse[Status=Unknown Version, StatusCode=400]

I've tried taking the version out.  I've tried chainging it to 2.0 - I still get the same error.

​Any thoughts?
Hi Everyone,

I am system administrator in developer sandbox. When I redirect to Profile detail of current user or any other users got "Insufficient Privileges" error page. One more thing there no option in global search box for Profile. I am not confirm but I think some updates of Summer 15 release is effecting this. Please share your thoughts, if you find something corrections.

Thank you!
Hi All,

I am having a requirement to integrate QuickBooks online with Salesforce. In this, I am successfully getting authorized from Salesforce to my app on QuickBooks. I am using version V1 to getting request token and access token, secret credentials. But, when I am trying to make a request to getting all Accounts from QuickBooks app with using V3, got the Authentication error: Unauthorized. If anyone faces this type of exception and got success to make request from SF to QB please help me to getting out from this exception.

Thanks in advance!
Hi,

When a record of Case is Assigned to (Change the OwnerId field) customer portal user Case's Contact Name(ContactId) is populated with Portal User's Contact. But when Case is assigned to Partner Community Login licensed User the Contact Name field is not populated. I am not getting the reason of this. Please help me, If anyone konws the reason.

Thanks in advance!
Hi,

I have 3.5 Years experience and have worked on apex,Visualforce and Integrations. I work during IST hours. Let me know if anyone have remote work.

Thanks

// hi..here in my batchapex code logic is to update the name,description field from account....so saving this i got error like:

Error: Compile Error: expecting a right parentheses, found 'info' at line 2 column 69 ........anyone help me in this regard. //

 

 

 

global class batchclass implements Database.batchable<sobject>

   {
        global Database.Querylocator start(Database.Batachable contextinfo)

      {
        string query='select id,name,description from account';
        return Databse.getQuerylacator(query);
         }
         global void execute(Database.Batchable contextinfo,list<account>accountlist);
         list<acccount>acctoupdate=new list<account>();
         for(account a:accountlist)
             {
                if(description==null)
                 {
                    a.description='batch apex';
                   acctoupdate.add(a);
                           }
                    }
                update acctoupdate;
                    }
      global void finish(Database.Batchablecontextinfo){

                       
                      }
        }

Hi,

 

I wonder if we can we use email templates in apex class for sending emails?

 

Thanks.

Mayank

 

 

  • November 27, 2013
  • Like
  • 0

Hi Everyone,

                      How can I add an event for a current custom object (not just a calender event) ?

trigger SiteEvent on Site__c (after insert, after update) 
  {
    List<Event> eventList = new List<Event>();
    
      for(Site__c site : Trigger.new)
        { 
          if(site.Date_Of_Next_Level_Of_Construction__c != null)
          {
              Event event = new Event();
              event.Subject = site.Name;
              event.StartDateTime = site.Date_Of_Next_Level_Of_Construction__c;
              event.EndDateTime = site.Date_Of_Next_Level_Of_Construction__c;
              event.OwnerId = UserInfo.getUserId();
              event.IsReminderSet = true;
              event.ReminderDateTime = site.Date_Of_Next_Level_Of_Construction__c;
              
              eventList.add(event);
              
          }
        }
           if(eventList.size()>0)
           {
           insert eventList;
           }
    }

 What I want is to insert this event in the current site record itself(trigger.new)

 

Thanks in advance

  • November 23, 2013
  • Like
  • 0

I am now onto unit testing my class called from a trigger that I got help with a few weeks back. As you all know, I need to have unit tests proving successful coverage of my code.  From the help & online, I figured out how to setup Eclipse & the Force.com IDE.

 

Currently, I am connected to our sandbox:

 

Here is the trigger.  it calls a method in a class:

trigger ReportPackageTrigger on Report_Package__c (after update) {
      ReportPackageHelper.flagRecipientsAsDeleted(trigger.oldMap,trigger.newMap);
}

 

 

I created a 'test' class, and from the help, I discerned that I need to create & reference instances of the objects that will be used to initiate an update event.  I am quite new to the SF paradiagm being more familiar with .Net methods, but am muddling my way through.  I need allot of help with the concept's implementation of how to properly set up a unit test with appropriate coverage.  In SANDBOX This is what I have so far, but it is incomplete, I know.  Would anyone be able to steer me in the right direction on how to build a caompleted unit test?  Additional resources would also be welcomed!

 

 

@isTest
private class UnitTestClass {

    static testMethod void TestEndDatingPkg() {
      //Comment: Set up a dummy Package recipient with today as the start date.
      Package_Recipient__c PackRecp = new Package_Recipient__c(Contact_Name__c='Albrecht',Start_Date__c=Date.today());
      insert PackRecp;
      //Comment: Set up a dummy Package with no end date.
      Report_Package__c RepPkg = new Report_Package__c(name='ABC Package');
      insert RepPkg;

 

//I need to now associate the recipient with the package, assign a date to a field, which will be an event that I will catch in my class code.
      
        
        
        
        
        
    }
}

 

Hi,

 

trigger UnAssignServiceAgreement on Equipment__c (after update) {

Set<id> equipids = new Set<id>();    

for (Equipment__c equipment : Trigger.new) {     

    if (equipment.Job_Number__c == null && equipment.Job_Number__c != trigger.oldMap.get(equipment.id).Job_Number__c) {     

    equipids.add(equipment.id);      

       equipment.Under_Contract__c = False;   

          equipment.Contract_Status__c = 'Not Under Contract';         }     } }

 

 

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger UnAssignServiceAgreement caused an unexpected exception, contact your administrator: UnAssignServiceAgreement: execution of AfterUpdate caused by: System.FinalException: Record is read-only: Trigger.UnAssignServiceAgreement: line 8, column 1

  • November 19, 2013
  • Like
  • 0

Hi,

    i will try to run this class, i got an error like   <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><CreateCustomerProfileResponse xmlns="https://api.authorize.net/soap/v1/"><CreateCustomerProfileResult><resultCode>Error</resultCode><messages><MessagesTypeMessage><code>E00007</code><text>User authentication failed due to invalid authentication values.</text></MessagesTypeMessage></messages><customerProfileId>0</customerProfileId></CreateCustomerProfileResult></CreateCustomerProfileResponse></soap:Body></soap:Envelope>

 

Public class callExternalWS 
    { 
        public void invokeExternalWs() 
        { 
            HttpRequest req = new HttpRequest(); 
            //Set HTTPRequest Method 
            req.setMethod('POST'); 
            req.setEndpoint('https://api.authorize.net/soap/v1/Service.asmx'); 
            req.setMethod('POST'); 
            req.setHeader('Content-Type', 'text/xml; charset=utf-8'); 
            req.setHeader('SOAPAction', 'https://api.authorize.net/soap/v1/CreateCustomerProfile'); 
            string b =   '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">'+ 
                          '<soap:Body><CreateCustomerProfile xmlns="https://api.authorize.net/soap/v1/">'+ 
                          '<merchantAuthentication><name>8j4W5UyB</name>'+ 
                          '<transactionKey>7mR2ah8655gLSR8q</transactionKey></merchantAuthentication>'+ 
    '<profile><description>description</description>'+ 
                          '<email>sforce2009@gmail.com</email>'+ 
                          '<paymentProfiles>'+ 
                          '<CustomerPaymentProfileType><customerType>individual</customerType>'+ 
    '<payment><creditCard><cardNumber>6011000000000012</cardNumber>'+ 
                          '<expirationDate>2009-12</expirationDate></creditCard>'+ 
                          '</payment></CustomerPaymentProfileType></paymentProfiles></profile>'+ 
                          '</CreateCustomerProfile></soap:Body></soap:Envelope>'; 
            req.setBody(b); 
            Http http = new Http(); 
            try { 
              //Execute web service call here        
              HTTPResponse res = http.send(req);    
              //Helpful debug messages 
              System.debug(res.toString()); 
              System.debug('STATUS:'+res.getStatus()); 
              System.debug('STATUS_CODE:'+res.getStatusCode()); 
              System.debug('STATUS_CODE:'+res.getBody()); 
            //YOU CAN ALWAYS PARSE THE RESPONSE XML USING XmlStreamReader  CLASS 
           } catch(System.CalloutException e) { 
                //Exception handling goes here.... 
         }        
    } 
    }

 

 

 thanks

sravani