-
ChatterFeed
-
1Best Answers
-
1Likes Received
-
0Likes Given
-
10Questions
-
7Replies
Can I query Partner object from Visualforce page without ViewAllData permission?
I have a Visualforce page that is showing Partners progress towards their quarterly targets
One of the queries is failing for users that do not have the ViewAllData permisson:
Select
FISCAL_QUARTER(p.Opportunity.CloseDate) Qtr, SUM(p.Opportunity.FY_Total__c) Act
From Partner p
WHERE p.AccountTo.Name='XXXXXX'
AND p.IsPrimary=true
AND p.Opportunity.StageName IN ('04 - Needs Confirmed','05 - Prospect','06 - Meeting Objections','07 - Proposal','08 - Verbal Commitment','09 - Written Commitment','10 - PO in Process','11 - PO Received','12 - PO Received in Finance','13 - Parked')
AND p.Opportunity.CloseDate=THIS_FISCAL_YEAR
AND p.Opportunity.Exclude_from_pipeline_reports__c=false
GROUP BY FISCAL_QUARTER(p.Opportunity.CloseDate)
ORDER BY FISCAL_QUARTER(p.Opportunity.CloseDate)
It seems to be the case that the user requires the ViewAllData permission in order to query this data, is that correct?
If that is the case, is there a way round this as otherwise all the sales users will be able to see all the report folders, which is something we want to avoid.
Regards,
David
- DaveKemp
- June 30, 2015
- Like
- 0
- Continue reading or reply
Issue with Cases and Milestones
I have the following code that is called by the Before Insert Trigger on a Case, this should update the Business Hours depending on the country that the parent account is in before a new case is added to the database:
public static void setBusinessHoursForJapanPreInsert(List<Case> newCases) { List<Case> newCasesToUpsert = new List<Case>(); BusinessHours bh; try { //Get the Id for Japanese Business Hours bh = [SELECT Id, Name FROM BusinessHours WHERE Name='Japan' AND IsActive=true LIMIT 1]; Set<id>parentIds = new Set<id>(); for(Case a:newCases){ parentIds.add(a.AccountId); } Map<id,Account> acc = new Map<id,Account>([SELECT id,Country__c FROM Account WHERE id IN :parentIds]); for(case a:newCases){ System.debug('Business hours: '+bh+' Account Country:'+acc.get(a.Accountid).Country__c); if(acc.get(a.Accountid) != null && acc.get(a.Accountid).Country__c == 'Japan'){ System.debug('About to update case with Japanese Business Hours'); a.BusinessHoursId=bh.Id; System.debug('Business Hours Updated: '+a.BusinessHoursId); } } System.debug('Cases updated prior to saving: '+newCases); }and indeed it appears to do just that.
However, the Milestones created are always associated with the Default Business Hours even if the parent account is in Japan.
I thought the Before Insert Trigger would update the Business Hours before Inserting the Case into the system and therefore the Milestones would be created with the Japanese business hours set where appropriate.
Am i missing something here?
Thanks,
David
- DaveKemp
- May 08, 2015
- Like
- 0
- Continue reading or reply
Can I access parent Account info from a Case before Insert trigger?
I have a trigger that updates a Case's BusinessHours field based on the Country of the Account, if I update the Business Hours field in an After Insert trigger, then the field is updated but the Milestones (which are created on Insert) refer to the default Business Hours, not unreasonably!
Is it possible to get the country field from the parent Account in a Before Insert Trigger, if so, how would I do that?
Many thanks,
David
- DaveKemp
- May 05, 2015
- Like
- 0
- Continue reading or reply
Batch copying solutions to new cases
I have a request to have a trigger create a new case if a user adds a comment to a closed case via the portal or email 2 case. As part of this they would like any existing solutions added to the new case(s).
My question is what is the best way to bulkify this behaviour? OK, so in this scenario, there should only be one update at a time, but as we know we should bulkify our trigger code.
I'm creating a list of new cases and then inserting that list, the problem comes with then trying to associate the solutions from the old cases to the new cases, is there a "standard" way of doing this?
Thanks,
David
- DaveKemp
- August 28, 2014
- Like
- 0
- Continue reading or reply
sobject list items not updating controller when selected
I have a list of Opportunities in a visualforce page populated from a SOQL query in a wrapper class
public List<SelectOption> getnewOpportunityList(){
List<SelectOption> newOpportunityList = new List<SelectOption>();
newOpportunityList.add(new SelectOption( ' ' ,'---Select---'));
newOpportunities = [Select o.Id, o.Name From Opportunity o WHERE o.AccountId = :this.parentAccount.Id ORDER BY o.Name];
for(Opportunity temp : newOpportunities)
{
newOpportunityList.add(new SelectOption(temp.Id, temp.Name));
}
System.debug('Selected Opportunity:'+newOpportunity);
return newOpportunityList;
}
and this is the page that displays the list ok:
<apex:column >
<apex:facet name="header">New Opportunity</apex:facet>
<apex:selectList size="1" title="New Opportunity" value="{!o.newOpportunity}">
<apex:actionSupport event="onchange" rerender="displayView2"/>
<apex:selectOptions value="{!o.newOpportunityList}"/>
</apex:selectList>
</apex:column>
however, when I select an opportunity from the list, it's not updating the newOpportunity field, I'm guessing I'm either missing
something or it's not possible to use SObjects in a list like this using the SelectOption?
Any help gratefully appreciated
David
- DaveKemp
- March 17, 2014
- Like
- 1
- Continue reading or reply
two way ssl with iis - examples?
Hi,
I'm looking to integerate SF with a webservice we have onsite running on iis and would like to enable two way ssl for it.
We've added the certificate onto our server for the SF connection, but I'm having difficulty following the tomcat example that SF provide, has anyone done this or have a step-by-step guide for doing this on IIS?
Really appreciate any help,
Thanks,
David
- DaveKemp
- February 10, 2014
- Like
- 0
- Continue reading or reply
How to release custom fields with Eclipse
Hi,
I'm testing a release by using Eclipse to Deploy to a Sandbox from another Sandbox.
However, when I go through the process, I never see custom fields in the selectable list for deployment even though they are selected in both projects, obviously if I try to release anything else that depends on the new fields, it complains that the fields don't exist.
What am I missing?
Thanks,
David
- DaveKemp
- December 02, 2013
- Like
- 0
- Continue reading or reply
Can I process xml results doc from webservice callout?
Hi,
I've imported a wsdl and generated the classes into apex.
I can call the web service ok, but the webservice returns an xml doc with content dependant on what xml doc you send it in the first place.
Is there a way I can generically process the response rather than it expecting the results to map directly to salesforce classes?
Thanks,
David
- DaveKemp
- October 22, 2013
- Like
- 0
- Continue reading or reply
Strange ordering on contractlineitem query
Hi,
I've got some code in a trigger for updating a service contract (checkboxes) based on the types of contractlineitems it has associated with it and whether they are Active, Inactive or Expired.
When I sort the SOQL query by the contractlineitem status field I get the following results (sorted by Status)
Service Contract 1
Inactive
Inactive
Active
Service Contract 2
Active
Active
Expired
I'm not understanding how, using the same query and ordering, Active can come before Expired, but after Inactive?
Any help appreciated as this is driving me nuts!
Dave
- DaveKemp
- October 18, 2013
- Like
- 0
- Continue reading or reply
How to instantiate an object from it's ID (string) without using a SOQL query
Hi,
Is there a way to retrieve an object given its ID without having to do a SOQL query, I ask because I'm need to reduce the number of SOQL queries in my code that creates Service Contracts, ContractLineItems and Assets when converting them from Opportunities?
Thanks,
David
- DaveKemp
- September 27, 2013
- Like
- 0
- Continue reading or reply
sobject list items not updating controller when selected
I have a list of Opportunities in a visualforce page populated from a SOQL query in a wrapper class
public List<SelectOption> getnewOpportunityList(){
List<SelectOption> newOpportunityList = new List<SelectOption>();
newOpportunityList.add(new SelectOption( ' ' ,'---Select---'));
newOpportunities = [Select o.Id, o.Name From Opportunity o WHERE o.AccountId = :this.parentAccount.Id ORDER BY o.Name];
for(Opportunity temp : newOpportunities)
{
newOpportunityList.add(new SelectOption(temp.Id, temp.Name));
}
System.debug('Selected Opportunity:'+newOpportunity);
return newOpportunityList;
}
and this is the page that displays the list ok:
<apex:column >
<apex:facet name="header">New Opportunity</apex:facet>
<apex:selectList size="1" title="New Opportunity" value="{!o.newOpportunity}">
<apex:actionSupport event="onchange" rerender="displayView2"/>
<apex:selectOptions value="{!o.newOpportunityList}"/>
</apex:selectList>
</apex:column>
however, when I select an opportunity from the list, it's not updating the newOpportunity field, I'm guessing I'm either missing
something or it's not possible to use SObjects in a list like this using the SelectOption?
Any help gratefully appreciated
David
- DaveKemp
- March 17, 2014
- Like
- 1
- Continue reading or reply
Can I query Partner object from Visualforce page without ViewAllData permission?
I have a Visualforce page that is showing Partners progress towards their quarterly targets
One of the queries is failing for users that do not have the ViewAllData permisson:
Select
FISCAL_QUARTER(p.Opportunity.CloseDate) Qtr, SUM(p.Opportunity.FY_Total__c) Act
From Partner p
WHERE p.AccountTo.Name='XXXXXX'
AND p.IsPrimary=true
AND p.Opportunity.StageName IN ('04 - Needs Confirmed','05 - Prospect','06 - Meeting Objections','07 - Proposal','08 - Verbal Commitment','09 - Written Commitment','10 - PO in Process','11 - PO Received','12 - PO Received in Finance','13 - Parked')
AND p.Opportunity.CloseDate=THIS_FISCAL_YEAR
AND p.Opportunity.Exclude_from_pipeline_reports__c=false
GROUP BY FISCAL_QUARTER(p.Opportunity.CloseDate)
ORDER BY FISCAL_QUARTER(p.Opportunity.CloseDate)
It seems to be the case that the user requires the ViewAllData permission in order to query this data, is that correct?
If that is the case, is there a way round this as otherwise all the sales users will be able to see all the report folders, which is something we want to avoid.
Regards,
David
- DaveKemp
- June 30, 2015
- Like
- 0
- Continue reading or reply
Issue with Cases and Milestones
I have the following code that is called by the Before Insert Trigger on a Case, this should update the Business Hours depending on the country that the parent account is in before a new case is added to the database:
public static void setBusinessHoursForJapanPreInsert(List<Case> newCases) { List<Case> newCasesToUpsert = new List<Case>(); BusinessHours bh; try { //Get the Id for Japanese Business Hours bh = [SELECT Id, Name FROM BusinessHours WHERE Name='Japan' AND IsActive=true LIMIT 1]; Set<id>parentIds = new Set<id>(); for(Case a:newCases){ parentIds.add(a.AccountId); } Map<id,Account> acc = new Map<id,Account>([SELECT id,Country__c FROM Account WHERE id IN :parentIds]); for(case a:newCases){ System.debug('Business hours: '+bh+' Account Country:'+acc.get(a.Accountid).Country__c); if(acc.get(a.Accountid) != null && acc.get(a.Accountid).Country__c == 'Japan'){ System.debug('About to update case with Japanese Business Hours'); a.BusinessHoursId=bh.Id; System.debug('Business Hours Updated: '+a.BusinessHoursId); } } System.debug('Cases updated prior to saving: '+newCases); }and indeed it appears to do just that.
However, the Milestones created are always associated with the Default Business Hours even if the parent account is in Japan.
I thought the Before Insert Trigger would update the Business Hours before Inserting the Case into the system and therefore the Milestones would be created with the Japanese business hours set where appropriate.
Am i missing something here?
Thanks,
David
- DaveKemp
- May 08, 2015
- Like
- 0
- Continue reading or reply
Can I access parent Account info from a Case before Insert trigger?
I have a trigger that updates a Case's BusinessHours field based on the Country of the Account, if I update the Business Hours field in an After Insert trigger, then the field is updated but the Milestones (which are created on Insert) refer to the default Business Hours, not unreasonably!
Is it possible to get the country field from the parent Account in a Before Insert Trigger, if so, how would I do that?
Many thanks,
David
- DaveKemp
- May 05, 2015
- Like
- 0
- Continue reading or reply
How to release custom fields with Eclipse
Hi,
I'm testing a release by using Eclipse to Deploy to a Sandbox from another Sandbox.
However, when I go through the process, I never see custom fields in the selectable list for deployment even though they are selected in both projects, obviously if I try to release anything else that depends on the new fields, it complains that the fields don't exist.
What am I missing?
Thanks,
David
- DaveKemp
- December 02, 2013
- Like
- 0
- Continue reading or reply
Can I process xml results doc from webservice callout?
Hi,
I've imported a wsdl and generated the classes into apex.
I can call the web service ok, but the webservice returns an xml doc with content dependant on what xml doc you send it in the first place.
Is there a way I can generically process the response rather than it expecting the results to map directly to salesforce classes?
Thanks,
David
- DaveKemp
- October 22, 2013
- Like
- 0
- Continue reading or reply
How to instantiate an object from it's ID (string) without using a SOQL query
Hi,
Is there a way to retrieve an object given its ID without having to do a SOQL query, I ask because I'm need to reduce the number of SOQL queries in my code that creates Service Contracts, ContractLineItems and Assets when converting them from Opportunities?
Thanks,
David
- DaveKemp
- September 27, 2013
- Like
- 0
- Continue reading or reply