• pcon
  • ALL STAR
  • 14512 Points
  • Member since 2011
  • Senior Software Engineer
  • Red Hat


Badges

  • Chatter
    Feed
  • 437
    Best Answers
  • 0
    Likes Received
  • 10
    Likes Given
  • 1
    Questions
  • 3133
    Replies
How to parse the response 
 <?xml version=\"1.0\" encoding=\"UTF-8\"?><methodResponse xmlns:ex="http://ws.apache.org/xmlrpc/namespaces/extensions"><params><param><value><array><data><value><boolean>1</boolean></value><value>OK</value></data></array></value></param></params></methodResponse>

I wanted to write logic based on Boolean value in response but am unable to parse this one 
 
I'm in the "Salesforce Connect" module and trying to complete the set up to integrate a sample as requested:

"As part of this module, you integrate sample order data with the existing account data in your Salesforce Developer Edition. To go through the steps, you need to install a test package that configures the necessary schema on the account object, creates a Customer ID field, and assigns a value for Customer ID to each account.

Follow these steps to install the package.
Open a browser, and click here to start the installation.
Select Install for Admins Only.
Click Install."

When I click on the "click here" it takes me to a SFDC log in page, where I try to select my Dev Org login in username and password (from my production enviro).  It does not work and even after trying to reset my password I never receive an email and cannot log in.

Please help! 
Thanks,
Rochelle
Our group is changing over some code in response to a change in instance.  This code follows the methods outlined in the quick start guide. https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/quickstart.htm  At the moment, we acquire an auth token by hitting the login instance, and then query our numbered instance for data.

To prevent having to keep changing the configuration parameter to point to our new ID when it changes, is it possible to still query the login instance to get data back?  I've tested on my end without any luck, but I figured I'd check to see if I'm missing anything.

We're exploring setting up a custom domain, which will likely  be our alternative, but the easier solution would be better.

 
Hello - I created a pre-chat survey for my new verions of Live Agent, but in testing, clicking the link to chat now forces a login. How do I serve up the questions without logging in? Without the pre-chat quesitons, Live Agent launches just fine without a need to login and launching the visualforce page works. Any suggestions would be much appreciated! Thank you in advance!
 
I am attempting to parse MatterMark's API, but I am planning to do so selectively, picking only the value pairs that are relevant. The example JSON response is available to be viewed in MatterMark's documentation (here).

Here's my Wrapper:
 
public class MMarkWrapper {
    public class mmark_company_profile {
        public string name {get;set;}
        public string description {get;set;}
        public string employees {get;set;}
        public string employees_6_months_ago {get;set;}
        public string last_funding_amount {get;set;}
        public string last_funding_date {get;set;}
        public string country {get;set;}
        public string total_funding {get;set;}
        public string acquired_by {get;set;}
        public List<mmark_funding_round> mmark_funding_rounds {get;set;}
        
    }
    public class mmark_funding_round {
        public string amount {get;set;}
        public string transaction_currency {get;set;}
        public string series {get;set;}
        public string funding_date {get;set;}
        public string investors {get;set;}
        
    }
    
    public List<mmark_company_profile> mmark_company_profile_list {get; set;}

}

And the Parser:
 
public class MMarkParser {
    public MMarkWrapper wrapper {
        get;
        set;
    }
    
    public void parse() {
        
        //request class
        HTTPRequest request = new HTTPRequest();
        request.setEndpoint(Label.MatterMarkAPI+'/domains/'+ 'marketinvoice.com' +'/companies?key=' +'c878f447941828d91d53ffbebae068cdb7624fb257cca98e2672e8148e039c1c');  
        request.setMethod('GET');
        
        //response class
        HTTP h = new HTTP();
        HTTPResponse response = h.send(request); 
        
        
        wrapper = (MMarkWrapper) JSON.deserialize(response.getBody(), MMarkWrapper.class);
        System.debug(wrapper);
        
    }
    
}

I am trying to get it displayed on this page, but all I am getting is a blank page...
 
<apex:page controller="MMarkParser">
    <apex:form >
        <apex:pageBlock title="MMarkParserResponse">
            <apex:pageBlockButtons >
                <apex:commandButton value="submit" action="{!parse}" reRender="mmark_company_profile"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection id="mmark_company_profile" columns="1">
                <apex:repeat value="{!wrapper.mmark_company_profile_list}" var="mmark_company_profile">
                    <apex:pageBlockSection columns="2">
                        <apex:facet name="header">Company {!mmark_company_profile.name}</apex:facet>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Description" for="description" />
                            <apex:outputText value="{!mmark_company_profile.description}" id="description" />
                        </apex:pageBlockSectionItem>
                        <apex:pageBlockSectionItem >
                            <apex:outputLabel value="Employees" for="employees" />
                            <apex:outputText value="{!mmark_company_profile.employees}" id="employees" />
                        </apex:pageBlockSectionItem>
                    </apex:pageBlockSection>
                    <apex:pageBlockSection columns="1">
                        <apex:facet name="header">Funding {!mmark_company_profile.name} Series</apex:facet>
                        <apex:pageBlockTable value="{!mmark_company_profile.mmark_funding_rounds}" var="item" id="mmark_funding_rounds">
                            <apex:column value="{!item.amount}" headerValue="Amount" />
                            <apex:column value="{!item.transaction_currency}" headerValue="Transaction Currency" />
                            <apex:column value="{!item.series}" headerValue="Series" />
                            <apex:column value="{!item.funding_date}" headerValue="Funding Date" />
                        </apex:pageBlockTable>
                    </apex:pageBlockSection>
                </apex:repeat>
            </apex:pageBlockSection>
        </apex:pageBlock> 
    </apex:form>
</apex:page>

I've been trying to debug it with no success, any ideas why this may be not working?
Hello,

I'm new to Apex and SOQl. I have two objects; Accounts (Master object) and Appointments (Child object) and I'm trying to write a trigger (With SOQL query) that returns the most recent appointment date (Max date) per account on a custom field (Most_Recent_Appointment_Date__c) that is built on the account (Persons account) object:
 
Object #1: (Appointments)
 
Appointment ID  Account ID,   Name,  Apt Date,   Weight....etc.
---------------------------------------------------------------------------------
Apts_001112       001                John      01/01/2017     160
Apts_001114       002                Nicole   11/05/2016      180
Apts_001113       001                John      04/05/2017     175
Apts_001115       003                Mark     05/05/2017      190   
Apts_001116       002                Nicole   12/15/2016      200
 
Object #2: (Accounts)
 
 ID,      Name....etc.
--------------------------
 001     John    
 002     Nicole   
 001     John     
 003     Mark      
 002     Nicole
-----------------------------------------------------------------------------------------------------------------------------------------------------
 
Trigger MostRecentAppointmentDate on Accounts (After update, after insert) {

List <Accounts> AccountsList = new List<Accounts>();

Set<id> AcntsID = new Set<id>();
    for(Account a:trigger.new) {
 AcntsID.add(a.ID);
}

For (Appointments Apts : Trigger.new) {
Appointments MostRecentApts = [SELECT Scheduled_date__c, Weight__c, Patient__c
                                            FROM Appointments__c
                                            WHERE Patients__c IN:AcntsID
                                            GROUP BY Patients__c
                                            ORDER BY Scheduled_date__c DESC
                                            LIMIT 1];

Set Most_Recent_Appointment_Date__c = MostRecentApts

}
Hi all

what is the apex code for sms magic

Is it possible to set the parent id on an asset other than using the constructor method?  I need to set the parent id for an asset in a trigger method.  This code does not work:

a.parentId = parentAsset.id;

Results in:  Save error: Invalid field parentId for SObject Asset

My user does have access to the object and the parent field.  I can set the parent id using the constructor method:

Asset a = new Asset(name='test component with parent',
                    hin__c = 'CRC10890L516',
                    recordtype =bc,
                    dealer_key__c = '43536.001',
                    dealer_brand_key__c = '43536.001CL',
                    parentId = '02i54000000hS4aAAE') 

Unfortunately that will not work for my use case.

Ideas?
 

Hi, 

How can I align the following to the left of the page, its a pdf. Screenshot of the issue
I want to shift all the text to the left with this formet, here is the section of code for this- 
<tr>
                <td colspan="4"> </td>
            </tr>
            <tr>
                <td colspan="4" style="font-weight: bold; border-bottom-style: solid; border-bottom-width: thick;
                    border-bottom-color: #30b55a;">
                    Campaign Information </td>
            </tr>
              
                    <tr>
                            <td style="color: #808080; border-right-style: solid; border-right-width: thin;
                                border-right-color: #30b55a;">
                                Campaign Name </td>
                            <td align="left">
                                {!Opportunity.Name} </td>
                        </tr>
                    <tr>                    
                            <td align="right" style="color: #808080; border-right-style: solid; border-right-width: thin;
                                border-right-color: #30b55a;">
                                Brand </td>
                            <td style="text-align:left">
                                {!Opportunity.Account.Name} </td>
                        </tr>
                       
            <tr>
                <td align="right" style="color: #808080; border-right-style: solid; border-right-width: thin;
                    border-right-color: #30b55a;">
                    Start Date
                </td>
                    <td style="font-weight: normal">
                        <apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
                        <apex:param value="{!Opportunity.Campaign_Start_Date__c}" /> 
                        </apex:outputText>
                    </td>
            </tr>
            
            <tr>
                <td align="right" style="color: #808080; border-right-style: solid; border-right-width: thin;
                    border-right-color: #30b55a;">
                    End Date
                </td>
                    <td style="font-weight: normal">
                        <apex:outputText value="{0,date,MM'/'dd'/'yyyy}">
                            <apex:param value="{!Opportunity.Campaign_End_Date__c}" /> 
                        </apex:outputText>
                    </td>
            </tr>
            
             <tr>
                <td align="right" style="color: #808080; border-right-style: solid; border-right-width: thin;
                    border-right-color: #30b55a;">
                    Duration 
                </td>
                    <td style="font-weight: normal">
                        <apex:outputText value="{0,number,0}">
                            <apex:param value="{!Opportunity.Campaign_Duration__c}"/>
                        </apex:outputText> 
                    </td>
            </tr>

Please help out. Thank you !
I'm receiving a JSON string from another system in the format below. These records already exist in Salesforce. I want to only query these records in salesforce, set a boolean field to false in all of them and update.
{ "bacctList" : 
     [{
       "RC_Account_No__c" : "RC-2",
       "A_c_Number__c" : "111",
       "Bank_code__c" : "250655"
      },
      {
       "RC_Account_No__c" : "RC-1",
       "A_c_Number__c" : "222",
       "Bank_code__c" : "198765"
      }]
   }

The below code works fine, the issue is it's not bulkified.
@RestResource(urlMapping='/dosystem/bankaccounts/*')
global with sharing class BankAccountWebservice{
   
 @HttpPatch
    global static BankAccountWrapper doPatch(List<Bank_Account__c> bacctList) {
        RestRequest req = RestContext.request;
        RestResponse res = RestContext.response;
        BankAccountWrapper response = new BankAccountWrapper();
        
        List<Bank_Account__c> bankAccountsToUpdate= new List<Bank_Account__c>();

        for(integer i=0; i<bacctList.size(); i++){
            List<Bank_Account__c> ac = [SELECT Debit_Order_A_c__c,A_c_Number__c,Bank_code__c,RC_Account_No__c  
            FROM Bank_Account__c 
            WHERE (RC_Account_No__c =: bacctList[i].RC_Account_No__c AND  A_c_Number__c =: bacctList[i].A_c_Number__c AND Bank_code__c =: bacctList[i].Bank_code__c)];
            
            for(integer j=0; j< ac.size(); j++){
                ac[j].Debit_Order_A_c__c = false;       
                bankAccountsToUpdate.add(ac[j]);
             }    
        }
        
        try {
            update bankAccountsToUpdate;

            response.bacctList = bankAccountsToUpdate;
            response.status = 'Success';
            response.message = bacctList.size()+' Records Updated successfully';
        }
        catch(Exception exc) {
            res.StatusCode = 500;
            response.bacctList = null;
            response.status = 'Error';
            response.message = 'Your request failed with the following error: ' + exc.getMessage();
        }
        
        return response;
    }
    
    global class BankAccountWrapper {
        public List<Bank_Account__c> bacctList;
        public String status;
        public String message;
        
        public BankAccountWrapper(){
            bacctList = new List<Bank_Account__c>();
        }
    }   
}

The problem is the FOR loop. I tried using the IN clause in SOQL but the problem is im not getting the ID in the JSON string.
List<Bank_Account__c> bankAccountsToUpdate= new List<Bank_Account__c>();
        integer updatedRecordCount=0;
        
        List<Bank_Account__c> ac= [select Name,Debit_Order_A_c__c,A_c_Number__c,Bank_code__c From Bank_Account__c where Id IN : bacctList];
                    
		for(integer i=0; i<ac.size(); i++){                                    
			ac[i].Debit_Order_A_c__c = false;       
			bankAccountsToUpdate.add(ac[i]);
			updatedRecordCount++;                 
		
		}

PLEASE HELP.

 
Hi folks,

I've been powering my way through Trailhead recently, I've now gone through all of the Admin (just looking through the Advanced trail currently) and also want to gain a better understanding of Programmatic side/more Development focused features.

It probably helps if I state that I've worked in Sales for most of my career so  stepping into the technical realm is a fairly big jump for me! Can anyone advise:

- Would it be best to cotinue with the advanced admin trail *before* moving onto the 'Developer - Beginner' trail, or is it worth learning the programmatic side along with declarative before tackling the final trail?

- Is there a good place to start learning APEX? I have a very basic understanding of the code from what i've managed to gleam through Trailhead, but it seems like a 'JAVA/C# for Dummies' book or something similar may be a good idea?

If anyone could spare 2 mins to give me some advice I'd really appreciate it!

Thanks in advance

Jack
Hi guys,

I'm trying to setup email to case on an org but I keep running into this issue, it's driving me insane as I had this set up already using the exact same email address and it worked fine. Can anyone help me figure out what the below error message means? I have no idea what picklist is causing this to happen all of a sudden. 

INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST : bad value for restricted picklist field: No
Hello all,

I have completed creating trigger and helper class, if i close the maintanance request, new maintanence request is gettting created as expected with same vehicle, report date and due date.  But i am getting this errors.

Challenge Not yet complete... here's what's wrong: 
Inserting a new Maintenance Request of type 'Repair' and then closing it did not work as expected. The challenge was NOT expecting to find a Maintenance Request with the same Vehicle and the Status of 'New' and of Type 'Routine Maintenance'. However, it did.

What is the issue.

Thanks.
For fetching the sessionId, I am getting the error: Require TLS 1.1 or higher"

I checked other posts and looked for the deactivation in Critical Updates but I cannot see that option.

Can somebody help me resolve this problem?

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.enterprise.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>sf:UNSUPPORTED_CLIENT</faultcode>
         <faultstring>UNSUPPORTED_CLIENT: TLS 1.0 has been disabled in this organization. Please use TLS 1.1 or higher when connecting to Salesforce using https.</faultstring>
         <detail>
            <sf:UnexpectedErrorFault xsi:type="sf:UnexpectedErrorFault">
               <sf:exceptionCode>UNSUPPORTED_CLIENT</sf:exceptionCode>
               <sf:exceptionMessage>TLS 1.0 has been disabled in this organization. Please use TLS 1.1 or higher when connecting to Salesforce using https.</sf:exceptionMessage>
            </sf:UnexpectedErrorFault>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>



This is the error.
 

We are writing an interface servlet which has data passed to it, parses the data and creates the JSON, then sends the JSON to Salesforce. I'm having an issue authenticating. My authorization is as follows:

 

public String getAuth() throws HttpException, IOException, JSONException {
    	//post.addParameter("code",code);
    	HttpClient httpClient = new HttpClient();
    	ServletConfig context = getServletConfig();
    	post = new PostMethod(context.getInitParameter("environment"));
    	
    	System.out.println("environment: " + context.getInitParameter("environment"));
    	System.out.println("clientId: " + context.getInitParameter("clientId"));
    	System.out.println("clientSecret: " + context.getInitParameter("clientSecret"));
    	System.out.println("redirectUri: " + context.getInitParameter("redirectUri"));

    	
        post.addParameter("grant_type","authorization_code");
        post.addParameter("client_id",context.getInitParameter("clientId"));    	
    	post.addParameter("client_secret",context.getInitParameter("clientSecret"));
    	post.addParameter("redirect_uri",context.getInitParameter("redirectUri"));
    	   
    	httpClient = new HttpClient();
    	httpClient.executeMethod(post);
   
    	String responseBody = post.getResponseBodyAsString();
    	
    	System.out.println("response body: " + responseBody);
    	   
    	JSONObject json = null;
    	json = new JSONObject(responseBody);
    	String accessToken = json.getString("access_token");
        //String issuedAt = json.getString("issued_at");
              
       /*HttpServletResponse httpResponse = (HttpServletResponse)response;
       Cookie session = new Cookie("ACCESS_TOKEN", accessToken);
       session.setMaxAge(-1); //cookie not persistent, destroyed on browser exit
       httpResponse.addCookie(session);*/
        
       return accessToken;
    }

I recieve this error back:

{"error":"invalid_grant","error_description":"invalid authorization code"}
I currently have "code" commented out, because I'm not exactly clear on the flow of things. The documentation says you get the authorization code from the redirect_url, but I'm not redirecting to anything, just connecting with this Java servlet. Is there a better way of doing this? Or am I even doing it correctly to start with? Any help would be appreciated.
Hi all,

I'm having some trouble figuring out how to delete a custom object record. I use the same code as provided in this article: Interact with the Force.com REST API with PHP
 
function delete_qce_part ($id, $instance_url, $access_token) {
    $url = "$instance_url/services/data/v37.0/sobjects/QCE_Part__c/$id";

    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_HEADER, false);
    curl_setopt($curl, CURLOPT_HTTPHEADER,
            array("Authorization: OAuth $access_token"));
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
    
    curl_exec($curl);
    
    $status = curl_getinfo($curl, CURLINFO_HTTP_CODE);

    if ( $status != 204 ) {
        die("Error: call to URL $url failed with status $status, curl_error " . curl_error($curl) . ", curl_errno " . curl_errno($curl));
    }

    echo "HTTP status $status deleting part<br/><br/>";

    curl_close($curl);
    return $result;
}

I get an error message with that "METHOD_NOT_ALLOWED, HTTP Method 'DELETE' not allowed. Allowed are HEAD,GET,POST", "Error: call to URL [URL to Sandbox] failed with status 405, curl_error , curl_errno 0"

Any assistance in resolving this error would be greatly appreciated.
Hi
I am doing the trailhead learnings and need to refresh my data in force.com to do the tests in Trailhead. How can I refresh my force.com data back to the initial start (when creating first time a test account)
Hi friends,

I have a requirement to integrate with gmail from salesforce, Requirement is i will have a custom button on object detail page
when i click on the button gmail compose page should be opened and automatically attachment should be attached to Gmail compose page.
Attachment can be a vf page Pdf which we will generate on the fly or we will take from attachment.

Please let us know solution on this.


Thanks,
Shiva
Hi Techie's,
Please help me out
here the scenario when i insert a account record with name 'Test A' and the folder sholud be created with the 'Test A' in Box.com
As Box Supports OAUTH Authentication it is having with conflict with writing trigger ..can any one help on this 

Thanks ,
Ram
Here is my apex class which is call from custom button contan javascript code
global class CreateOpty{

WebService static String CreateOptywithps(String Id)
{
List<Patient_Services__c> ps= new List<Patient_Services__c>();
List<Rate_Card__c> rcard=new List<Rate_Card__c>();
List<sked__Job__c> joblist=new List<sked__Job__c>();
List<sked__Job__c> joblistnw=new List<sked__Job__c>();
Set<OpportunityLineItem> olilist=new Set<OpportunityLineItem>();
List<OpportunityLineItem> olilist1=new List<OpportunityLineItem>(); 
List<Opportunity> oplist=new List<Opportunity>();
List<Account> accname = new List<Account>();
Integer extid;
String RecNamePodwP,RecNameAudwP,RecNameDiteticscwP,RecNameDivTrpwP,RecNameMntHlthwP,RecNameOccTrpwP,RecNameOptmwP,RecNamePhytrpwP,RecNamePhyTrpExClswP,RecNameRegNrsewP,RecNameSpchTrpwP;
String myeffDate = date.today().format();
Date Nxtoptycreationdate,Closedate;
String BillableCycle,InvoiceSentby,InvoiceSentTo,Accntterms,RateCardtype;
List<Patient_Services__c> psupdlist= new List<Patient_Services__c>();
Map<String, Schema.SObjectType> sObjectMap = Schema.getGlobalDescribe() ;
Map<String,Schema.RecordTypeInfo> recordType = sObjectMap.get('Opportunity').getDescribe().getRecordTypeInfosByName();
ID RtIdPodwP,RtIdAudwP,RtIdDiteticscwP,RtIdDivTrpwP,RtIdMntHlthwP,RtIdOccTrpwP,RtIdOptmwP,RtIdPhytrpwP,RtIdPhyTrpExClswP,RtIdRegNrsewP,RtIdSpchTrpwP;

User vLstUserop = [select id from User where Opportunity_Owner__c=true and IsActive=true LIMIT 1];

ps=[select id,Medicare_Account__c,Emergency_Visit__c,DVA_Code__c,Patient_DVA_Number__c,Patient_Medicare_No__c,Podiatry_Services__c,Job_Start_Datew_otime__c,Dispensing_Footwear_F049__c,DVA_Account__c,Initial_Consultation__c,Subsequent_Consulation__c,RecordType.name,Patient__r.Medicare_Account__c,Patient__r.Medicare_Account__r.Name,Patient__r.DVA_Account__c,Patient__r.DVA_Account__r.Name,Who_to_Invoice__c,Patient_Service_Lunch__c,Patient_Service_Invoice_Duration__c,Job_allocation_count__c,Job_Invoice_Start__c,Job_Invoice_Finish__c,Lunch_Break_Duration_from_Job__c,Job_Billable__c,Job__c,Patient_Service_Invoice_Finish__c,Patient_Service_Invoice_Start__c,Job_Type__c,Resource_Name__c,Service_Type__c from Patient_Services__c where id=:ID ];

joblistnw=[Select id,name,Facility_Patient_Sevices_Count__c,Day_count__c,Added_to_Opportunity__c,Opportunity_Id__c,Job_Start_Datew_otime__c,Job_Finish_Datew_otime__c,Lunch_Break_Duration__c,Job_Invoiced__c,sked__Type__c,sked__Account__c,
Resource_Name__c,sked__Job_Allocation_Count__c,Invoice_Finish__c, Invoice_Duration__c,
Invoice_Start__c,Job_Billable__c,sked__Duration__c from sked__Job__c 
where id=:ps[0].Job__c];

String medaccId = ps[0].Patient__r.Medicare_Account__c;
String MedaccName=ps[0].Patient__r.Medicare_Account__r.Name;
String DVAaccId = ps[0].Patient__r.DVA_Account__c;
String DVAaccName=ps[0].Patient__r.DVA_Account__r.Name;

// Check Record type and assing Id and Name to Variable
if(ps[0].RecordType.name =='Podiatry')
{     RtIdPodwP = recordType.get('Podiatry with Patients').getRecordTypeId();
	  RecNamePodwP=recordType.get('Podiatry with Patients').getName();
}
else if(ps[0].RecordType.name =='Audiology')
     {	RtIdAudwP = recordType.get('Audiology with Patients').getRecordTypeId();
        RecNameAudwP=recordType.get('Audiology with Patients').getName();
      }
	  
else if(ps[0].RecordType.name =='Dietetics')
    {		RtIdDiteticscwP = recordType.get('Dietetics with Patients').getRecordTypeId();
           RecNameDiteticscwP=recordType.get('Dietetics with Patients').getName();
    }
	
else if(ps[0].RecordType.name =='Diversional Therapy')
    { 	RtIdDivTrpwP = recordType.get('Diversional Therapy with Patients').getRecordTypeId();
        RecNameDivTrpwP=recordType.get('Diversional Therapy with Patients').getName();
    }
	
if(ps[0].Who_to_Invoice__c=='Medicare Account')
    {
    rcard=[Select id,Next_Opportunity_Creation_Date__c,Which_Rate_to_use_withpatients__c,Footwear_Dispensed__c,Emergency_Visit__c,PricebookEntryId__c,Job_Type__c,Assessment__c,Travel__c,Report__c,Treatment_Rate__c,Menu_Review__c,Hourly_Rate__c,Other__c,Next_Billable_Date__c,Opportunity_Creation_Frequency__c,Invoice_sent_by__c,Invoice_sent_to__c,Account_Terms__c,Rate_Card_Type__c from Rate_Card__c where Account_Name__c='Department of Human Services' AND Job_Type__c=:ps[0].Job_Type__c AND Rate_Card_Type__c=:ps[0].Service_Type__c ];
    }
else
    {
    rcard=[Select id,Next_Opportunity_Creation_Date__c,Which_Rate_to_use_withpatients__c,Footwear_Dispensed__c,Emergency_Visit__c,PricebookEntryId__c,Job_Type__c,Assessment__c,Travel__c,Report__c,Treatment_Rate__c,Menu_Review__c,Hourly_Rate__c,Other__c,Next_Billable_Date__c,Opportunity_Creation_Frequency__c,Invoice_sent_by__c,Invoice_sent_to__c,Account_Terms__c,Rate_Card_Type__c from Rate_Card__c where Account_Name__c='Department of Veteran Affairs' AND Job_Type__c=:ps[0].Job_Type__c AND Rate_Card_Type__c=:ps[0].Service_Type__c];
    }
    
List<Opportunity> opty=[select Id,Opty_No__c from Opportunity order by CreatedDate DESC limit 1];
for(Opportunity oppty:opty)
    {
    extid=Integer.valueOf(oppty.Opty_No__c)+1;
    }
    
	//Create opportunity and opportunity line item
    if(rcard.size()>0 && joblistnw.size()>0 && ps.size()>0)
    {
    Opportunity newopp =new Opportunity();
    if(ps[0].Who_to_Invoice__c=='Medicare Account')
    newopp.Optycreationbatch__c='Medicare-WP-'+myeffDate+'-'+extid;
    if(ps[0].Who_to_Invoice__c=='DVA Account')
     newopp.Optycreationbatch__c='DVA-WP-'+myeffDate+'-'+extid;
     if(ps.size()>0)
        {
				for(Patient_Services__c pslines:ps)
              {
              OpportunityLineItem oli = new OpportunityLineItem();
						oli.Opportunity =new Opportunity(Optycreationbatch__c=newopp.Optycreationbatch__c);
                        oli.PriceBookEntryId = rcard[0].PricebookEntryId__c;
                        oli.Patient_Service__c=pslines.Id;
                        oli.Provider_Name__c=pslines.Resource_Name__c;
                        oli.Patient_Service_Invoice_Start__c=pslines.Patient_Service_Invoice_Start__c;
                        oli.Patient_Service_Invoice_Finish__c=pslines.Patient_Service_Invoice_Finish__c;
                        oli.Rate_Card__c=rcard[0].Id;
                        oli.UnitPrice = rcard[0].Hourly_Rate__c;
                        oli.Quantity = pslines.Job_allocation_count__c;
                        oli.Patient_Service_Lunch__c=pslines.Patient_Service_Lunch__c;
                        oli.Invoice_Start__c=pslines.Job_Invoice_Start__c;
                        oli.Invoice_Finish__c=pslines.Job_Invoice_Finish__c;
                        oli.Lunch_Break_Duration_from_Job__c=pslines.Lunch_Break_Duration_from_Job__c;
                        oli.DVA_Code__c=pslines.DVA_Code__c;
                        oli.AHP_Type__c=pslines.Podiatry_Services__c;
                    
                     if(pslines.Job_Billable__c ==true)
                     {
                        oli.Job_lkup__c=pslines.Job__c;
                        if(pslines.Emergency_Visit__c == true)
                        {
                            oli.UnitPrice = rcard[0].Emergency_Visit__c;
                            oli.Quantity = pslines.Job_allocation_count__c;
                        }
                          if(pslines.Dispensing_Footwear_F049__c == true)
                        {
                            oli.UnitPrice = rcard[0].Footwear_Dispensed__c;
                            oli.Quantity = pslines.Job_allocation_count__c;
                        }
                         if(pslines.Who_to_Invoice__c=='DVA Account' && pslines.Service_Type__c=='Podiatry' && pslines.Initial_Consultation__c==true && pslines.Subsequent_Consulation__c==true)
                        {
                              oli.UnitPrice = rcard[0].Assessment__c;
                              oli.Quantity = pslines.Job_allocation_count__c;
                        }
                     else
                        {   
                            if(rcard[0].Which_Rate_to_use_withpatients__c=='Always use Treatment Rate')
                             {
                                 oli.UnitPrice = rcard[0].Treatment_Rate__c;
                                 oli.Quantity = pslines.Job_allocation_count__c;
                             }
                           else if(rcard[0].Which_Rate_to_use_withpatients__c=='Always use Menu Review Rate')
                             {
                                 oli.UnitPrice = rcard[0].Menu_Review__c;
                                 oli.Quantity = pslines.Job_allocation_count__c;
                             }
                        }                       
                    }
                     else
                     {
                        oli.Job_lkup__c=pslines.Job__c;
                        oli.Quantity = pslines.Job_Invoice_Duration__c; 
                        oli.UnitPrice=0;
                     }
						if( (oli.Quantity!=NULL) && (oli.PriceBookEntryId!=NULL))
                        {	olilist1.add(oli);
                             psupdlist.add(pslines);
                         
                        }
             }}
           if(psupdlist.size()>0)
                {
                      newopp.OwnerId=vLstUserop.Id;
                      newopp.stagename='To be reviewed';
                      Nxtoptycreationdate=rcard[0].Next_Opportunity_Creation_Date__c;
                      Closedate=rcard[0].Next_Billable_Date__c;
                      BillableCycle=rcard[0].Opportunity_Creation_Frequency__c;
                      InvoiceSentby=rcard[0].Invoice_sent_by__c;
                      InvoiceSentTo=rcard[0].Invoice_sent_to__c;
                      Accntterms=rcard[0].Account_Terms__c;
                      RateCardtype=rcard[0].Rate_Card_Type__c;
                 }
                      
                 if(ps[0].Who_to_Invoice__c=='Medicare Account')   
                {
                    newopp.Medicare__c = true;
                    newopp.AccountId=medaccId ;
					//Check record type and assign respective name to oppty
                    if(ps[0].RecordType.name =='Podiatry')
                        newopp.Name= MedaccName +'-' + RecNamePodwP + '-'+ Nxtoptycreationdate.format();
               else if(ps[0].RecordType.name =='Audiology')
                        newopp.Name= MedaccName +'-' + RecNameAudwP + '-'+ Nxtoptycreationdate.format();
               else if(ps[0].RecordType.name =='Dietetics')
                        newopp.Name= MedaccName +'-' + RecNameDiteticscwP + '-'+ Nxtoptycreationdate.format();
                if(ps[0].RecordType.name =='Diversional Therapy')
                        newopp.Name= MedaccName +'-' + RecNameDivTrpwP + '-'+ Nxtoptycreationdate.format();
              }
                  
               if(ps[0].Who_to_Invoice__c=='DVA Account')
              {
                    newopp.DVA__c = true;
                    newopp.AccountId=DVAaccId ;
                if(ps[0].RecordType.name =='Podiatry')
                        newopp.Name= DVAaccName  +'-' + RecNamePodwP + '-'+ Nxtoptycreationdate.format();
               else if(ps[0].RecordType.name =='Audiology')
                        newopp.Name= DVAaccName  +'-' + RecNameAudwP + '-'+ Nxtoptycreationdate.format();
               else if(ps[0].RecordType.name =='Dietetics')
                        newopp.Name= DVAaccName  +'-' + RecNameDiteticscwP + '-'+ Nxtoptycreationdate.format();
                if(ps[0].RecordType.name =='Diversional Therapy')
                        newopp.Name= DVAaccName  +'-' + RecNameDivTrpwP + '-'+ Nxtoptycreationdate.format();
              }
                  
                 newopp.closedate=Closedate;
                  newopp.Billable_Cycle__c=BillableCycle;
                  
                  //check Patient service Record type and assign respective record type id to oppty
                    if(ps[0].RecordType.name =='Podiatry')
                        newopp.RecordTypeId=RtIdPodwP ;
               else if(ps[0].RecordType.name =='Audiology')
                        newopp.RecordTypeId=RtIdAudwP ;
               else if(ps[0].RecordType.name =='Dietetics')
                        newopp.RecordTypeId=RtIdDiteticscwP ;
               else if(ps[0].RecordType.name =='Diversional Therapy')
                        newopp.RecordTypeId=RtIdDivTrpwP ;
               
                    /////////////////////
                  
                 newopp.RateCard__c=rcard[0].Id;
                  newopp.Invoice_sent_by__c=InvoiceSentby;
                  newopp.Invoice_sent_to__c=InvoiceSentTo;
                  newopp.Date_From__c=ps[0].Job_Start_Datew_otime__c;
                  newopp.Patient_DVA_No__c = ps[0].Patient_DVA_Number__c;
                  newopp.Patient_Medicare_No__c = ps[0].Patient_Medicare_No__c;
                  newopp.AHP_Type__c= ps[0].Podiatry_Services__c;
                  newopp.Date_To__c=Nxtoptycreationdate;
                  newopp.Service_Type__c=RateCardtype;
                  oplist.add(newopp);
                  psupdlist.clear();
                              
    }
	if(olilist1.size()>0 && oplist.size()>0)
    {
        insert oplist;
        insert olilist1;          
return (medaccId );
}}
And below in test class,as per my knowledge i've created test class and try to cover few apex code line, but it not showing me any test code coverage,
as I am creating test class in correct way or wrong way ? Please guide
Please explain solution and how to write test class for this in brief
 
@Istest(SeeAllData=True)
public class TestCreateOpty3 {
    Static testmethod void CreateOptyTest1()
    {
        Integer extid;
        User vLstUserop = [select id from User where Opportunity_Owner__c=true and IsActive=true LIMIT 1];
          date myDate = date.today();
        Map<String, Schema.SObjectType> sObjectMap = Schema.getGlobalDescribe() ;
            Map<String,Schema.RecordTypeInfo> recordType = sObjectMap.get('Opportunity').getDescribe().getRecordTypeInfosByName();
            ID RtIdPodwP,RtIdAudwP,RtIdDiteticscwP,RtIdDivTrpwP,RtIdMntHlthwP,RtIdOccTrpwP,RtIdOptmwP,RtIdPhytrpwP,RtIdPhyTrpExClswP,RtIdRegNrsewP,RtIdSpchTrpwP;
            String RecNamePodwP,RecNameAudwP,RecNameDiteticscwP,RecNameDivTrpwP,RecNameMntHlthwP,RecNameOccTrpwP,RecNameOptmwP,RecNamePhytrpwP,RecNamePhyTrpExClswP,RecNameRegNrsewP,RecNameSpchTrpwP;       
        RtIdPodwP = recordType.get('Podiatry with Patients').getRecordTypeId();
        RecNamePodwP=recordType.get('Podiatry with Patients').getName();
        RtIdAudwP = recordType.get('Audiology with Patients').getRecordTypeId();
        RecNameAudwP=recordType.get('Audiology with Patients').getName();
        Id MedicareAccRecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Medicare Account').getRecordTypeId();                
        
        List<Account> Parentacc= new List<Account>();
        
       Parentacc.add(new Account(RecordTypeId = MedicareAccRecordTypeId, 
                                          Name = 'Department of Human Services',
                                          Account_Address__c = '123 street 123', 
                                          ABN__c = '1236523652',
                                          Email__c = 'test1@test.com', 
                                          Facility_Notification_Opt_Out__c = True,
                                          Is_Admin__c = True,
                                          Active__c = True));
      insert Parentacc;
        
         List<Contact> Con= new List<Contact>();
        Con.add(new contact(FirstName = '',
                              LastName = 'TestContact',
                              accountId = Parentacc[0].id,
                              MobilePhone = '1234567890',
                              email = 'test@skedulo.com',
                              MailingStreet = 'ABC',
                              Active__c = True,
                              MailingCity = 'ABC',
                              MailingState = 'ABC',
                              MailingPostalCode = 'ABC',
                              MailingCountry = 'ABC'));
            insert Con;
            
          Parentacc[0].Account_Contact__c = con[0].id;
          update Parentacc;
        
         List<Account>  acc= new List<Account>();
         acc.add(new Account(RecordTypeId = MedicareAccRecordTypeId,         
                                    Name = 'Medicare Account',
                                    ParentId=Parentacc[0].Id,
                                    Account_Address__c = '123 street 123',
                                    ABN__c = '12345678912',
                                    Email__c = 'test@test.com',
                                    Facility_Notification_Opt_Out__c = True,
                                    Medicare_Number__c = '123456789',
                                    Is_Admin__c = True,
                                    Active__c = True,
                                    Card_Expiry_Date__c = system.today().addDays(10)));
           insert acc; 
        
         sked__Region__c Reg = new sked__Region__c(Name='SYD');
         Reg.sked__Timezone__c='Australia/Sydney';
         insert Reg;
        
         sked__Location__c Loc = new sked__Location__c( Name = 'Test Location',sked__Region__c = Reg.Id,sked__Address__c = 'Test Address' );
         insert Loc;
        
         sked__Resource__c Res = new sked__Resource__c(Name = 'Test Resource', sked__User__c=UserInfo.getUserId(),sked__Primary_Region__c = Reg.Id);
         insert Res;
        
         Patient__c pat1 = new Patient__c(First_Name__c='First', Last_Name__c='Last',Medicare_Account__c=acc[0].id, Location__c=Loc.Id, Patient_Status__c='Active');
         Patient__c[] pat = new Patient__c[]{pat1};     
         insert pat;
        
        List<sked__Job__c> job=new List<sked__Job__c>();         
        job.add(new sked__Job__c(skdate__Finish__c = '20/08/2014 8:30 AM',
                                            skdate__Start__c = '18/08/2014 8:30 AM',
                                            Invoice_Start__c = DateTime.parse('18/08/2014 8:30 AM'),
                                            Invoice_Finish__c = DateTime.parse('20/08/2014 8:30 AM'),
                                            sked__Duration__c = 501,
                                            sked__Region__c = Reg.Id,
                                            sked__Type__c='Podiatry Clinic',
                                            Job_Billable__c =true,
                                            Resource_Name__c=Res.Name));
         
         job.add(new sked__Job__c(skdate__Finish__c = '20/08/2014 8:30 AM',
                                            skdate__Start__c = '18/08/2014 8:30 AM',
                                            Invoice_Start__c = DateTime.parse('18/08/2014 8:30 AM'),
                                            Invoice_Finish__c = DateTime.parse('20/08/2014 8:30 AM'),
                                            sked__Duration__c = 501,
                                            sked__Region__c = Reg.Id,
                                            sked__Type__c='Audiology Clinic',
                                            Job_Billable__c =true,
                                            Resource_Name__c=Res.Name));
            
         insert job;
        
         List<Patient_Services__c> ps= new List<Patient_Services__c>();
         ps.add(new Patient_Services__c(Service_Type__c = 'Podiatry',
                                                Patient__c = pat1.Id,
                                                Job__c = job[0].id,
                                                Who_to_Invoice__c='Medicare Account',
                                                RecordTypeid= '01290000000hN0p',
                                                Patient_Service_Invoice_Start__c=DateTime.parse('18/08/2014 8:30 AM'),
                                                Patient_Service_Invoice_Finish__c=DateTime.parse('20/08/2014 8:30 AM'),
                                                Patient_Service_Lunch__c='10'));
         ps.add(new Patient_Services__c(Service_Type__c = 'Audiology',
                                                Patient__c = pat1.Id,
                                                Job__c = job[1].id,
                                                Who_to_Invoice__c='Medicare Account',
                                                RecordTypeid= '012O000000011Im',
                                                Patient_Service_Invoice_Start__c=DateTime.parse('18/08/2014 8:30 AM'),
                                                Patient_Service_Invoice_Finish__c=DateTime.parse('20/08/2014 8:30 AM'),
                                                Patient_Service_Lunch__c='10'));
                
        insert ps;
        
         List<PricebookEntry > Pricebook=new List<PricebookEntry >();
        Pricebook =[select id from PricebookEntry where IsActive=true limit 1];
         List<Rate_Card__c> rcard=new List<Rate_Card__c>();    
        rcard.add(new Rate_Card__c(Is_Active__c=true,
                                    Rate_Card_Type__c='Podiatry',
                                    Job_Type__c='Podiatry Clinic',
                                    Invoice_sent_by__c='Email',
                                    Invoice_sent_to__c='Account',
                                    PricebookEntryId__c= Pricebook[0].id,
                                    Treatment_Rate__c=100.00,
                                    Account__c = acc[0].Id,
                                    Which_Rate_to_use_withpatients__c='Always use Treatment Rate',
                                    Next_Opportunity_Creation_Date__c=date.parse('18/08/2016')));
        
       
        rcard.add(new Rate_Card__c(Is_Active__c=true,
                                    Rate_Card_Type__c='Audiology',
                                    Job_Type__c='Audiology Clinic',
                                    Invoice_sent_by__c='Email',
                                    Invoice_sent_to__c='Account',
                                    PricebookEntryId__c= Pricebook[0].id,
                                    Treatment_Rate__c=100.00,
                                    Account__c = acc[0].Id,
                                    Which_Rate_to_use_withpatients__c='Always use Treatment Rate',
                                    Next_Opportunity_Creation_Date__c=date.parse('18/08/2016')));
         insert rcard;
        
         List<Opportunity> opty=[select Id,Opty_No__c from Opportunity order by CreatedDate DESC limit 1];
         extid=Integer.valueOf(opty[0].Opty_No__c)+1;
       
        List<Opportunity> newopp=new List<Opportunity>();
         newopp.add(new Opportunity(
         			Optycreationbatch__c='Medicare-WP-'+myDate+'-'+extid,
                     OwnerId=vLstUserop.Id,
                     stagename='To be reviewed',
                     Medicare__c = true,
                     AccountId=acc[0].Id ,
                     Name=  acc[0].Name +'-' + 'Podiatry with Patients' + '-'+ myDate.format(),
                     Invoice_sent_by__c=rcard[0].Invoice_sent_by__c,
                     Invoice_sent_to__c=rcard[0].Invoice_sent_to__c,
                     closedate=myDate,
                     AHP_Type__c= ps[0].Podiatry_Services__c,
                     Date_To__c=rcard[0].Next_Opportunity_Creation_Date__c,
                     Service_Type__c= rcard[0].Rate_Card_Type__c,
                     RecordTypeId=RtIdPodwP,
                     RateCard__c=rcard[0].Id));
        
        newopp.add(new Opportunity(
            						Optycreationbatch__c='Medicare-WP-'+myDate+'-'+extid+1,
                                     OwnerId=vLstUserop.Id,
                                     stagename='To be reviewed',
                                     Medicare__c = true,
                                     AccountId=acc[0].Id ,
                                     Name=  acc[0].Name +'-' + 'Audiology with Patients' + '-'+ myDate.format(),
                                     Invoice_sent_by__c=rcard[0].Invoice_sent_by__c,
                                     Invoice_sent_to__c=rcard[0].Invoice_sent_to__c,
                                     closedate=myDate,
                                     AHP_Type__c= ps[1].Podiatry_Services__c,
                                     Date_To__c=rcard[0].Next_Opportunity_Creation_Date__c,
                                     Service_Type__c= rcard[0].Rate_Card_Type__c,
                                     RecordTypeId=RtIdAudwP,
                                     RateCard__c=rcard[0].Id));
        insert newopp;
                
        List<OpportunityLineItem> oli = new List<OpportunityLineItem>();
          oli.add(new OpportunityLineItem(
                                         OpportunityId =newopp[0].id,
                                         PriceBookEntryId = rcard[0].PricebookEntryId__c,
                                         Provider_Name__c=ps[0].Resource_Name__c,  
                                         Patient_Service__c=ps[0].Id,
                                         Rate_Card__c=rcard[0].Id,
                                         Patient_Service_Invoice_Start__c=ps[0].Patient_Service_Invoice_Start__c,
                                         Patient_Service_Invoice_Finish__c=ps[0].Patient_Service_Invoice_Finish__c,
                                         Patient_Service_Lunch__c=ps[0].Patient_Service_Lunch__c,
                                         UnitPrice = rcard[0].Treatment_Rate__c,
                                         Invoice_Start__c=ps[0].Job_Invoice_Start__c,
                                         Invoice_Finish__c=ps[0].Job_Invoice_Finish__c,
                                         Lunch_Break_Duration_from_Job__c=ps[0].Lunch_Break_Duration_from_Job__c,
                                         AHP_Type__c=ps[0].Podiatry_Services__c,
                                         Quantity = 1,
                                         Job_lkup__c=ps[0].Job__c)
                                         );
       oli.add(new OpportunityLineItem(
                 OpportunityId =newopp[1].id,
                 PriceBookEntryId = rcard[1].PricebookEntryId__c,
                Provider_Name__c=ps[1].Resource_Name__c,  
                 Patient_Service__c=ps[1].Id,
                 Rate_Card__c=rcard[1].Id,
                 Patient_Service_Invoice_Start__c=ps[1].Patient_Service_Invoice_Start__c,
                 Patient_Service_Invoice_Finish__c=ps[1].Patient_Service_Invoice_Finish__c,
                 Patient_Service_Lunch__c=ps[1].Patient_Service_Lunch__c,
                 UnitPrice = rcard[1].Treatment_Rate__c,
                 Invoice_Start__c=ps[1].Job_Invoice_Start__c,
                 Invoice_Finish__c=ps[1].Job_Invoice_Finish__c,
       			 Lunch_Break_Duration_from_Job__c=ps[1].Lunch_Break_Duration_from_Job__c,
       			 AHP_Type__c=ps[1].Podiatry_Services__c,
                 Quantity = 1,
                 Job_lkup__c=ps[1].Job__c));
          insert oli;
        }}


 

Last night, we started having tests fail in our dev environment.  We have the following methods (shortened)

 



public static void updateTargetDate(...) {
     Set<Id> futureIds = new Set<Id>();
     ...
     // Add Ids
     ...
     if (!futureIds.isEmpty()) {
          updateTargetDateFromMilestone(futureIds);
     }
}

@future
public static void updateTargetDateFromMilestone(Set<Id> caseIds) {
     ...
}

 

Yesterday at noon (we run all tests in dev at noon and midnight) all the tests were running without error.  At midnight most of our tests were failing with the following error:

 

System.TypeException: Invalid conversion from runtime type SET<String> to SET<Id>

 

with a referral to the method of updateTargetDateFromMilestone(Set<Id> caseIds).  This file has not been updated since June 24th 2011.

 

So the question is, has anyone else seen this error crop up?  I know that in Apex Strings and Id "should" be interchangeable, however, it doesn't matter in this case since the Set being made is of type Id and the Set parameter for the calling method is of type Id.

  • September 30, 2011
  • Like
  • 0
How to parse the response 
 <?xml version=\"1.0\" encoding=\"UTF-8\"?><methodResponse xmlns:ex="http://ws.apache.org/xmlrpc/namespaces/extensions"><params><param><value><array><data><value><boolean>1</boolean></value><value>OK</value></data></array></value></param></params></methodResponse>

I wanted to write logic based on Boolean value in response but am unable to parse this one 
 
Hi,

I'm having an issues with Salesforce to Shoretel Integration, when our users try to log a call with the status of, "No VM was left"  logs say the task is successfully logged however, its not.

14:26:47.364 INFO : 914719622: Call 00030000-3358-58c8-b5bf-0010493209a9: >>> Salesforce Save Log
14:26:47.364 DEBUG : 914719622: Call 00030000-3358-58c8-b5bf-0010493209a9: Save Params: Subject=Call 8/1/2017 2:26 PM&Activitydate=2017-8-1&CallObject=00030000-3358-58c8-b5bf-0010493209a9&Phone=+1 (616) 888-3010&Description=&CallDurationInSeconds=13&CallType=Outbound&Status=completed&Type=Call&whoId=00Q0G00001AwZNz&whatId=&CallDisposition=No VM was Left

14:26:47.364 DEBUG : >>> SaveLog: "Task"
14:26:47.367 DEBUG : <<< SaveLog: "Task"

14:26:47.676 DEBUG : !!! SaveLog: "Task": Success
Hi,

I've recently recieved an email from Salesforce regarding Code Changes Required for Apex compiler.

in that they have stated that ILLEGAL ANNOTATIONS are not supporitive anymore. Just wondering what are the legal annotations in APEX? Could anyone help me in knowing that?

Thanks,
GR
I'm in the "Salesforce Connect" module and trying to complete the set up to integrate a sample as requested:

"As part of this module, you integrate sample order data with the existing account data in your Salesforce Developer Edition. To go through the steps, you need to install a test package that configures the necessary schema on the account object, creates a Customer ID field, and assigns a value for Customer ID to each account.

Follow these steps to install the package.
Open a browser, and click here to start the installation.
Select Install for Admins Only.
Click Install."

When I click on the "click here" it takes me to a SFDC log in page, where I try to select my Dev Org login in username and password (from my production enviro).  It does not work and even after trying to reset my password I never receive an email and cannot log in.

Please help! 
Thanks,
Rochelle
Have the following forumla, I've tried writing a few different ways, of case or if and not sure what to do to correct. I need to evaluate the picklist for a checkbox, marking true for values listed, or else leave unchecked


IF(OR(ISPICKVAL(Unit_Type__c, 
"Chiller Air Cooled <10T", 
"Chiller Air Cooled 10-50T",
"Chiller Air Cooled >50T",
"Chiller Water Cooled <10T",
"Chiller Water Cooled 10-50T", 
"Chiller Water Cooled >50T", 
"Computer Room Air Conditioning Unit",
"Cond/Outdoor Unit",
"Cooler/Freezer",
"Cooling Tower <10T", 
"Cooling Tower 10-50T", 
"Cooling Tower >50T", 
"ERV/HRU",
"Heat Exchanger Brazed Plate",  
"Heat Exchanger Plate & Frame",  
"Heat Exchanger Shell & Tube",  
"RTU <5T", 
"RTU 5T-15T",  
"RTU 15-30T",
"RTU 30T+", TRUE, FALSE)



 Error: Syntax error. Missing ')'
Hi All,
while deploying the custom metadata object (.mtd )from current org to another org using autorabit as a CI tool,
we are getting this error" Error: Property 'valueSet' not valid in version 37.0 (line 14, column 13)"
please let me know anyone facing the same issue.

and is it because of salesforce not supporting gloal picklist values from 38 version ??
do we need to convert our existing global picklist values to global value set to move the changes to 38 version not sure this s the rite approach 
please let us know if any1 know the solution.

Thanks,
Bhavya
Hello I am trying to integrate my local PostgreSQL database with salesforce. I have written a Restful web service in java which will fetch the data from Employee Table and return the data in JSON format. 

So the base URL of my REST API is 
localhost:8080/RESTfulExample/rest/json/metallica/get
So I wanted to call this web service from salesforce. But I think we cannot achieve because this service is running on my local machine. So I would like to know that is there any way I can host my local API using some providers(for just eg www.hotapiprovider.com/RESTfulExample/rest/json/metallica/get)  and then I can call it from Salesforce. 

Could anyone help me out to solve my issue.
Hello,

I have a requirement where we have setup Email-to-Case setup. Our SLA is not based on stage of the case and not from start of the case to case closure. Instead, our SLA depends on time to reply for each email received for the case. 

For example, lets say, case has been created since an email is received, and lets say the SLA is 3 hours. then the clock to start once the case is created and should stop once the email is replied back. 

In case of 2 emails received on the same case, for ex., 9 AM and 11 AM, then the respective SLA is 12 noon & 1PM respectively. 

1. Is there any way to have dynamic multiple clocks based on number of emails not replied back? 

2. If the 1st point is not possible, is it possible to reset the clock once the 1st email is replied. For ex.,Until first email is replied,clock to show timer till 12 noon.  Once the first email is replied, the clock should start from the 2nd email received time and the clock to show the remaining time until 1PM. 

Is it possible or is there any way in salesforce where the SLA can be setup for each email received? Could you please advise if there is anye best way to achieve the solution.

Thanks a lot in advance. 
Hi,

I have a controller for which i have written a test class which covers only 50%, I am not able to cover the following lines for which i need help on it

//
   if(firstcontract.Contract_Start_Date__c<contractObj.Contract_Start_Date__c && firstcontract.Contract_End_Date__c<contractObj.Contract_End_Date__c ){
                          if(firstcontract.Contract_End_Date__c>=contractObj.Contract_Start_Date__c){
                          firstcontract.Contract_End_Date__c=contractObj.Contract_Start_Date__c.addDays(-1);
                          update firstcontract;//put the list and update
                          }                       
                        }  
                        else{
                        system.debug('elsesection');
                        if(contractObj.Contract_End_Date__c>=firstcontract.Contract_Start_Date__c){
                          contractObj.Contract_End_Date__c=firstcontract.Contract_Start_Date__c.addDays(-1);
                          update contractObj;// put the list and update
                          }    
                          
                          
                          //
                          
                            if(idVsContractmap.containsKey(controbj.Account__r.Id)) {
                List<Contract__c> contrAccList = idVsContractmap.get(controbj.Account__r.Id);
                contrAccList.add(controbj);
                idVsContractmap.put(controbj.Account__c, contrAccList);
            } else {
                idVsContractmap.put(controbj.Account__c, new List<Contract__c> { controbj });
            }   
            //
 
MY APEX CLASS :

public class overlapDateHandler{

    public void overlapDateMethod(List<Contract__c> contractList){
    if(checkRecursive.runOnce())
    {

//list<Contract__c> contractList=new list<Contract__c>();
List<Id> conId = new List<Id>();
List<Id> conAccId = new List<Id>();
contractList=Trigger.new;

     for(Contract__c conObj : contractList){
            
            if(conObj.Account__c  != null){
                
                conId.add(conObj.Id);
                conAccId.add(conObj.Account__c);
            }
        }
      list<Contract__c> contrList = new List<Contract__c>(); 
      map<id, list<Contract__c>> idVsContractmap = new map<id, list<Contract__c>>();  
      contrList = [Select name,Contract_Start_Date__c, Contract_End_Date__c, Account__c,Account__r.Id,Status__c From Contract__c where Status__c='Signed by Customer' and Active__c=true and Account__c=: conAccId];
        for(Contract__c controbj : contrList){
            
            if(idVsContractmap.containsKey(controbj.Account__r.Id)) {
                List<Contract__c> contrAccList = idVsContractmap.get(controbj.Account__r.Id);
                contrAccList.add(controbj);
                idVsContractmap.put(controbj.Account__c, contrAccList);
            } else {
                idVsContractmap.put(controbj.Account__c, new List<Contract__c> { controbj });
            }   
            
          }      
        system.debug('contractmap'+idVsContractmap);
       for(Contract__c conObj : contractList){
             
            if(conObj.Account__c != null){   
            system.debug('account'+idVsContractmap.containsKey(conObj.Account__c));
                if(idVsContractmap.containsKey(conObj.Account__c)){
                    Contract__c firstcontract=new Contract__c();
                    for(Contract__c contractObj : idVsContractmap.get(conObj.Account__c)){
                     //Logic Begins for manage start date and end date
                     
                     system.debug('firstcontract'+firstcontract);
                     if(firstcontract.id==null) {
                     firstcontract=contractObj;
                     system.debug('setsfirstcontract');
                     }
                     else{
                      system.debug('secondsection'+'secondsection');
                      system.debug('first contract '+firstcontract.name);
                      system.debug('second contract '+contractObj.name);
                      if(firstcontract.Contract_Start_Date__c<contractObj.Contract_Start_Date__c && firstcontract.Contract_End_Date__c<contractObj.Contract_End_Date__c ){
                          if(firstcontract.Contract_End_Date__c>=contractObj.Contract_Start_Date__c){
                          firstcontract.Contract_End_Date__c=contractObj.Contract_Start_Date__c.addDays(-1);
                          update firstcontract;//put the list and update
                          }                       
                        }  
                        else{
                        system.debug('elsesection');
                        if(contractObj.Contract_End_Date__c>=firstcontract.Contract_Start_Date__c){
                          contractObj.Contract_End_Date__c=firstcontract.Contract_Start_Date__c.addDays(-1);
                          update contractObj;// put the list and update
                          }    
                        
                        }
                                               
                    }   
                   }
            }
        } 

}
}
    
    
    }
}
 
MY TEST CLASS :

@isTest
public class Test_ContractoverlapDateHandler{

    public static testMethod void TestContractdate(){
      Profile pf = [Select Id from Profile where Name = 'System Administrator'];
        User u = new User();
        u.FirstName = 'Test';
        u.LastName = 'User';
        u.Email = 'testuser@test123456789.com';
        u.CompanyName = 'test.com';
        u.Title = 'Test User';
        u.Username = 'testuser@test123456789.com';
        u.Alias = 'testuser';
        u.CommunityNickname = 'Test User';
        u.TimeZoneSidKey = 'Australia/Sydney';
        u.LocaleSidKey = 'en_AU';
        u.EmailEncodingKey = 'ISO-8859-1';
        u.ProfileId = pf.Id;
        u.LanguageLocaleKey = 'en_US';
        insert u;
        
          system.runAs(u){ 
          
          Trigger_Status__c ts=new  Trigger_Status__c();
          ts.Name='ContractTrigger';
          ts.Active__c=true;
          insert ts;
           String prospectRecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Prospect Account').getRecordTypeId();

          
                     Account acc = new Account(Name = 'Sample', Active__c = true, Aquire__c = true, Type = 'Prospect Account', 
                                      RecordTypeId = prospectRecordTypeId, Migrated__c = false, 
                                      Estimated_Total_Air_Travel_Spend__c = 0, Manual_Revenue_Update__c = false,
                                      Agency__c = 'N', Dealing_Flag__c = 'N', Aquire_Override__c = 'N' ,Contract_End_Date__c = Date.Today()
                                      );
                                    
                                    
                    insert acc;
                
                    Contact con = new Contact(FirstName = 'Sample', LastName = acc.Name, AccountId = acc.Id);
                
                    insert con;
                
                
                    Opportunity opp = new Opportunity(  Name = 'Opp'+acc.Name , AccountId = acc.Id,
                                              Amount = 500000, Category__c = 'Corporate Airfares', CloseDate = Date.Today(),
                                              StageName = 'Qualify');
                                              
                    insert opp;
                
                    Opportunity opp1 = new Opportunity(  Name = 'Opp1'+acc.Name , AccountId = acc.Id,
                                              Amount = 600000, Category__c = 'Corporate Airfares', CloseDate = Date.Today(),
                                              StageName = 'Qualify');
                                              
                    insert opp1;
                
               
                    Boolean b=true;
                    Proposal__c prop = new Proposal__c(Name = 'Proposal '+opp.Name , Account__c = opp.AccountId, Opportunity__c = opp.Id,
                                              Active__c = true, Type__c = 'Corporate Airfares', International_Annual_Share__c = 70,
                                              Domestic_Annual_Share__c = 90, Frequent_Flyer_Status_Upgrade__c = 'No',
                                              MCA_Routes_Annual_Share__c = 70, Valid_From_Date__c = Date.Today(),
                                              Qantas_Annual_Expenditure__c = 500000, Qantas_Club_Discount__c = 'No',
                                              NAM_Approved__c = false, NAM_Rejected__c = false, Pricing_Approved__c = false, Pricing_Rejected__c = false,
                                              DO_Approved__c = false, DO_Rejected__c = false, TeamLead_Approved__c = false, TeamLead_Rejected__c = false,
                                              Approval_Required_Others__c = false,Status__c='Accepted by Customer',Proposal_End_Date__c=date.today().addmonths(12),Proposal_Start_Date__c=date.today()
                                              );
                    insert prop;
                    
                    Proposal__c prop1 = new Proposal__c(Name = 'Proposal '+opp1.Name , Account__c = opp1.AccountId, Opportunity__c = opp1.Id,
                                              Active__c = true, Type__c = 'Corporate Airfares', International_Annual_Share__c = 70,
                                              Domestic_Annual_Share__c = 90, Frequent_Flyer_Status_Upgrade__c = 'No',
                                              MCA_Routes_Annual_Share__c = 70, Valid_From_Date__c = Date.Today(),
                                              Qantas_Annual_Expenditure__c = 500000, Qantas_Club_Discount__c = 'No',
                                              NAM_Approved__c = false, NAM_Rejected__c = false, Pricing_Approved__c = false, Pricing_Rejected__c = false,
                                              DO_Approved__c = false, DO_Rejected__c = false, TeamLead_Approved__c = false, TeamLead_Rejected__c = false,
                                              Approval_Required_Others__c = false,Status__c='Accepted by Customer',Proposal_End_Date__c=date.today().addmonths(24),Proposal_Start_Date__c=date.today());                
            
                    insert prop1;   
                            
                   
                    Contract__c contr = new Contract__c(Name = 'Contract '+opp.Name , Account__c = prop.Account__c, Opportunity__c = prop.Opportunity__c, Proposal__c = prop.Id,
                                              Active__c = true, Type__c = 'Corporate Airfares', International_Annual_Share__c = 70,
                                              Domestic_Annual_Share__c = 90, Frequent_Flyer_Status_Upgrade__c = 'No', Contracted__c = true,
                                              MCA_Routes_Annual_Share__c = 70, Contract_Start_Date__c = Date.Today(), Contract_End_Date__c = Date.Today().addmonths(12),
                                              Qantas_Annual_Expenditure__c = 500000, Qantas_Club_Discount__c = 'No', Status__c = 'Signature Required by Customer'                                           
                                              );
                                              
                                              
                    insert contr;
                            
                           
               
                    Contract__c contr1 = new Contract__c(Name = 'Contract '+opp1.Name , Account__c = prop1.Account__c, Opportunity__c = prop1.Opportunity__c, Proposal__c = prop1.Id,
                                              Active__c = true, Type__c = 'Corporate Airfares', International_Annual_Share__c = 70,
                                              Domestic_Annual_Share__c = 90, Frequent_Flyer_Status_Upgrade__c = 'No', Contracted__c = true,
                                              MCA_Routes_Annual_Share__c = 70, Contract_Start_Date__c = Date.Today(), Contract_End_Date__c = Date.Today().addmonths(24),
                                              Qantas_Annual_Expenditure__c = 500000, Qantas_Club_Discount__c = 'No', Status__c = 'Signature Required by Customer'                                         
                                              );
                                            
                                              
                    insert contr1;
                    
                    Contract__c contr2 = new Contract__c(Name = 'Contract '+opp1.Name , Account__c = prop1.Account__c, Opportunity__c = prop1.Opportunity__c, Proposal__c = prop1.Id,
                                              Active__c = true, Type__c = 'Corporate Airfares', International_Annual_Share__c = 70,
                                              Domestic_Annual_Share__c = 90, Frequent_Flyer_Status_Upgrade__c = 'No', Contracted__c = true,
                                              MCA_Routes_Annual_Share__c = 70, Contract_Start_Date__c = Date.Today(), Contract_End_Date__c = Date.Today().addmonths(24),
                                              Qantas_Annual_Expenditure__c = 500000, Qantas_Club_Discount__c = 'No', Status__c = 'Signature Required by Customer'                                       
                                              );
                                            
                                              
                    insert contr2;       
                    
                       
     
                }
              
        }     
             
 }

Kindly help me pls

Thanks in advance
Acccount NameClosed WonClosedLostProgressiveValidation
Acc18452
Acc26524
Acc31907
Acc45656
 I want to display this table on my VF Page. Can anybody recommend code for it 

 
I submitted my work and I received this error message. The challenge says nothing about adding a field with this name. 

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error in your org which is preventing this assessment check from completing: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Discount_Percent__c]: [Discount_Percent__c]
I need to retrieve all the validation rules associated with a given object, using the REST API.

Looking in doc/forums, I've found that I could retrieve validation rules associated with an object using the following query:

https:///services/data/v35.0/tooling/query?q=Select Id,Active,Description,ErrorDisplayField, ErrorMessage From ValidationRule Where EntityDefinitionId = 'xxxxx'

The problem is that I don't have the object'ID needed to filter, I only have its name. Is there any way to filter using the object's name?

Another alternative seems to be getting the object'ID, but it seems that Metadata REST API (i.e. describe) does not return it.

Any help on this is very appreciated.

Mariana
Initially I have set all the InputCheckbox values to false. And shown the values on PageblockTable in VFP. When user changes the checkbox values and click submit, I wanted to get all the new Checkbox values. How can i do that.
 
//VFP:

<apex:page controller="Testctrl">
    <apex:form >
    <apex:pageBlock >
        <apex:pageBlockTable value="{!attdmap}" var="attdkey">
        
            <apex:column value="{!attdkey.Name}"/>
            <apex:column>
                <apex:facet name="header">Absent</apex:facet>
                <apex:inputCheckbox label="Absent" value="{!attdmap[attdkey]}" />
            </apex:column>

        </apex:pageBlockTable>
    </apex:pageBlock>
    
    <apex:commandButton action="{!submit}" value="Submit"/>
    </apex:form>
</apex:page>



//CTRL:

public class Testctrl {
    public list<Student__c> acctlist {get;set;}
    public Map<Student__c, Boolean> attdmap{get;set;}
     
    public Testctrl(){
        attdmap = new Map<Student__c, Boolean>();
        acctlist = [SELECT Id, Name FROM Student__c];

        for(Student__c atu23 : acctlist){
        attdmap.put(atu23,False);
        }
       
    }
    public void submit(){
    }

}

 
We have enabled the Lightning connect and defined an External Data Source for Lightning Connect - Odata 2.0 Adapter and the External Object records are loaded from Informatica. The functionality basically displays all the external object records related to an Account (External object is related to Account - indirect lookup relationship), on the Account detail page as an inline VF page. When the external object records are queried, in the background a REST callout is made. So the Test class needs to use a Test.setMock() method to set a mock response. Here is the code snippet that I'm using:

 static testMethod void PositiveTestCase() {
// test user - currentUser
system.runAs(currentUser){

//Setup Test Data
//Mock response
String testResp = 'CUSTOMER_SALES_HISTORY__x:{DisplayUrl=TEST,CUSTOMER_SALES_HISTORY_IID__c=TEST,ExternalId=TEST,SAP_CUSTOMER_NUMBER__c = 0000001003, PRODUCT_LINE__c  = LINEA, PRODUCT_NAME__c =PRD1 PRODUCT_TYPE__c = TYPEA}, CUSTOMER_SALES_HISTORY__x:{DisplayUrl=TEST1,CUSTOMER_SALES_HISTORY_IID__c=TEST1,ExternalId=TEST1,SAP_CUSTOMER_NUMBER__c =1234, PRODUCT_LINE__c  = LINEA, PRODUCT_NAME__c =PRD2 PRODUCT_TYPE__c = TYPEB}';

//Test class that implements HttpCalloutMock and returns a reusable response
Test_ReusableMockResponse fakeResponse = new Test_ReusableMockResponse(200,'SUCCESS',testResp, null);

Test.setMock(HttpCalloutMock.class, fakeResponse);
Test.startTest();
//set the standard Controller to the test Account created
ApexPages.StandardController std = new ApexPages.StandardController(testAccount);
InlineOrderHistoryViewController controllerInstance = new InlineOrderHistoryViewController(std);
Test.stopTest();
}
}

 
For a straightforward - web service built on REST, this mock response approach should ideally work. Considering the mock response as the real time response received, the unit test case scenario should cover the code.
But in this case, the mock response is not considered as the real time response in the unit test method and all the subsequent lines of code aren't covered.
Also, the Test.setMock() does help in overcoming -' Test methods to not support the WebService Callout' error. So I'm totally convinced that I need to cover this the way we cover the code involving web service callouts.

Please let me know if you have a workaround for this

Thanks,
Sirisha Kodi
Hi, I'm trying to add an External Data Source of type Lightning Connect: OData 2.0 as described near the end of this article [1] but when I am on the New External Data Source [2] page, the only type in the dropdown is Simple URL.  I've checked Enable Lightning Components in the Develop | Lightning Components (Beta) menu.

Is there anything else I need to do to be able to select "Lightning Connect: OData 2.0" in the Type dropdown?  Thanks!

[1] https://developer.salesforce.com/blogs/developer-relations/2015/03/accessing-sql-server-azure-database-lightning-connect.html?eid=singlesend
[2] https://help.salesforce.com/apex/HTViewHelpDoc?id=platform_connect_add_external_data_source.htm&language=en_US
Hi,
i having some problem in salesforce checkmarx report. this generated one waring : Bulkify_Apex_Methods_Using_Collections_In_Methods in particular code


interested_prop = String.escapeSingleQuotes(interested_prop);
String qry = 'select ' + sObjectUtility.sObjectFields('srex__Matches__c') +' Id from Matches__c';
string whereString = ' where Interested_in_Dealing__c = false';
whereString += ' AND ('+ sObjName + ' =: propid ';
whereString += ' OR '+ lookup2 +' =: propid )';
whereString += ' AND ('+ sObjName + ' =: interested_prop ';
whereString += ' OR '+ lookup2 +' =: interested_prop )';

list<Matches__c> matches = Database.query(String.escapeSingleQuotes(qry)+String.escapeSingleQuotes(whereString));
if(matches.size() > 0){
      matches[0].Interested_in_Dealing__c = true;
     try{
            update matches;
         }catch(Exception ex){
                   system.debug('Error occurred while perfoming DML Operation :::::'+ ex.getMessage());
           }
}else{
                Matches__c new_match = new Matches__c();
                new_match.put(sObjName, prop_id);
                new_match.put(lookup2 , interested_prop);
                new_match.Interested_in_Dealing__c = true;
try{
        List<Matches__c> matchlst =
        new List<Matches__c>();
        matchlst.add(new_match);
        insert matchlst;
}catch(Exception ex){
        system.debug('Error occurred while perfoming DML Operation :::::'+ ex.getMessage());
}
}
pls help me out
Got this error & just following directions...

Challenge Not yet complete... here's what's wrong: 
There was an unexpected error while verifying this challenge. Usually this is due to some pre-existing configuration or code in the challenge Org. We recommend using a new Developer Edition (DE) to check this challenge. If you're using a new DE and seeing this error, please post to the developer forums and reference error id: HQVTALII

It is a brand new org.
I was wondering if anyone has had any experience assigning a Topic to a record from the Question object before.

Some background
We are currently buiding a custom site using VisualForce and custom JS to essentially provide our own interface to the standard SF community functionality.

The page I'm currently working on is our Q&A page - specifically the page through which customers can post their own Questions to our customer community.

The Goal
The issue is, we need to be able to filter our questions by topic - not just by data category.  This must also be achieved purely in APEX without any standard apex components on the VF page.

What has been done so far
So far, I have enabled topics for the question object (under Topics for Objects in SF setup).  I have enabled system permissions for the appropriate profiles to create, edit, and assign topics.  Yet I keep running into an apex exception when I try to assign the topic to the question.

Attempt 1: Manually insert a record into the TopicAssignment object
In the code, I create and insert a question (and topic if required).  This works without any problems.  Then I run the following:
TopicAssignment a = new TopicAssignment(TopicId=t.Id, EntityId=q.Id, NetworkId=n.Id);
insert a;
This line will throw the following error:
Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, Entity ID: id value of incorrect type: 906N00000004EF7IAM: [EntityId]
Attempt 2:  Use the ConnectApi
I then found a new class in the ConnectApi called Topics which does not yet appear to be documented.
ConnectApi.Topics.assignTopic(networkId question.Id, topic.Id);
Using this instead yields the following error:
Failed to assign topic to 906N00000004EFC. Please ensure you have permissions to assign topics for this record.


Both of the above errors still occur if the class has sharing off - e.g.
public without sharing class ClassName {
}



I am hoping to achieve this without having to create a new object as a workaround.

So, I was wondering if anyone else has had this issue?  Has anyone succesfully assigned a topic to a question in pure APEX?  Can anyone help?

Thank you very much,

Nic



 
Dear all,

For 2 days, I have been having the following issue : all the automatical emails my team and I usually receive from Salesforce (e.g. emails when a big opportunity is won, emails when I am trying a new email template and sending me a test email to preview the result...) are sent with a few hours of delay (usually at the end of the day).

So I tried the email deliverability test and I only received ~20 of the 32 emails I should have received.

Do you have any idea on why this is happening ?

Thanks in advance,
Yannick
Is this happening to you? You're 100% sure you've done a Trailhead challenge right, but it just won't validate?

So here's the deal. We're doing a real-time API call to check your work, and sometimes, there might be existing configuration or code in your Developer Edition that interferes with our check, causing it to fail.

The best thing to do if you're 100% sure you're right is create a new Developer Edition and do the challenge again.

But wait, what about my badges?

No worries! Logging into Trailhead is a two-step process. Check out this image.

The login button is in the upper right, and the second login is on the unit page right before you do the challenge

In step (1), you tell Trailhead who you are. This is where your badges are stored. You can use your production username or any Developer Edition username for this step.

In step (2), you tell Trailhead where you're doing the challenge. This must be a Developer Edition.

Okay, I got the new DE. Now what?

So, just stay logged in at (1), and make a new Developer Edition to log in at (2). Do the challenge in the new Developer Edition and check it.

If it passes, it was probably something funky in your old DE. If it fails, time to revisit your challenge! Read the instructions again and make sure you didn't miss any steps.

But why would this happen?

It could be your DE is older, or it could be you've done some additional config or customization that is interfering with our check. 

Good luck!
There is a permission page after community user login via mobile app which we created with native SF SDK. The wording "否允存取" in the permission page is very strange in Chinese locale. I don't understand the meaning of "否允存取" even I speak in Chinese for 30 years. Is there a way we can edit the wording or removing the page!? Actually our client owns the APP, the SF org and all member data so we don't need the permission page at all.
HI Experts,

while posting my code in developers community, getting this error what does it mean by."The operation is not permitted. If you received this in error, please contact info@developerforce.com (code: B2)"
I am working on a project to create a VF page where the user can add multiple attachments when creating a record.  Someone suggested the controller listed below, and while it will save the attachments, it isn't saving any of the information entered in the VF page for the Incident Report.  If anyone can take a look at this and tell me why the Incident Report isn't being saved, I would truly appreciate it.

APEX CLASS
 
public class AddMultipleAttachments {
    
    public Incident_Reports__c objIncidentReport { get; set; }
    public Attachment attachment1 { get; set; }
    public Attachment attachment2 { get; set; }
    public Attachment attachment3 { get; set; }

    public AddMultipleAttachments (ApexPages.StandardController stdController)
    {
        // Record and Attachments to be inserted
        objIncidentReport = new Incident_Reports__c();
        attachment1 = new Attachment();
        attachment2 = new Attachment();
        attachment3 = new Attachment();
    }

    public PageReference createRecordAndAttachments()
    {
        
        Savepoint sp = Database.setSavepoint();
        try
        {
            // Insert the record
            insert objIncidentReport;

        
            // Insert Attachments;
            List<Attachment> toInsert = new List<Attachment>();

            if(attachment1.Name != null)
            {
                attachment1.ParentId = objIncidentReport.Id;
                toInsert.add(attachment1);
            }
            
            if(attachment2.Name != null)
            {
                attachment2.ParentId = objIncidentReport.Id;
                toInsert.add(attachment2);
            }

            if(attachment3.Name != null)
            {
                attachment3.ParentId = objIncidentReport.Id;
                toInsert.add(attachment3);
            }

            if(toInsert.size() > 0)
                insert toInsert;
        }
        catch(Exception ex)
        {
            Database.rollback(sp);
            ApexPages.Message msg = new ApexPages.Message(ApexPages.Severity.ERROR, ex.getMessage());
            ApexPages.addMessage(msg);
        }

        // View the record
        PageReference page = ApexPages.currentPage();
        page.setRedirect(true);
        return page;
    }

}

Here is the Visualforce page:

Visualforce Page
 
<apex:page standardController="Incident_Reports__c" extensions="AddMultipleAttachments">
    
    <apex:sectionHeader title="Property Incident Reports Edit" subtitle="{!Incident_Reports__c.Name}"/>
    <apex:form >
        
        <apex:commandButton value="Save" action="{!save}"/>
        <apex:commandButton value="Save with Attachments" action="{!createRecordAndAttachments}"/>
        <apex:commandButton value="Cancel" action="{!cancel}"/>
        <apex:pageBlock title="Property Incident Reports Edit" mode="edit" id="thePageBlock">
          <apex:pagemessages />
            
            <apex:pageBlockSection columns="1">
              <apex:outputText value="ATTENTION:  Attorney work product/privileged document (for internal use only).  NOT for Associate Injuries, use Worker's Comp Incident Report." style="font-weight:800"/>
              <apex:outputText value="RED LINES REPRESENT REQUIRED FIELDS" style="color:red"  />
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Property Information" columns="2">
                <apex:inputField value="{!Incident_Reports__c.Property__c}" required="true"/>
                
            </apex:pageBlockSection>
               
            <apex:pageBlockSection title="Claimant Information" columns="2">
                <apex:inputField value="{!Incident_Reports__c.Claimant_s_Name__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Claimant_s_Gender__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Claimant_s_Address__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Claimant_s_Age__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Claimant_s_Date_of_Birth__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Claimant_s_Phone_Number__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Claimant_s_Phone_Number_Other__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Claimant_s_Occupation__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Alliance_Associate__c}" required="false"/>
            </apex:pageBlockSection>  
                          
        </apex:pageBlock>
            
       
        
       <apex:pageBlock title="Incident Information" mode="edit" id="Incident">
            
          <apex:actionRegion >
            <apex:pageBlockSection title="Incident Type" columns="1">
              <apex:pageBlockSectionItem >
                    <apex:outputLabel value="Type of Incident"/>
                    <apex:outputPanel >
                      <apex:inputField value="{!Incident_Reports__c.Type_of_Incident__c}" required="TRUE">
                        <apex:actionSupport event="onchange" rerender="Incident" status="IncidentType"/>
                      </apex:inputField>
                      <apex:actionStatus startText="applying value..." id="IncidentType"/>
                    </apex:outputPanel>
                  </apex:pageBlockSectionItem> 
            </apex:pageBlockSection>
          </apex:actionRegion>

          <apex:actionRegion >
            <apex:pageBlockSection title="Incident Information" columns="2">     
                <apex:inputField value="{!Incident_Reports__c.Date_Time_of_Incident__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Date_Time_Incident_Reported__c}" required="false"/> 
                <apex:inputField value="{!Incident_Reports__c.Pictures_Attached__c}" required="false"/>
                <apex:inputField value="{!Incident_Reports__c.Property_Owner_Notified__c}" required="false"/> 
                
                <apex:pageBlockSectionItem helpText="Check this box if Police, Fire or Ambulance were dispatched to the property.">
                    <apex:outputLabel value="Emergency Services Called"/>
                    <apex:outputPanel >
                      <apex:inputField value="{!Incident_Reports__c.Emergency_Services_Required__c}" label="Check if Police, Fire or Ambulance were dispatched to the property.">
                        <apex:actionSupport event="onclick" rerender="Incident" status="status"/>
                      </apex:inputField>
                      <apex:actionStatus startText="applying value..." id="status"/>
                    </apex:outputPanel>
                  </apex:pageBlockSectionItem>  
            </apex:pageBlockSection>
            
          </apex:actionRegion>
          
          <apex:actionRegion >
            <apex:pageBlockSection title="Responding Agencies" id="agencies" columns="2" rendered="{!Incident_Reports__c.Emergency_Services_Required__c == TRUE}">
              
              
              <apex:pageBlockSectionItem >
               
              <apex:outputLabel value="Police Department"/>
              <apex:outputPanel >
                <apex:inputField value="{!Incident_Reports__c.Police_Responded__c}">
                <apex:actionSupport event="onclick" rerender="Incident" status="status1"/>
              </apex:inputField>
              <apex:actionStatus startText="adding Police Department block..." id="status1"/>
              </apex:outputPanel>
              </apex:pageBlockSectionItem>
              
              <apex:pageBlockSectionItem >
               
              <apex:outputLabel value="Fire Department"/>
              <apex:outputPanel >
                <apex:inputField value="{!Incident_Reports__c.Fire_Department_Responded__c}">
                <apex:actionSupport event="onclick" rerender="Incident" status="status2"/>
              </apex:inputField>
              <apex:actionStatus startText="adding Fire Department block..." id="status2"/>
              </apex:outputPanel>
              </apex:pageBlockSectionItem>
              
              <apex:pageBlockSectionItem >
               
              <apex:outputLabel value="Ambulance Service"/>
              <apex:outputPanel >
                <apex:inputField value="{!Incident_Reports__c.Ambulance_Company_Responded__c}">
                <apex:actionSupport event="onclick" rerender="Incident" status="status3"/>
              </apex:inputField>
              <apex:actionStatus startText="adding Ambulance Service block..." id="status3"/>
              </apex:outputPanel>
              </apex:pageBlockSectionItem>
              
              <apex:pageBlockSectionItem >
               
              <apex:outputLabel value="Other Emergency Service"/>
              <apex:outputPanel >
                <apex:inputField value="{!Incident_Reports__c.Other_Department_Responded__c}">
                <apex:actionSupport event="onclick" rerender="Incident" status="status4"/>
              </apex:inputField>
              <apex:actionStatus startText="adding Other Emergency Service block..." id="status4"/>
              </apex:outputPanel>
              </apex:pageBlockSectionItem>
              
            </apex:pageBlockSection>
          </apex:actionRegion>
            
            <apex:pageBlockSection title="Police Department Information" id="police" columns="2" rendered="{!Incident_Reports__c.Police_Responded__c == TRUE}">
                <apex:inputField value="{!Incident_Reports__c.Police_Department_Name__c}" label="Police Department Name"/>
                <apex:inputField value="{!Incident_Reports__c.Police_Report_Number__c}" label="Police Report Number"/>
                
                                
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Fire Department Information" columns="2" rendered="{!Incident_Reports__c.Fire_Department_Responded__c == TRUE}">
                <apex:inputField value="{!Incident_Reports__c.Fire_Department_Name__c}" label="Fire Department Name"/>
                <apex:inputField value="{!Incident_Reports__c.Fire_Dept_Report_Number__c}" label="Fire Dept. Report Number"/>
                
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Ambulance Information" columns="2" rendered="{!Incident_Reports__c.Ambulance_Company_Responded__c == TRUE}">
                <apex:inputField value="{!Incident_Reports__c.Ambulance_Company_Name__c}" label="Ambulance Company Name"/>
                <apex:inputField value="{!Incident_Reports__c.Ambulance_Company_Report_Number__c}" label="Ambulance Co. Report Number"/>
                
                <apex:inputField value="{!Incident_Reports__c.Hospital_Name__c}" label="Hospital Taken To (if applicable)"/>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Other Emergency Services" columns="2" rendered="{!Incident_Reports__c.Other_Department_Responded__c == TRUE}">
                <apex:inputField value="{!Incident_Reports__c.Other_Respondant__c}" label="Other Department Name"/>
                <apex:inputField value="{!Incident_Reports__c.Other_Report_Number__c}" label="Other Department Report Number"/>
                
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Moisture / Flooding" columns="3" rendered="{!Incident_Reports__c.Type_of_Incident__c == 'Flood/Moisture'}" id="FloodingSection">
                <apex:inputTextarea value="{!Incident_Reports__c.Affected_Area__c}" label="Describe Affected Area" cols="40" rows="8"/>
                <apex:inputTextarea value="{!Incident_Reports__c.Source_Cause_of_Moisture__c}" label="Describe Cause of Moisture" cols="40" rows="8"/>
                <apex:inputTextarea value="{!Incident_Reports__c.Personal_Property_Damage__c}" label="Detail Damage to Personal Property" cols="40" rows="8"/>
                <apex:inputField value="{!Incident_Reports__c.Date_Notification_Letter_Sent__c}" label="Date Notification Letter Sent"/>
                <apex:inputField value="{!Incident_Reports__c.Date_Option_Letter_Given__c}" label="Date Option Letter Given"/>
                <apex:inputField value="{!Incident_Reports__c.Date_Option_Letter_Received__c}" label="Date Option Letter Received"/>
                <apex:inputField value="{!Incident_Reports__c.Follow_Up_Call_Completed__c}" label="Date Follow-up Call Completed"/>
                <apex:inputField value="{!Incident_Reports__c.Follow_Up_Call_Associate__c}" label="Name of Associate Conducting Call"/>
                <apex:inputTextarea value="{!Incident_Reports__c.Result_of_Conversation__c}" label="Result of Conversation" cols="40" rows="8"/>
            </apex:pageBlockSection>
           
        </apex:pageBlock>
           
        <apex:pageBlock title="Add Attachments">
          	<apex:pageBlockSection title="Attachment 1" >
                <apex:inputFile value="{!attachment1.body}" fileName="{!attachment1.name}"/>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Attachment 2" >
                <apex:inputFile value="{!attachment2.body}" fileName="{!attachment2.name}"/>
            </apex:pageBlockSection>
            
            <apex:pageBlockSection title="Attachment 3" >
                <apex:inputFile value="{!attachment3.body}" fileName="{!attachment3.name}"/>
            </apex:pageBlockSection>
        
        </apex:pageBlock>
    </apex:form>    
</apex:page>

Again, any help is greatly appreciated.

Thanks,

Matt
I'm using AggregateResult to display 2 values, first is a sum of a custom field Hours_Used__c which is in a custom object Holiday__c. Second is a sum of a custom field Hours_Available__c which is on the User object.

I am able to show these results separately on my visualforce page shown here:

vfpage

My requirement is to be able to display Hours_Available__c - Hours_Used__c to leave me with a column that shows the Staff Member Name and the total hours that are left.

For example using the screenshot above I would need a pageblocktable that shows:

Staff Member   | Hours Left
Adam west      | 252
Duke Young     | 225
Jim Taylor       | 198

Controller:
public class HolidayManagementController {
    
    Public List<Holiday__c> HolidayList {get;set;}
    Public List<AggregateResult> HoursUsedList;
    Public List<AggregateResult> AllowanceTotalList;
 
    String cname {get;set;}
    
    Public HolidayManagementcontroller(){
        cname		= UserInfo.getUserName();
        user cu	  	= [SELECT Name FROM User WHERE username =:cname];
        
        HolidayList 		= [SELECT Hours_Used__c, Staff_Member__c, Staff__r.Name, Manager_Name__c
                               FROM Holiday__c
                               WHERE Manager_Name__c =:cu.Name
                               ORDER BY Staff__r.Name];
       
        HoursUsedList 		= [SELECT SUM(Hours_Used__c) hours, Staff__r.Name staff
                               FROM Holiday__c
                               WHERE Manager_Name__c =:cu.Name
                               GROUP BY Staff__r.Name
                               ORDER BY Staff__r.Name asc];
        
        AllowanceTotalList 	= [SELECT SUM(Hours_Available__c) allowance, Name
                              FROM User
                              WHERE Manager__c =:cu.Name
                              GROUP BY Name
                              ORDER BY Name asc];
        
    }
    
    public list<AggregateResult> HoursList {
 	get { return HoursUsedList;}
 	}
    
    public list<AggregateResult> AllowanceList {
 	get { return AllowanceTotalList;}
 	}
}

VF Page:
<apex:page controller="HolidayManagementController" sidebar="false">
    <apex:form>
        <apex:pageBlock>
			<apex:pageBlockTable value="{!HolidayList}" var="hlist">

                <apex:column headerValue="Staff Member">
                <apex:outputField value="{!hlist.Staff__r.Name}"/>
                </apex:column>

                <apex:column headerValue="Manager">
                <apex:outputField value="{!hlist.Manager_Name__c}"/>
                </apex:column>
  
                <apex:column headerValue="Hours Used">
                <apex:outputField value="{!hlist.Hours_Used__c}"/>
                </apex:column>
                
            </apex:pageBlockTable>            
        </apex:pageBlock>
        
        <apex:pageBlock>
        <apex:pageBlockTable value="{!HoursList}" var="h">
        	  
           <apex:column >
            <apex:facet name="header">Staff Member</apex:facet>
            {!h['staff']}</apex:column>
            
            <apex:column >
            <apex:facet name="header">Hours Used</apex:facet>
            {!h['hours']}</apex:column>
            

            
        </apex:pageBlockTable>
            
        <apex:pageBlockTable value="{!AllowanceList}" var="a">
        	  
           <apex:column >
            <apex:facet name="header">Staff Member</apex:facet>
            {!a['Name']}</apex:column>
            
            <apex:column >
            <apex:facet name="header">Hours Available</apex:facet>
            {!a['allowance']}</apex:column>
            

            
        </apex:pageBlockTable>    
            
        </apex:pageBlock>
    </apex:form>
</apex:page>

Any help would be greatly appreciated. I'm pretty new to programming in general so i'm open to suggesstions if i'm going about this the wrong way. 

Thanks
L
  • January 25, 2015
  • Like
  • 1
Hello,
I have a number field on my account object that if greater than 1, I want it to change the account type to "Account Active"
Account Active is currently an option under the picklist field = Type.

What I am currently doing manually is running a report that shows customers with number of subscriptions. If I see one that has 1 or more subscription I have to go and change the account type to "Active Customer" currently it just stays as "Active Prospect" which is the default field.
Is this possible to automate with a trigger?
thank you-
  • November 06, 2014
  • Like
  • 1