• Jennifer Molske
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
Hi,

I want to use the dataloader cli for connecting elastic search with salesforce to push data from elastic to our salesforce instance. Anybody got experiences with this task? I've already tried different configurations in my database_conf.xml, but no chance to connect to elastic search...

Thanks in advance.
Hello,
I've got a simple BatchApex-Cronjob which should delete all objects of a custom objects. 
global class BatchDeleteWorklogsJob implements Database.Batchable<sObject>, Schedulable  {

    global final String query = 'SELECT Id FROM Issue_Worklog__c LIMIT 20000';

    global void execute(SchedulableContext sc) {
        deleteWorklogs();
    }

    global void deleteWorklogs() {
        BatchDeleteWorklogsJob deleteJob = new BatchDeleteWorklogsJob();
        ID batchprocessid = Database.executeBatch(deleteJob);
    }

    global Database.QueryLocator start(Database.BatchableContext BC){
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List<sObject> scope){
        delete scope;
        Database.emptyRecycleBin(scope);
    }

    global void finish(Database.BatchableContext BC){

        if(!Test.isRunningTest()) {

            List<Issue_Worklog__c> liste = [SELECT Id FROM Issue_Worklog__c LIMIT 20000];
            if(liste.size() > 0) {

                //Die Liste ist noch nicht leer, daher erneut ausfuehren
                deleteWorklogs();
            }
            else {
                //wenn alle Worklogs geloescht sind, dann loesche anschließend die Issues
                BatchDeleteIssuesJob.deleteIssues();
            }
        }
    }
}

The cronjob gets executed every night and always fails with a REQUEST_RUNNING_TOO_LONG exception. So the problem is my soql query, right? I've already added the LIMIT 20000 condition hoping that it will fix the problem. But nope. 
If I execute the query in the developer console I also get a "No response from server" message.

Any guesses how I can solve this problem? Thanks in advance ;-)
Hi guys,

I've got a difficult problem on which I am working a few hours but still wasn't able to solve.

In our organisation we've got lots of orders with different order items. I cannot find a custom implementation for calculating the TotalAmount of an order, so I assume that it is calculated by Salesforce itself and sums up the TotalPrice fields of the order items of an order. We've also implemented a custom field (let's call it BillingPercent) which holds a percent value that indicates how  much percent of the TotalAmount of the order is already billed.

If I insert, update or remove some of the order items of an order the TotalAmount of this order changes. So now, every time the TotalAmount changes, I want to recalculate the value of my custom field BillingPercent, so that it adapts to the new TotalAmount.

I tried the following:
- I tried to add this functionality to my onBeforeUpdate Trigger for Orders, so that I can use the old and new TotalAmount values of the order to calculate the new BillingPercent value. Unfortunately doesn't get called if I insert, update or delete some of my order items.
- I implemented a new onBeforeInsert/Update/Delete-Trigger on OrderItems in which I was able to calculate the new BillingPercent value. This works fine for just updating existing order items, but if I insert or delete an new order item, the trigger crashes with the following message:

first error: SELF_REFERENCE_FROM_TRIGGER

The reason why the trigger crashes is obvious: I delete an order item, the BillingPercent value of the order is updated and because of this the UpdateOrder trigger gets called. The UpdateOrder trigger itself has the function to add all the default order items we specified in another table. 

Delete (default) order item from order --> UpdateOrderItem.trigger is called --> BillingPercent is calculated --> update order --> UpdateOrder trigger is called --> UpdateOrder trigger updates the order items and so the UpdateOrderItem.trigger is called again and crashes because the order items is already referenced in the trigger.

Anybody got an idea how to solve the problem and achieve the simple recalculation of the BillingPercent value after the TotalAmount value changes? I'm not fixed on using triggers, I already thought about using a workflow rule but I don't know if this could be the right way. Maybe there are some other possibilities how to achieve the desired behaviour.

Thanks for your help :)

Best Regards,
Jenny
Hi guys,

I've got a difficult problem on which I am working a few hours but still wasn't able to solve.

In our organisation we've got lots of orders with different order items. I cannot find a custom implementation for calculating the TotalAmount of an order, so I assume that it is calculated by Salesforce itself and sums up the TotalPrice fields of the order items of an order. We've also implemented a custom field (let's call it BillingPercent) which holds a percent value that indicates how  much percent of the TotalAmount of the order is already billed.

If I insert, update or remove some of the order items of an order the TotalAmount of this order changes. So now, every time the TotalAmount changes, I want to recalculate the value of my custom field BillingPercent, so that it adapts to the new TotalAmount.

I tried the following:
- I tried to add this functionality to my onBeforeUpdate Trigger for Orders, so that I can use the old and new TotalAmount values of the order to calculate the new BillingPercent value. Unfortunately doesn't get called if I insert, update or delete some of my order items.
- I implemented a new onBeforeInsert/Update/Delete-Trigger on OrderItems in which I was able to calculate the new BillingPercent value. This works fine for just updating existing order items, but if I insert or delete an new order item, the trigger crashes with the following message:

first error: SELF_REFERENCE_FROM_TRIGGER

The reason why the trigger crashes is obvious: I delete an order item, the BillingPercent value of the order is updated and because of this the UpdateOrder trigger gets called. The UpdateOrder trigger itself has the function to add all the default order items we specified in another table. 

Delete (default) order item from order --> UpdateOrderItem.trigger is called --> BillingPercent is calculated --> update order --> UpdateOrder trigger is called --> UpdateOrder trigger updates the order items and so the UpdateOrderItem.trigger is called again and crashes because the order items is already referenced in the trigger.

Anybody got an idea how to solve the problem and achieve the simple recalculation of the BillingPercent value after the TotalAmount value changes? I'm not fixed on using triggers, I already thought about using a workflow rule but I don't know if this could be the right way. Maybe there are some other possibilities how to achieve the desired behaviour.

Thanks for your help :)

Best Regards,
Jenny