• abepar
  • NEWBIE
  • 0 Points
  • Member since 2013

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

In a test class, I am trying to create an opportunity of a specified record type. 

 

   //create opportunity record
        String opportunityName= 'xxxx';
            Opportunity o = new Opportunity(
            AccountId=a.Id, 
            Name=opportunityName, 
            StageName='Prospecting', 
            CloseDate=Date.today(),
            Opportunity_Type__c='New',
            LeadSource='xxx',
            RecordTypeId= [Select Id From RecordType Where Name = 'xxx' and SobjectType= 'Opportunity'].Id);
            
        insert o;
        system.debug(o.RecordType.Name);
        

 

However this returns- null in the debug statement. I'm sure i'm overlooking something simple. Any help?

  • December 03, 2013
  • Like
  • 0
I am trying to send $http request to salesforce for submitting a ticket.
I enabled in security setting cors while adding my site to the withlist.
The probelm is that i am still getting the famous error:
XMLHttpRequest cannot load https://www.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://mystie.com' is therefore not allowed access.

Code:
$http({
                method: 'POST',
                url: 'https://www.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8',
                headers: { 'Content-Type': 'application/json' },
                data: param2
            }).
Thanks in advance for your help.
Dan