Question

The company needs to know how much time each worker spends on each part of each project part.

The following resembles some custom objects that were defined for this app:

  • Custom Project
  • Custom Project Part
  • Custom Time Entry

Now we need to customize our salesforce app in such a way that a worker can open the project part and click "Start..." and later "Stop...".

These buttons would create a time entry with a start date and update the time entry with a stop date respectively.

Is this possible to do in the custom objects themselves? (ideal)

Should we be creating new pages?

Was it helpful?

Solution

Yes. Create two custom Buttons for your custom object eg. "Start" and "Stop". Then put some JavaScript to the buttons to update your custom fields:

{!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")}

var YourCustomObject = new sforce.SObject("YourCustomObject__c");

YourCustomObject.Id = '{!YourCustomObject__c.Id }';
YourCustomObject.Start__c = '{!NOW()}';

updateStartTime = sforce.connection.update([YourCustomObject]);

Then insert these buttons to the page layout.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top