Tuesday, May 13, 2014

Power Partner User:

To bulk load Partner user in salesforce below are the steps:

1. Create those Partner Users as Contact.
2. But to create contact we should create account first.
3. Create account and enable this account as partner account.
4. Load all contact under the account created in step 3 with ispartner=TRUE
5. Now create 1 user with correct account and contact id populated
6. step 5 will create partner role now update users role with appropriate role ids
7. create bulk users same way we created in step 5

Tuesday, April 29, 2014

Get Object Name of activity whatid

week before I came across the situation where task whoid and whatid are associated with many custom object and prob was how to find the object name. Object Name is required since when migrating task records then these object ids will change.

so below is the option i tried to get the Object name with objectPrefix values

String objPrefix  =  '800';              //replace this with your object first 3 digit

Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
for(Schema.SObjectType objectInstance : gd.values())
{
if(objectInstance.getDescribe().getKeyPrefix() == objPrefix )
{
System.debug('Object Name is: '+ objectInstance.getDescribe().getName());
}
}

Thursday, March 27, 2014

Today, when i tried to export attachment related to account. i could not export because salesforce doesn't provide way of using string function on lookup object.

so what i did :

integer i=0;
for(Attachment a :[SELECT id,parentid  FROM Attachment]){
 string s =a.parentid ;
  if(s.startsWith('001')){
     i = i+1;
   }
}

system.debug('NUMBER OF ATTACHMENT==============='+i);

Thursday, February 13, 2014

Using Date format to fetch data from SQL in talend

this is how context variable can be used

"SELECT * FROM ACCOUNTS WHERE
TO_DATE(CREATEDATE, 'YYYY-MM-DD\"T\"HH24:MI:SS') <= " + context.LastRunTime + " AND
TO_DATE(LASTMODIFIEDDATE, 'YYYY-MM-DD\"T\"HH24:MI:SS') > " + context.LastRunTime