• textual
  • NEWBIE
  • 75 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 115
    Questions
  • 101
    Replies
I'im hitting an api that returns a variable amount of data. In our initial testing, we were getting around 5-6k records back and I would handle them all with a single dml upsert. Now that we are closer to production, some of the batches are coming back with more than 10k records, which means dml failure. Since we already have code that runs for all records, is there a simple fix to look for the number of records and possibly loop until all records are updated? Or do I have to refactor the whole thing to run as a batches?
I'm trying to mimic a related list with a lightning component that has a data table in a card with a new button. When the new button is clicked, I'd like to launch a modal with a lightning:recordForm that has the fields used in the page layout for easy maintenance. This all works well and is able to save, but if the user clicks cancel, nothing happens. It looks like this is the expected behavior of the component, can't capture the cancel to do anything, cancel doesn't do anything on its own. Is there another approach I should take? The feature I really like about the component is that I give it a record id and the page layout the administrators maintain is used, so I don't have to programmatically try to recreate it. but if the cancel button doesn't work, the form looks like it doesn't work properly. whats the solution here?
Hi, I'm trying to build out a process in lightning allowing a user to add tasks to a project but I want the list of available task types to vary based on the stage of the project. I was planning on using Task record types to control the list of task types and then have the form pull the task record type info as a picklist using a lightning form/component. However many issues arose while trying to do this. Here is my desired workflow:
  • from a project page, have a single button that launches a form (quick action to lightning component)
  • using a field from the project (status), show different tasks types available to chose from (task record type fields)
  • save task (forceData)
It seems as though apex cannot get the recordtype picklist values, so I was using the metadata api. And it seems controller apex launched from lightning requires a named credential and auth provider which I havent gotten to work. And the metadata api isnt able to pull from Task anayway. So I am at a loss on how to achieve the desired result.
back in the days when i used asp, i used to have one page that acted as a template and just used include files for the main content. i would end up with urls like [site].com/main?page=something. now that im steeped in salesforce develoment, i still havent found a way to really buils sites efficiently. theres a controller component for navigation; whos logged in, what pages would they have access to. the main section would have a controller; getting data, checking permissions, etc. shared user and data assets, shared stylesheet assets. and components and include seems to be a little lacking in really being flexible and useful. or am i missing something? whats a good model for building out custom sites using the provided framework, allowing for building out navigation with user info, and building out multiple pages that use that navigation and stylesheets.

thanks
im building a page to upload a csv full of extrenal ids in order to change a status on an object. if data loader tools would recognize the external id, i wouldnt have to build this, but this is to bypass having to download object data and then using vlookup/index to match on salesforce id. so im intending this page to upload a csv, create a query with a large set of external ids and pass to soql like
SELECT Id, Name, Status FROM Object WHERE External_Id IN :external_id_set
Is there a limit to how many elements can be in this set? or a limit to how many characters I can pass through to it? I could build this set then break it up into chunks of 100 or so, just wanted to check before i get too far down this road
 
my sandbox developer console recently stopped working, and only for me. as system adminstrator, i can login as others and use the console. so it must be some sort of stored session thing. i saw a post (i cant find it) about opening Chrome > Developer Tools > Network and issuing a query and then using workbench to clear something out, but im not that familliar with Developer Tools send a query. Right now the error im getting is 'b is not a function, main.js:392'  any help would be much appreciated
my data team has setup a few connected apps and use a single user sign on to talk to these apps. an important person from tehir team recently left and now they are asking for individual signons for wach app. so four logins, one for each app. my question is whether or not they need to use salesforce user logins to access these apps. i dont want to use 4 licenses for these apps, as now they are only using 1 sign on. can these apps, which are created with consumer key and secret, be accessed directly with those credentials, or do they require an actual salesforce user account to gain access to the data? id rather not create 4 user accounts as we dont really have a lot of user licenses for this.

thank you in advance
one of our external systems wants to pull activity history using the rest api and is getting an error that indicates they need to be a system admin in order to get a Contacts and Accounts Activity History
 
There is an implementation restriction on ActivityHistories. When you query this relationship, security evaluation is implemented for users who don't have administrator permissions, and only a single parent record may be evaluated. (Faraday::ClientError)

for the time being i made him a system administrator, but i dont like that very much. any ideas on how I can walk back his permissions yet still grant him access to activity history using the rest api?
ive got an aggregate query where i want the ID of the Opportunity with the greatest Start Date for a particular Account. However, its not just getting the MAX(Start Date), its also beinging back the MAX ID, which isnt what I want, I want the ID of the Opportunity with the MAX DATE. But SOQL wants me to group or Aggregate the ID, which I dont want.
 
[SELECT max(start_date__c) maxDate, AccountId, MAX(Id) useId
                                                FROM Opportunity 
                                                WHERE StageName = 'Signed' 
                                                    AND AccountId in :setIds 
                                                GROUP BY AccountId]

The only piece of information I really need is the ID of the record with the max date, but thats not happening at the moment
so workbench is easy enough to hit your custom rest endpoints, but having some issues getting postman (3.0) to hit my endpoints. ive got it logging in and returning an access token, then store it in a collection. im copying the access token and adding it as a param named authorization as OAuth [access token], but im getting errorcode: url not reset, Destination URL not reset. The URL returned from login must be set.

any one get this on postman, got any advice on how to get this going?
  • September 24, 2015
  • Like
  • 0
I'd like to move attachments from one unsecure object to a new custom more secure object and was hoping to make this code a little dynamic by providing a list of objects I want to pull attachments from, like 
List<String> {'Opportunity', 'Contract', 'Thing__c'};

I'm looking to get the schema info for these Objects and then query the Attachments where ParentId contains the first three of the Object Id's, lke how all Accounts start with '001'
  1. Is this approach possible, to query Attachments using ParentId like '001'% ?
  2. How do I get the Id for objects, like 001 for Account?
i wanted to post a note to a chatter group for certain events and while the code works just fine on its own, when its coupled with all the exisiting tests THEY ALL FAIL because seeAllData is required to access chatter data?? so i need to edit EVERY SINGLE CLASS to mark see all data, which is not a best practice in my opinion because chatter groups cant see that a group exists until it tries to write a chatter group??


ridiculous
i lke how salesforce announces their upgrade schedule, but it would be pretty awesome if there was a shareble calender (google calendar in particular) that i could add and get updates on these key dates
i want to email our internal users (200+) with a link to a custom object, but single email doesnt send to enough people and mass email cant set an object id to a custom object. is there a way to bulk email but set the html body, or something..?? or do i have to batch execute the single email process?

i have tried both sending single email; which works for 10 emails, and ive tried mass email but the custom object id doesnt come through.
were about to launch an hr initative and they want to lock down access to all records except for the employee thats listed on the record. i initially thought that the Sharing Settings would allow for a rule where the User is the User stored in one of the fields, but that wasnt an option. So then i thought that i could make the object Private and just give Employees access via a VF Page (class without sharing) and control the visibility using code, but when the obkect is private, Users cannot view the data even if their profile has them having access. So how do i lock this down? I cant get them view all cause they can view the record natively. I was really hoping Private Sharing Settings and a VF Page without sharing and custom logic to check user ids against stored fields wouldve been best bet...
i know emails are touchy with salesforce but were looking to email all of our users using a custom object and I want to be sure salesforce is cool with that. If not, do I have to batch out sending the emails? Thank you in advance
looks like if i set a fields value to null, then query the table for those records, they dont get returned. because a decimal thats null isnt actually null??
 
Account bad_data = [SELECT Id, Name, Latitude__c, Longitude__c, Location__latitude__s, Location__longitude__s 
                    	FROM Account 
                    	WHERE Id IN ('0018000000mZrLUAA0')][0];
system.debug(bad_data);
system.debug('bad_data.Latitude__c = null ? ' + bad_data.Latitude__c == null);
system.debug('bad_data.Longitude__c = null ? ' + bad_data.Longitude__c == null);
system.debug('bad_data.Location__latitude__s = null ? ' + bad_data.Location__latitude__s == null);
system.debug('bad_data.Location__longitude__s = null ? ' + bad_data.Location__longitude__s == null);


system.debug('bad_data.Latitude__c ? ' + String.valueOf(bad_data.Latitude__c));
system.debug('bad_data.Longitude__c ? ' + String.valueOf(bad_data.Longitude__c));
system.debug('bad_data.Location__latitude__s ? ' + String.valueOf(bad_data.Location__latitude__s));
system.debug('bad_data.Location__longitude__s ? ' + String.valueOf(bad_data.Location__longitude__s));

// get records
// are they null: nope
// well then what are they? theyre null

smh
we're using domains so maybe that the issue but when i go to put in /apex/page_name it goes to a login screen with a different domain than mine. not only for the page i just made and want to view, but for all vf pages (well i checked a couple)

sample url from my org: https://company--dan.cs12.my.salesforce.com/003P000000G2zaB

i should just be able to put apex pagename at the end of the url like this::

https://company--dan.cs12.my.salesforce.com/apex/page_name

but instead it redirects to another users org to login
i tried a few variations but havent gotten it right yet

 
i need to process contacts and their trainings and need to do this via batch as its around 75k records when joined. this is a one time job so i was hoping to write a class and then call it via execute anonymous. in my testing on very small numbers in my sandbox, i only get the batch execution to run once, while im deliberately trying to get it to run more than once. for example, i have 25 records so i want to run in batches of 10 to run 3 times; 10, 10, 5. but it looks like it only runs once for 10 records. secondly, it looks like the query does not re-run on subsequent runs (if i even am running more than once). Meaning if the first 8 records are for one contact and the next 8 are for another, but i only run in a size of 10, the second contacts records will be split ovef the first run and second run. Im using a flag to set whether these records are 'counted' towards a certification but im guessing the records would be split rather than requery for records not flagged as being used. heres some code for partial example of how the basics are set up
 
global class Batch_TrainingLegacyBackfill implements Database.Batchable<sObject> {
	
	List<training_c> ContactTrainings;
	String query;
	
	global Batch_TrainingLegacyBackfill() {
		query = 'SELECT Id, Name, Certification__c, Chapter_Name__c, Course_Name__c, Complete_Date__c, Legacy_Processed__c, '  
					+ 'Contact__r.Id, Contact__r.Name, Contact__r.Email, Contact__r.Last_Training_Date__c , Contact__r.Number_of_Trainings__c ' 
					+ 'FROM training__c WHERE Legacy_Processed__c = null ORDER BY Contact__r.Id, Course_Name__c, Chapter_Name__c LIMIT 10';
	}
	
	global Database.QueryLocator start(Database.BatchableContext BC) {
		system.debug('query = ' + query);
		return Database.getQueryLocator(query);
	}

   	global void execute(Database.BatchableContext BC, List<sObject> scope) {
   		system.debug('scope = ' + scope);
		// grab records
		ContactTrainings = (List<training__c>)scope;

		for(training__c c : ContactTrainings){ // more logic than id care to admit...}

	}
	
	global void finish(Database.BatchableContext BC) {
		// email to verify
		
	}
}
//from execute anonymous

Batch_TrainingLegacyBackfill bbf = new Batch_TrainingLegacyBackfill();
Database.ExecuteBatch(bbf);


to recap:
1) if i have 5 contacts with a total of 25 records and have my limit set to 10, should this run 3 times?
2) can i get this ti run multiple times from execute anonymous
3) if it runs multilpe times, would it re-query everytime to bring back overlapping contact trainings?
Im about 90% certain, but wanted to verify, i can create an endpoint on salesforce, right? so rather than making our team use the rest api when updating multiple objects, they could send one big block of data to a single web service and i can parse and update on the salesforce side. are there any good examples of this?
looks like if i set a fields value to null, then query the table for those records, they dont get returned. because a decimal thats null isnt actually null??
 
Account bad_data = [SELECT Id, Name, Latitude__c, Longitude__c, Location__latitude__s, Location__longitude__s 
                    	FROM Account 
                    	WHERE Id IN ('0018000000mZrLUAA0')][0];
system.debug(bad_data);
system.debug('bad_data.Latitude__c = null ? ' + bad_data.Latitude__c == null);
system.debug('bad_data.Longitude__c = null ? ' + bad_data.Longitude__c == null);
system.debug('bad_data.Location__latitude__s = null ? ' + bad_data.Location__latitude__s == null);
system.debug('bad_data.Location__longitude__s = null ? ' + bad_data.Location__longitude__s == null);


system.debug('bad_data.Latitude__c ? ' + String.valueOf(bad_data.Latitude__c));
system.debug('bad_data.Longitude__c ? ' + String.valueOf(bad_data.Longitude__c));
system.debug('bad_data.Location__latitude__s ? ' + String.valueOf(bad_data.Location__latitude__s));
system.debug('bad_data.Location__longitude__s ? ' + String.valueOf(bad_data.Location__longitude__s));

// get records
// are they null: nope
// well then what are they? theyre null

smh
im having some interface issues where fields things get confused after performing an apex action
i have a form of input text fields that im using from a fieldset and set some classes based on the values
if theres data in the field, make the field disabled so that it cant be edited, but if its blank, dont add a class name

<apex:inputText  styleClass="formInput {!IF( (record[f.fieldPath] == null || record[f.fieldPath] == ''), '', 'disabled')}" value="{!record[f.fieldPath]}" />

this works for the initial load, but if i hit save and perform some validation checks, for some reason all fields become disabled
im looking into resolving this client side because i really want to use this technique of fields sets
but if i cant keep the form from reverting, ill have to ditch this and hand code every form

id consider using jquery to re-check the form once it returns from apex, but im not sure if theres an event or anything i can capture

i seem to be having some issues styling the native apex page blocks and sections. its nice that you can call out a field and it will automatically apply a label, so id like to use output fields and output text. but im trying to get the page block to be 100% width with two columns and its sizing down to minimum field width. Sure I can break it up and type out html and style each thing individually, but isnt there a way to do this with a panel grid or page block or something??

Hi, I'm trying to build out a process in lightning allowing a user to add tasks to a project but I want the list of available task types to vary based on the stage of the project. I was planning on using Task record types to control the list of task types and then have the form pull the task record type info as a picklist using a lightning form/component. However many issues arose while trying to do this. Here is my desired workflow:
  • from a project page, have a single button that launches a form (quick action to lightning component)
  • using a field from the project (status), show different tasks types available to chose from (task record type fields)
  • save task (forceData)
It seems as though apex cannot get the recordtype picklist values, so I was using the metadata api. And it seems controller apex launched from lightning requires a named credential and auth provider which I havent gotten to work. And the metadata api isnt able to pull from Task anayway. So I am at a loss on how to achieve the desired result.
In summary, we are trying to rollout a custom VF page to a subset of our users that does not correlate 1:1 with profiles. 

Is it possible to override the standard New Contact button with a dispatcher VF page that redirects based on a permission set being present?
Ex:
If permission set is present, the user should be redirected to a custom new contact entry VF page.
If permission set is not present on user, the user should be redirected to the standard new contact screen.

We have tried a button override to the VF page, but our challenge remained that we cannot limit the ability to add contact records for users that are not given access to the custom new contact entry VF page. 
 
I am creating 3 visualforce pages for creating new opportunities (I have 3 separate record types).  I found the following apex class that determines what record type was selected and goes to the appropiate VF page (only testing with 2 of them right now):
public class NewOppDispatcher {
public NewOppDispatcher(ApexPages.StandardController sc) {
}

public PageReference redirectToPage() {
    String selectedRecordType = ApexPages.currentPage().getParameters().get('RecordType');
    if (selectedRecordType == '01280000000GGZI')
        return Page.Dev_Opps.setRedirect(true);
    else
        return Page.Create_Management_Opp.setRedirect(true);
    }
}
I'm using this class along with this "traffic controller" vf page:
<apex:page standardController="Opportunity" extensions="NewOppDispatcher" action="{!redirectToPage}">
</apex:page>

The problem I am running into is that the Opportunity Record type that is selected is not being reflected on the Visualforce page, rather the VF page is using whatever my default opportunity record type is.  Does anyone have any idea how to push the record type down to the page?

Thanks,

Matt

 
my data team has setup a few connected apps and use a single user sign on to talk to these apps. an important person from tehir team recently left and now they are asking for individual signons for wach app. so four logins, one for each app. my question is whether or not they need to use salesforce user logins to access these apps. i dont want to use 4 licenses for these apps, as now they are only using 1 sign on. can these apps, which are created with consumer key and secret, be accessed directly with those credentials, or do they require an actual salesforce user account to gain access to the data? id rather not create 4 user accounts as we dont really have a lot of user licenses for this.

thank you in advance
Hey Guys,

Please helpe me. I am stuck, non of the users can see report. They can see the report folder but when they try to access report they get insufficient privilage error. Infact they can't even access unifed folder reports. Which is visible to all users. I am not sure why this is happening. I gave all these permissions but still they cant see: 

1) Manage Reports in Public Folders
2) Manage Dashboards in Public Folders
3) View Reports in Public Folders
4) View Dashboards in Public Folders
5)Create Report Folders
6) Create Dashboard Folders
7) Edit My Reports
8) Edit My Dashboards

Please let me know if I am missing something. Thanks.
 
  • February 01, 2016
  • Like
  • 0
one of our external systems wants to pull activity history using the rest api and is getting an error that indicates they need to be a system admin in order to get a Contacts and Accounts Activity History
 
There is an implementation restriction on ActivityHistories. When you query this relationship, security evaluation is implemented for users who don't have administrator permissions, and only a single parent record may be evaluated. (Faraday::ClientError)

for the time being i made him a system administrator, but i dont like that very much. any ideas on how I can walk back his permissions yet still grant him access to activity history using the rest api?
so workbench is easy enough to hit your custom rest endpoints, but having some issues getting postman (3.0) to hit my endpoints. ive got it logging in and returning an access token, then store it in a collection. im copying the access token and adding it as a param named authorization as OAuth [access token], but im getting errorcode: url not reset, Destination URL not reset. The URL returned from login must be set.

any one get this on postman, got any advice on how to get this going?
  • September 24, 2015
  • Like
  • 0
i wanted to post a note to a chatter group for certain events and while the code works just fine on its own, when its coupled with all the exisiting tests THEY ALL FAIL because seeAllData is required to access chatter data?? so i need to edit EVERY SINGLE CLASS to mark see all data, which is not a best practice in my opinion because chatter groups cant see that a group exists until it tries to write a chatter group??


ridiculous
i know emails are touchy with salesforce but were looking to email all of our users using a custom object and I want to be sure salesforce is cool with that. If not, do I have to batch out sending the emails? Thank you in advance
Hi,  I receive the following error in a test class but have not been able to repeat them in non test running scenarios.

"System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, The record couldn’t be saved because it failed to trigger a flow. 
A flow trigger failed to execute the flow with version ID 301O00000008hM6. 
Contact your administrator for help.: []"

Does anyone know if there could be an issue running flows in test class contexts but not otherwise?

Thanks.
looks like if i set a fields value to null, then query the table for those records, they dont get returned. because a decimal thats null isnt actually null??
 
Account bad_data = [SELECT Id, Name, Latitude__c, Longitude__c, Location__latitude__s, Location__longitude__s 
                    	FROM Account 
                    	WHERE Id IN ('0018000000mZrLUAA0')][0];
system.debug(bad_data);
system.debug('bad_data.Latitude__c = null ? ' + bad_data.Latitude__c == null);
system.debug('bad_data.Longitude__c = null ? ' + bad_data.Longitude__c == null);
system.debug('bad_data.Location__latitude__s = null ? ' + bad_data.Location__latitude__s == null);
system.debug('bad_data.Location__longitude__s = null ? ' + bad_data.Location__longitude__s == null);


system.debug('bad_data.Latitude__c ? ' + String.valueOf(bad_data.Latitude__c));
system.debug('bad_data.Longitude__c ? ' + String.valueOf(bad_data.Longitude__c));
system.debug('bad_data.Location__latitude__s ? ' + String.valueOf(bad_data.Location__latitude__s));
system.debug('bad_data.Location__longitude__s ? ' + String.valueOf(bad_data.Location__longitude__s));

// get records
// are they null: nope
// well then what are they? theyre null

smh
we're using domains so maybe that the issue but when i go to put in /apex/page_name it goes to a login screen with a different domain than mine. not only for the page i just made and want to view, but for all vf pages (well i checked a couple)

sample url from my org: https://company--dan.cs12.my.salesforce.com/003P000000G2zaB

i should just be able to put apex pagename at the end of the url like this::

https://company--dan.cs12.my.salesforce.com/apex/page_name

but instead it redirects to another users org to login
i tried a few variations but havent gotten it right yet

 
I want to write a trigger to Update product dates when opp close date changes .
 
For eg.
Opportunity Close Date:  11/29/2014    (Nov 29th 2014)
Prod 1 Start Date :   12/9/2014   (10 days from Opportunity Close date)
Prod 2 Start Date:    12/23/2014  (22 days from opportunity close date)

Please help. Thanks in advance .
I'm using MS Windows 8.1 with Google Chrome Version 35.0.1916.114 m
I have a free Salesforce trial version

From the "My Name" menu I chose "Developer Console".
I get a new window Force.com Developer Console with the "Loading workspace ..." progress bar.
The progress bar gets hung at about 50%.

Any advice?

Odeddevelopers console will not load

So I'm trying to do an aggregate query in Batch Apex and of course I'm running into the error "Aggregate query does not support queryMore(), use LIMIT to restrict the results to a single batch" which is useless since of course the whole idea of an aggregation is get everything you need without a LIMIT.

 

I tried using the scope parameter on database.executeBatch because the documentation implies that it changes the batch size so I tried 3,000 since that is the quantity of records I have, but I still got the querymore error.

 

It looks like aggregate queries really cannot be used in Batch Apex.  Oh sure, for 20 records maybe, but not for 200+, i.e. the real world.  Can anyone confirm that?

 

Also, what does the scope parameter on database.executeBatch really do?  Does it only throttle down the batch size, or can you use it to throttle up the size?  If so, then why doesn't it work for aggregate queries?

 

Thanks

David