Skip to main content

We currently have a button on our Case object that pops a dialog box asking for the agent to enter a number of minutes. They do so and click ok and that fires off the creation of a task with all the other required field values preset and adds the minutes they entered into the minutes field on the task.
That process works great. I’m now looking to recreate this by adding a row action to a skuid page that does the same thing for the row the action is clicked for. So it would create a task related to the case in that row.

Below is the code used for the button on our case page layouts. Any suggestions on making an in-line snippet that will perform this same task of opening a dialog box, asking for minutes, and then creating the task related to the case for the row the action was on?

Thank you in advance for any advice!


{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")}&nbsp;<br>var minutes = prompt("Enter Minutes", ""); if(minutes != null) try{ var taskToCreate = new sforce.SObject("Task");&nbsp;<br>taskToCreate.OwnerId = "{!$User.Id}";&nbsp;<br>taskToCreate.WhatId = "{!Case.Id}";&nbsp;<br>taskToCreate.Subject = "Time Logged - Support"; <br>taskToCreate.ActivityDate = new Date(); <br>taskToCreate.Duration_Minutes__c = minutes; <br>taskToCreate.CSC_Event_Type__c = "Support";&nbsp;<br>taskToCreate.Priority = "Normal";&nbsp;<br>taskToCreate.Status = "Completed";&nbsp;<br>result = sforce.connection.create(etaskToCreate]);&nbsp;<br>if(resultl0].success == "true"){&nbsp;<br>location.reload() ; } else{ alert( "An Error has Occurred. Error: 
" + resultl0].errors.message ); } } catch(e){ alert( "An Un-expected Error has Occurred. Error:
" + e ); }


You should be able to do this all pretty simply with Skuids actions. 1) open a popup 2) create a new record 3) populate fields 4) open another popup 5) close existing popup 6) conditionally render fields based on whether time has been entered or not… Etc…


Reply