• Brian Cherry
  • NEWBIE
  • 24 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 4
    Replies
I'm trying to get pull the oldest case and assign it to a user. Without locking, we are experiening where users are clicking the button to call the query at the same time. If I add in For Update and remove order by, the oldest case isn't ever pulled. The newest case is. Does anyone have a work around to query the oldest case for update?                       


Case caseObj = [select c.CreatedDate,c.ID,c.OwnerId from Case c where

                                                            c.IsClosed=false
                                                            and c.OwnerId in :listGroupIds ORDER BY c.CreatedDate
                                                            limit 1
                                                            for update];
                                                            caseObj.OwnerId = userId;
                                                            update caseObj;
                                                            return caseObj.Id;
                                                            }
                                   catch (QueryException e) {
                                    System.debug ('No Cases Available');
                                   }
We have several queues set-up and we would like cases to be assigned from these queues when the user logins. Login flows from what I can see doesn't limit the amount of records to update based on critera. Anyone have any thoughts?

Thanks,
Brian
Has anyone been able to get Batch Apex to work to merge Duplicate contacts? If so, It would great if you could share how.

Thanks,

Brian
I'm trying to get pull the oldest case and assign it to a user. Without locking, we are experiening where users are clicking the button to call the query at the same time. If I add in For Update and remove order by, the oldest case isn't ever pulled. The newest case is. Does anyone have a work around to query the oldest case for update?                       


Case caseObj = [select c.CreatedDate,c.ID,c.OwnerId from Case c where

                                                            c.IsClosed=false
                                                            and c.OwnerId in :listGroupIds ORDER BY c.CreatedDate
                                                            limit 1
                                                            for update];
                                                            caseObj.OwnerId = userId;
                                                            update caseObj;
                                                            return caseObj.Id;
                                                            }
                                   catch (QueryException e) {
                                    System.debug ('No Cases Available');
                                   }
I'm trying to get pull the oldest case and assign it to a user. Without locking, we are experiening where users are clicking the button to call the query at the same time. If I add in For Update and remove order by, the oldest case isn't ever pulled. The newest case is. Does anyone have a work around to query the oldest case for update?                       


Case caseObj = [select c.CreatedDate,c.ID,c.OwnerId from Case c where

                                                            c.IsClosed=false
                                                            and c.OwnerId in :listGroupIds ORDER BY c.CreatedDate
                                                            limit 1
                                                            for update];
                                                            caseObj.OwnerId = userId;
                                                            update caseObj;
                                                            return caseObj.Id;
                                                            }
                                   catch (QueryException e) {
                                    System.debug ('No Cases Available');
                                   }
Hello,

I am working with flows in our test enviorment and the flow works from a button I created.  However, when I select the button to run the flow I get the below message.  I currently have to hit the back button on my browser to go back to the object and then I have to refresh it to show the results.  Is there a way to imilinate this message and refresh the object to show the flow results?  

User-added image

Thanks,

Aaron