Trouble Uploading Person Accounts Into Salesforce Using Apex Data Loader - salesforce

I am trying to import ~15k PersonAccounts into Salesforce using the Apex Data Loader version 25.0.1 available here.
I have already called Salesforce and enabled PersonAccounts on my Organizaion. I have successfully logged in with my admin credentials and exported a RecordType csv showing the following info:
ID | NAME | DEVELOPERNAME
01280000000Lsy4AAC | Person Account | PersonAccount
01280000000LsxzAAC | Business Account | Business_Account
I have created a new csv with the following columns:
RECORDTYPEID
LASTNAME
FIRSTNAME
DESCRIPTION
PERSONMAILINGSTREET
PERSONMAILINGCITY
PERSONMAILINGSTATE
PERSONMAILINGPOSTALCODE
PERSONMAILINGCOUNTRY
PERSONHOMEPHONE
PERSONEMAIL
and specified 01280000000Lsy4AAC for all records in the RECORDTYPEID column.
When I attempt to insert my csv I get the same error for all rows:
Record Type ID: id value not valid for the users profile: 01280000000Lsy4AAC
What am I doing wrong? How do I upload PersonAccounts using the Apex Data Loader?
Update: I have tried the method recommended here of getting the RecordTypeID from the query string of the web interface (which gives you the same RecordTypeID without the "ACC" suffix and I still get the exact same error.

I had to enable Person Accounts on my Sys Admin profile
Setup -> Manage Users -> Profiles -> System Administrator, then Object Settings, then Account, and make sure Person record type is assigned.
https://sites.secure.force.com/success/questionDetail?qid=a1X30000000duV6EAI

Related

Get-AzADUser no longer return Department and AccountEnabled

I'm pretty sure that last week I was able to use Get-AzADUser to return both Department and AccountEnabled.
Get-AzADUser | where {$_.Mail -eq "abc#xyz.com"} | Select-Object Mail, Department, AccountEnabled
Mail Department AccountEnabled
---- ---------- --------------
abc#xyz.com
When I call up all parameters for a single user I can see that I'm missing content on many fields, I basically only see Name, JobTitle, Mail, and MobileNumber
I'm using an account assigned the roles "Global reader" and "Directory readers".
(Other parts of my script also stopped working since last week where Get-AzADUsers no longer has a field called "ObjectId" but instead the field is simply called "Id")
You need to use "-Select" and " -AppendSelected" parameters to get the info.
Try the following (working for me)...
Get-AzADUser -Select 'Department,AccountEnabled' -AppendSelected -UserPrincipalName "abc#xyz.com" | Select-Object Mail, Department, AccountEnabled
Mail Department AccountEnabled
---- ---------- --------------
abc#xyz.com IT Support True
More info: https://learn.microsoft.com/en-us/powershell/module/az.resources/get-azaduser
I tested in My Environment and found Get-AzADUser not much suitable command as it doesn't appear to return any information about the user (like department, usage location, office info, or basically any properties on the user).
There continues to be a lack of properties returned when comparing Get-AzureADUser vs. Get-AzADUser:
AzureAD Module which is a designed for tasks within AzureAD
Where second one Az which is designed to handle most, if not all of Azure's resources.
you can use the az module easliy if you just want to look up the users existance, but if you need to actually administer azure ad i would suggest you go for azuread. To connect to a specified tenant with azuread use connect-azuread -tenantId 'XXXXXX'.
Output Using Get-AzureADUser
I am able to get the departmentName
Reference : https://github.com/Azure/azure-powershell/issues/10497

Gcp appengine app does not correctly connect to Cloud sql database

I have connection issue between my spring boot/kotlin app and database. I tried following guides what google has to offer and some Stackoverflow posts. I added client/admin sql permisions to users.
After following google guide https://github.com/spring-cloud/spring-cloud-gcp/tree/master/spring-cloud-gcp-samples/spring-cloud-gcp-sql-postgres-sample on this link and recreating everything as it is. I came to problem: deployed App does not connect to actual database, instead it uses data.sql and schema.sql objects from resources, also it does not do changes to actual database, but somewhere else, for example I am using this command to getdata:
#GetMapping("/getdata")
fun getTuples(): List<String>? {
return jdbcTemplate!!.queryForList("SELECT * FROM users").stream()
.map { m: Map<String?, Any?> -> m.values.toString() }
.collect(Collectors.toList())
}
result I get is the one provided in example:
0 "[luisao#example.com, Anderson, Silva]"
1 "[jonas#example.com, Jonas, Goncalves]"
2 "[fejsa#example.com, Ljubomir, Fejsa]"
the actual users table in Cloud database looks like this:
postgres=> select * from users;
email | first_name | last_name
--------------------+------------+-----------
luisao#example.com | Anderson | Silva
jonas#example.com | Jonas | Goncalves
fejsa#example.com | Ljubomir | Fejsa
kkskldk | sjndjfdf | skdskd
(4 rows)
first 3 rows are same just because I added them manually. App does not see DDL/DML changes in database, only those I do in data.sql or schema.sql. So the question is where could be a problem?
in this documentation https://cloud.spring.io/spring-cloud-gcp/multi/multi__spring_jdbc.html says that this dependency should do most of the stuff automaticly but somehow something goes wrong.
Could it be that spring boot/hikari creates virtual enviroment in appengine which blocks database connection and you connect and see only Mock data from data.sql files? Or problem lies in configuration?
My application.properties file:
server.error.include-message=always
spring.cloud.gcp.sql.database-name=[database name]
spring.cloud.gcp.sql.instance-connection-name=[Instance name]
spring.datasource.continue-on-error=true
spring.datasource.initialization-mode=always
spring.datasource.username=postgres
spring.datasource.password=[password]
spring.cloud.gcp.project-id=[project id]

VisualForce Controller SOQL query prematurely limited

I have a visual force page that references my controlling class 'ESWebCaseController.cls'.
The visual force page has a field called 'Company' that runs on an SF site and is accessible by anyone when the form is submitted is used in a SOQL query like:
List account_list = [SELECT Name FROM Account WHERE Name =:company];
This query returns 0 results when company = Acme, however this same query returns 1 result when done using the Eclipse IDE SF Schema. There is defnately a company named Acme in my org.
When I remove the WHERE clause in the query, 10 Accounts are returnted, even if I set LIMIT 100, only 10 accounts are returned. These 10 accounts seem to have one thing in common and that is that they reference the same parent account and/or have a specific field ID that references the parent account.
I want to know if there is anything that would cause the above query in my controlling class to be limited outside of the Query itself.
Below are the debug logs for the Query:
20:28:32.158 (158986000)|POP_TRACE_FLAGS|[163]|01p500000009goT|ESWebCaseController|APEX_CODE,FINEST;APEX_PROFILING,FINEST;CALLOUT,FINEST;DB,FINEST;SYSTEM,FINEST;VALIDATION,FINEST;VISUALFORCE,FINEST;WORKFLOW,FINEST
20:28:32.159 (159879000)|SOQL_EXECUTE_BEGIN|[163]|Aggregations:0|select Name from Account where Name = :tmpVar1
20:28:32.159 (159893000)|LIMIT_USAGE|[163]|SOQL|1|100
20:28:32.159 (159898000)|LIMIT_USAGE|[163]|AGGS|0|300
20:28:32.177 (177286000)|SOQL_EXECUTE_END|[163]|Rows:0
20:28:32.177 (177308000)|LIMIT_USAGE|[163]|SOQL_ROWS|0|50000
20:28:32.177 (177324000)|HEAP_ALLOCATE|[163]|Bytes:4
20:28:32.177 (177337000)|HEAP_ALLOCATE|[163]|Bytes:0
20:28:32.177 (177411000)|HEAP_ALLOCATE|[163]|Bytes:4
20:28:32.177 (177441000)|VARIABLE_SCOPE_BEGIN|[163]|account_list|LIST<Account>|true|false
20:28:32.177 (177488000)|VARIABLE_ASSIGNMENT|[163]|account_list|{"serId":1,"value":[]}|0x14cace14
20:28:32.177 (177504000)|STATEMENT_EXECUTE|[165]
Are you using with Sharing on your controller and do you have access to the account Acme from the user running the query?
By default classes have "with sharing" so they respect the sharing in the parent org, this means that if the user who accesses the page does not have access to the data the data will not be available for the query.
A quick and easy test for this is to get the Id of the record you need access to and log into salesforce then go to the url directly.
So if the record was a01adf20123032 (that's a made up id fyi) and your instance was na1 you'd log into salesforce and navigate to https://na1.salesforce.com/a01adf20123032 if you get insufficient privileges then the person doesn't have access.
Through the IDE you're most likely using a system administrator user with the "view all data" permission so they'll always get all data returned.

Apex Trigger Salesforce

I need to use the look up field which relates Contact and Account object in Trigger. I have lookup field Account__c on the Contact, but I cannot get the related Account for that contact when I write something like
Map <Id,Account> acts = new Map<Id,Account>([Select Id,Name from Account where Id:=contact.Account__c]);
it should get all related accounts in to acts, but it does not work..
How can I get related Accounts?
Unless this is a special case you don't need to create a relationship between contact and account, there is already a standard one. you can query it like so
try {
Account parent = [SELECT Id, Name FROM Account WHERE Id = :contact.AccountId];
} catch(QueryException e) {
//list has no rows for assignment
//means the account with Id could not be found
}
For more information about the api names you should look at the wsdl
As an aside, you don't need to pass the results of this query to a map, any time you use Id = :idValue in a WHERE clause it is guaranteed that you will get exactly 0 or 1 result, and in the cause of 0 results a QueryException will be thrown.

Salesforce Bulk api InvalidBatch : Field name not found

I am using the bulk upload code described at http://www.salesforce.com/us/developer/docs/api_asynch/.
The only difference is that i am uploading a custom object type. I can access Employee_c. But now i get a different error
stateMessage='InvalidBatch : Field name not found : First Name'
First Name is the first column in the csv.
While debugging i can see that the temp csv is being created correctly. However i get this error when checkResults executes. The code is exactly the same as in the sample java code for bulk api using REST.
I am using the free developer version of salesforce.
I created a new permission set where i have given following permissions on custom object employee:
Read/create/edit/delete/view all/modify all.
All fields are given edit permissions.
The permission set is associated with salesforce user license.
The programmatic login is with a user associated with System administrator profile , which has sales force user license.
But still the error persists!
Any pointers would be appreciated
Thanks
Sameer
Try "FirstName" without the space.
You can view the API name of any field in Setup > App Setup > Objects > (Select Your Object) > (Select Your Field). Make sure all the fields you are querying have the correct API names.

Resources