1

I am using an action to mark a task as complete and immediately navigate to a new create Task page. I would like to pass in the ID of the task that was marked as complete so I can set that as the ParentTaskId custom field on the new task. Is there a way to do this with sdforce.one.createRecord? Below is my Extension and VF page I am using as the action.

The idea is what when a User selects the complete task action, it automatically completes the Task and brings them to the new task page with the ParentTaskId and WhatID populated.

Apex code:

public with sharing class FollowUpTaskExtension {
  public final Task task {get; set;}
  public String lastError {get; set;}

  public FollowUpTaskExtension(ApexPages.StandardController controller) {
    This.task = (Task)controller.getRecord();
  }

  public PageReference markCompleteNewTask(){
    Map<String, String> params = ApexPages.currentPage().getParameters();
    System.debug(':: mobile params ' + params);
    Task t = [Select id, Status from Task where id = :this.task.id];
    if(t.status != 'Completed'){
      t.status = 'Completed';
      upsert t;
    }
    return null;
  } 

VF Page:

<apex:page standardController="Task" extensions="FollowUpTaskExtension" action="{!markCompleteNewTask}" >
      <script>
        sforce.one.createRecord('Task');
      </script>
    </apex:page>
3
  • To my knowledge we cannot do URL hacking with SF1's createRecord method.
    – Richard N
    Commented Jun 9, 2015 at 16:54
  • 1
    Possible duplicate of : salesforce.stackexchange.com/questions/64850/…
    – Richard N
    Commented Jun 9, 2015 at 16:57
  • @RichardN is there a better way to create a new Record from an action? Or perhaps call another action automatically at the conclusion of my action?
    – Mike
    Commented Jun 9, 2015 at 17:04

0

You must log in to answer this question.

Browse other questions tagged .