• Mahmood Butt
  • NEWBIE
  • 30 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 2
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 7
    Replies
I am trying to delete a cases that were created during testing in Production, we have setup rollup helper on Cases, and Realtime rollups enabled. Deleting a test case results in the following error:

There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger RHX_Case caused an unexpected exception, contact your administrator: RHX_Case: execution of BeforeDelete caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.RHX_Case: line 3, column 1"

Changing the rollup helper setting doesn't appear to work either, when I deactivate them. How do I deactivate the rollup helper trigger?
User-added image
I have configured Salesforce Survey in the org. Survey itself is working fine for both internal and external users.
I have to display this survey to end-user when the chat is ended. I have used Post-Chat URL and used "external" survey link to be displayed.

Theoretically, all should work without any hassle, but I am receiving this weird error:
while(1); 
*/{"message":"Invalid request, no message"}/ERROR/
I am not sure what is going on and what wrong am I doing here?
We have few jobs scheduled on data loader, we are receiving the error in the sdl.log file:
Expected 5000 to be processed for batch but got results for 4000

Relevant portion log is given below
 
2016-10-17 10:00:43,681 INFO  [OrderLineItemUpsert] progress.NihilistProgressAdapter setSubTask (NihilistProgressAdapter.java:78) - Processed 1,361,110 of 1,399,110 total records. Rate: -298,000 records per hour. Estimated time to complete: 39 minutes and 13 seconds.  There are 871,232 successes and 489,878 errors.
.
.
.
2016-10-17 10:00:53,853 INFO  [OrderLineItemUpsert] visitor.BulkApiVisitorUtil updateJobStatus (BulkApiVisitorUtil.java:179) - Batch Status: 0 Queued, 3 In Progress, 249 Completed, 28 Failed.
2016-10-17 10:03:36,748 INFO  [OrderLineItemUpsert] progress.NihilistProgressAdapter setSubTask (NihilistProgressAdapter.java:78) - Processed 1,364,110 of 1,399,110 total records. Rate: -283,000 records per hour. Estimated time to complete: 40 minutes and 38 seconds.  There are 873,972 successes and 490,138 errors.
2016-10-17 10:03:36,748 INFO  [OrderLineItemUpsert] visitor.BulkApiVisitorUtil updateJobStatus (BulkApiVisitorUtil.java:179) - Batch Status: 0 Queued, 0 In Progress, 251 Completed, 29 Failed.
2016-10-17 10:03:36,748 INFO  [OrderLineItemUpsert] progress.NihilistProgressAdapter setSubTask (NihilistProgressAdapter.java:78) - Retrieving Bulk Job Results
2016-10-17 10:03:38,029 ERROR [OrderLineItemUpsert] action.AbstractAction handleException (AbstractAction.java:199) - Exception occured during loading
com.salesforce.dataloader.exception.LoadException: 7511A000007OurvQAC: Expected 5000 to be processed for batch but got results for 4000
    at com.salesforce.dataloader.action.visitor.BulkLoadVisitor.sanityCheckError(BulkLoadVisitor.java:436)
    at com.salesforce.dataloader.action.visitor.BulkLoadVisitor.sanityCheckBatch(BulkLoadVisitor.java:424)
    at com.salesforce.dataloader.action.visitor.BulkLoadVisitor.processResults(BulkLoadVisitor.java:305)
    at com.salesforce.dataloader.action.visitor.BulkLoadVisitor.getResults(BulkLoadVisitor.java:292)
    at com.salesforce.dataloader.action.visitor.BulkLoadVisitor.flushRemaining(BulkLoadVisitor.java:270)
    at com.salesforce.dataloader.action.AbstractLoadAction.flush(AbstractLoadAction.java:86)
    at com.salesforce.dataloader.action.AbstractAction.execute(AbstractAction.java:126)
    at com.salesforce.dataloader.controller.Controller.executeAction(Controller.java:120)
    at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:149)
    at com.salesforce.dataloader.process.ProcessRunner.run(ProcessRunner.java:100)
    at com.salesforce.dataloader.process.ProcessRunner.main(ProcessRunner.java:253)
2016-10-17 10:03:38,045 ERROR [OrderLineItemUpsert] progress.NihilistProgressAdapter doneError (NihilistProgressAdapter.java:58) - 7511A000007OurvQAC: Expected 5000 to be processed for batch but got results for 4000

It appears the data loader was running successfully but throws error suddenly and Error/Success files show not record nor they are updated in the system. I have not come across that kind of an error before, any idea or help from the community would be appreciated. 
Requirement
I have to fetch all the content Notes that are associated to events created after 01-Aug-2016.

Logic path
I have taken the following path to get to content notes
  • fetch events
  • find the Link via ContentDocumentLink object by passing them Event ids fetched in step-1
  • fetch ContentVersion by passing ContentDocumentIds retrieved in step-2
  • check each contentversion record by looking at their fileType to filter out only notes (SNOTE).
Code
Set<id> ev=(new Map<Id, Event>([SELECT id from Event where CreatedDate > 2016-08-01T00:00:00Z])).keySet(); 
Map<id, ContentDocumentLink> cdlMap = new Map<id, ContentDocumentLink>(); 

for(ContentDocumentLink cdl: [SELECT ContentDocumentId, LinkedEntityId FROM ContentDocumentLink WHERE LinkedEntityId IN : ev]) 
{ 
    cdlMap.put(cdl.ContentDocumentId, cdl);         
    contentDocumentIdSet.add(cdl.ContentDocumentId); 
} 
system.debug('cdl keys > ' + contentDocumentIdSet ); 
List<ContentVersion> cvMap = new List<ContentVersion>(
              [SELECT Title, FileType, ContentDocumentId 
               FROM ContentVersion 
               WHERE ContentDocumentId IN:contentDocumentIdSet]); 

system.debug('cdlMap ' + cdlMap.size() + '| cvMap > ' + cvMap.size());

Problem
ContentVersion list (cvMap) is not returning anything.
  • I tried passing cdlMap.keySet() didn't work.
  • I then created a Set<id> and passed the map keyset to it and then supplied it to the SOQL, that didn't work either.
  • and now I tried the above code to created a set in loop and provide it in SOQL. Not working.
If I hardcode ContentDocumentId to SOQL single or multiple, it is working. Any help would be highly appreciated.
I have a trigger on ContentDocumentLink object. I have use case to show total number of Files and number of notes attached if the link was between Events and Content (Files/Notes) using Salesforce Content. And, offcourse, similar thing that needs to be done when a content is removed, I implemented beforeDelete event as well.

Code
trigger ContentDocumentLinkTrg on ContentDocumentLink (after insert, before delete)  
{
    //Check if customization is not enable through custom settings
    if(!CustomSettingsUtil.IsCustomizationEnabled())
    {
        return;
    }
    String BeforeOrAfter = (Trigger.isBefore ? 'Before' : 'After');
    String TriggerType = ''
        + (Trigger.isDelete ? 'Delete' : '')
        + (Trigger.isInsert ? 'Insert' : '');
    system.debug(BeforeOrAfter + ' ' + TriggerType );
    // run TriggerHandler
    new ContentDocumentLinkTriggerHandler().run();
}
Checking the debug log, it is entering the AfterInsert event but not BeforeDelete. I see no restrictions in the SF documentation, can anyone put some light on this, please.
I have migrated Notes to Enhanced Notes (ContentNote) using SF data loader. Most of the records are migrated successfully, only in few of the records I am receiving following error:

Invalid sharing type "I"
I tried changing the ShareType to 'C' (Collaborator) but same error. Does it have something to do with security settings of the Parent (LinkedEntityId) record?

P.S. All the error records have ParentIds in Quote ('0Q0') or Email Template ('00X') objects.
One of our clients has a requirement to migrate attachments to Salesforce Files. Salesforce Files (ContentDocument) object doesn't support insert().
They have also enabled this option from Winter '16 to allow file uploads to goto salesforce files instead of attachments.
User-added image

I have confirmed from Salesforce docs and data loader pertaining ContentDocument's supported calls. Now, is there a way I can still pull this task off of migrating attachments to salesforce files?
Currently, I'm exploring salesforce to salesforce (S2S) and I have S2S setup on 2 of my dev orgs. I have read couple of examples on sharing/inserting records from one org to another, but I couldn't find any documentation or example pulling records from the S2S connection using SOQL like
 
SELECT id, name FROM account LIMIT 10

 
I have migrated Notes to Enhanced Notes (ContentNote) using SF data loader. Most of the records are migrated successfully, only in few of the records I am receiving following error:

Invalid sharing type "I"
I tried changing the ShareType to 'C' (Collaborator) but same error. Does it have something to do with security settings of the Parent (LinkedEntityId) record?

P.S. All the error records have ParentIds in Quote ('0Q0') or Email Template ('00X') objects.
One of our clients has a requirement to migrate attachments to Salesforce Files. Salesforce Files (ContentDocument) object doesn't support insert().
They have also enabled this option from Winter '16 to allow file uploads to goto salesforce files instead of attachments.
User-added image

I have confirmed from Salesforce docs and data loader pertaining ContentDocument's supported calls. Now, is there a way I can still pull this task off of migrating attachments to salesforce files?
I am currently working on survey to display a random questions, For that i need to update random numbers to a sobject. But System.NullPointerException: occurred in my code.

Apex:
public class update_random_question 
{
public   List<Question__c> scope{get;set;}
public update_random_question()
{
    for(Question__c a : scope)
    {
        a.orderby__c = randomizer.getRandomNumber(100);            
    }
update scope;
} }

VF:​
<apex:page controller="update_random_question">
    <apex:form>
        <apex:commandButton Value="Begin" action="{!update_random_question}"/>
    </apex:form>
</apex:page>

Notes: randomizer.getRandomNumber
Hi All,
I am creating a task using batch apex. Through batch apex I am inserting 50% data into Task (From Custom object1).
Remaining data I have in Custom Object2.
I want to get that data by using Trigger
I want to compare Account Id of Task with Custom Object 2(I have Lookup to Account in Custom Object2).
Can I do this by using Trigger?
Now, on which object I have to trigger and how syntax should be?

Thanks in Advance
I have migrated Notes to Enhanced Notes (ContentNote) using SF data loader. Most of the records are migrated successfully, only in few of the records I am receiving following error:

Invalid sharing type "I"
I tried changing the ShareType to 'C' (Collaborator) but same error. Does it have something to do with security settings of the Parent (LinkedEntityId) record?

P.S. All the error records have ParentIds in Quote ('0Q0') or Email Template ('00X') objects.
One of our clients has a requirement to migrate attachments to Salesforce Files. Salesforce Files (ContentDocument) object doesn't support insert().
They have also enabled this option from Winter '16 to allow file uploads to goto salesforce files instead of attachments.
User-added image

I have confirmed from Salesforce docs and data loader pertaining ContentDocument's supported calls. Now, is there a way I can still pull this task off of migrating attachments to salesforce files?
Here is soql i want get ids of attachments as follows and how can i retrieve ids from the list
 
list<Account> accs = [select (select id from attachments where createddate < last_N_days:10) from account where is_read__c = true]

Now i want ids of attachments into a seperate list how it is possible..

Thanks in advance
Hi,

I have scenario that update a custom field(Amount__C) of parent(Account) with sum of all child records (Total_Price) from Child Object(Invoice Line Item).

I have to wirte a trigger for above scenario, if any one have sample code please share it.

Thanks in advance,
Shaik
  • December 21, 2014
  • Like
  • 1