3

I'm trying to create a button that would change the Due Date field of a selected case in a List View. I'm stuck on the URL, since this is a mass change type would there be a custom URL that would be input? I want this button to function just like the change owner example below.

enter image description here

Change Owner example:

enter image description here

  • Unless you want to set all selected cases to the same due date, I don't think this button is going to do what you want. I think you'll only want the button to process one case at a time, not multiple ones. – crmprogdev Mar 17 '17 at 17:24
  • I would want the button to process multiple cases at a time. – Skobiwankanobi Mar 17 '17 at 19:29
  • you have to try some code at your own to do that, I have given that approach – Santanu Boral Mar 17 '17 at 19:54
  • I see what you mean, I'll compile the code and update appropriately. – Skobiwankanobi Mar 17 '17 at 20:00
  • did you get a chance to solve this? I have solved this at my DE – Santanu Boral Mar 20 '17 at 3:00
2

I think you can take this approach.

  1. From your javascript button, launch a flow and pass parameters to the flow.
  2. In the flow, place a date field where user can select the date.
  3. Finally based on passed parameters you should update the case records.

I have given a code how you can pass parameters (CaseIds) to the flow.

Code behind javascript button

{!RequireScript("/soap/ajax/29.0/connection.js")}

var caseObj = new sforce.SObject("Case");
var selectedCases = {!GETRECORDIDS($ObjectType.Case)}; //chosen records from list view checkboxes

//check at-least one record is selected
if (selectedCases[0] == null) {
   alert("You must select at least one record");
} else 
{
    var serverUrl = '{!$Api.Partner_Server_URL_260}';
    var position = {!FIND( '/services', $Api.Partner_Server_URL_260)};
    var base = serverUrl.substring(0,position-1);

    var url = base +encodeURI('/flow/Update_Due_Date?vSelectedCaseIds=' + selectedCases +  '&vCaseCount=' + selectedCases.length +  '&retURL=/500/o');

    window.open(url, '_self');
}

Refer this answer for detailed answer:

Pass Case Ids collection to visual workflow from Case List View Custom Button and update cases taking from input screen

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.