• jburns12
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 6
    Replies

Ok what am i missing here? I have this page to redirect to different visualforce pages based on record type. However it always redirects to the 'else"option. If someone could please take a look and let me know whats up?

 

Class:

 

 

public class VFDispatch {
public VFDispatch(ApexPages.StandardController sc) {
}

public PageReference redirectToPage() {
    String selectedRecordType = ApexPages.currentPage().getParameters().get('RecordType');
    if (selectedRecordType == 'FLDEBT')
        return Page.General_Contract.setRedirect(true);
    else
        return Page.GC2.setRedirect(true);
    }
}

 Page:

 

<apex:page standardController="PNC__c" extensions="VFDispatch" action="{!redirectToPage}">
</apex:page>

 

 

Thank you in advance,

 

Jason Burns

 

I am trying to set the ActivityDate on a task via javascript executed by a button. I am able to set all other fields on the task, except for the date. Here is the code, I have been advised to use DueDate instead of ActivityDate, but that is contrary to the API documetation. I tried it anyway and it does not work. Niether attempt to update the ActivityDate is working. This is throwing off my reporting!

{!requireScript("/soap/ajax/13.0/connection.js")}

try
{
var account = new sforce.SObject("Account");
var task = new sforce.SObject("Task");
var followUp = new sforce.SObject("Task");

account.id = "{!Account.Id}";
account.IsDirty__c = true;

// set task 'assigned to' field to the current user
task.OwnerId = "{!Account.OwnerId}";
task.Subject = "{!Account.Current_Disposition__c}";
task.WhatId = "{!Account.Id}";
task.Description = "{!Account.Notes__c}";

// set status to closed
task.Priority = "Normal";
task.Status = "Completed";
task.ActivityDate=Date.valueOf({!Today()});

// if follow up required, then create the follow up task
if ({!Account.Follow_Up_Required__c})
{
followUp.OwnerId = "{!Account.OwnerId}";
followUp.Subject = "Follow Up Call";
followUp.WhatId = "{!Account.Id}";
followUp.Description = "{!Account.Notes__c}";

// set status to Open
followUp.Priority = "Normal";
followUp.Status = "Not Started";
followUp.IsReminderSet = true;
followUp.ActivityDate= Date.valueOf({!Account.Follow_Up_Date__c});
}

var result = sforce.connection.update([account]);
var resultT = sforce.connection.create([task]);
var resultF = resultT;

if (followUp != null)
{
resultF = sforce.connection.create([followUp]);
}

if (result[0].getBoolean("success") && resultT[0].getBoolean("success") && resultF[0].getBoolean("success"))
{
account.IsDirty__c = false;
account.Follow_Up_Required__c = false;
account.Follow_Up_Date__c = null;
account.Current_Disposition__c = null;
account.Notes__c = null;

result = sforce.connection.update([account]);

if (result[0].getBoolean("success"))
{
window.location.reload();
}
}
else
{
alert("Error!");
}
}// End try block
catch(err)
{
alert("Error creating task: " + err.toString());
}

 

 

 

This code logs a task based on the current disposition field, it also schedules a task based on a follow up required check box and a follow up date field. I am creating the tasks fine, but dont seem to be able to set the ActivityDate. Can some one tell me what I am doing wrong?

 

 

{!requireScript("/soap/ajax/13.0/connection.js")}

try
{
var account = new sforce.SObject("Account");
var task = new sforce.SObject("Task");
var followUp = new sforce.SObject("Task");

account.id = "{!Account.Id}";
account.IsDirty__c = true;

// set task 'assigned to' field to the current user
task.OwnerId = "{!Account.OwnerId}";
task.Subject = "{!Account.Current_Disposition__c}";
task.WhatId = "{!Account.Id}";
task.Description = "{!Account.Notes__c}";

// set status to closed
task.Priority = "Normal";
task.Status = "Completed";

// if follow up required, then create the follow up task
if ({!Account.Follow_Up_Required__c})
{
followUp.OwnerId = "{!Account.OwnerId}";
followUp.Subject = "Follow Up Call";
followUp.WhatId = "{!Account.Id}";
followUp.Description = "{!Account.Notes__c}";

// set status to closed
followUp.Priority = "Normal";
followUp.Status = "Not Started";
followUp.IsReminderSet = true;
followUp.ActivityDate = Date.valueOf({!Account.Follow_Up_Date__c});
}

var result = sforce.connection.update([account]);
var resultT = sforce.connection.create([task]);
var resultF = resultT;

if (followUp != null)
{
resultF = sforce.connection.create([followUp]);
}

if (result[0].getBoolean("success") && resultT[0].getBoolean("success") && resultF[0].getBoolean("success"))
{
account.IsDirty__c = false;
account.Follow_Up_Required__c = false;
account.Follow_Up_Date__c = null;
account.Current_Disposition__c = null;
account.Notes__c = null;

result = sforce.connection.update([account]);

if (result[0].getBoolean("success"))
{
window.location.reload();
}
}
else
{
alert("Error!");
}
}// End try block
catch(err)
{
alert("Error creating task: " + err.toString());
}

This code logs a task based on the current disposition field, it also schedules a task based on a follow up required check box and a follow up date field. I am creating the tasks fine, but dont seem to be able to set the ActivityDate. Can some one tell me what I am doing wrong?

 

 

{!requireScript("/soap/ajax/13.0/connection.js")}

try
{
var account = new sforce.SObject("Account");
var task = new sforce.SObject("Task");
var followUp = new sforce.SObject("Task");

account.id = "{!Account.Id}";
account.IsDirty__c = true;

// set task 'assigned to' field to the current user
task.OwnerId = "{!Account.OwnerId}";
task.Subject = "{!Account.Current_Disposition__c}";
task.WhatId = "{!Account.Id}";
task.Description = "{!Account.Notes__c}";

// set status to closed
task.Priority = "Normal";
task.Status = "Completed";

// if follow up required, then create the follow up task
if ({!Account.Follow_Up_Required__c})
{
followUp.OwnerId = "{!Account.OwnerId}";
followUp.Subject = "Follow Up Call";
followUp.WhatId = "{!Account.Id}";
followUp.Description = "{!Account.Notes__c}";

// set status to closed
followUp.Priority = "Normal";
followUp.Status = "Not Started";
followUp.IsReminderSet = true;
followUp.ActivityDate = Date.valueOf({!Account.Follow_Up_Date__c});
}

var result = sforce.connection.update([account]);
var resultT = sforce.connection.create([task]);
var resultF = resultT;

if (followUp != null)
{
resultF = sforce.connection.create([followUp]);
}

if (result[0].getBoolean("success") && resultT[0].getBoolean("success") && resultF[0].getBoolean("success"))
{
account.IsDirty__c = false;
account.Follow_Up_Required__c = false;
account.Follow_Up_Date__c = null;
account.Current_Disposition__c = null;
account.Notes__c = null;

result = sforce.connection.update([account]);

if (result[0].getBoolean("success"))
{
window.location.reload();
}
}
else
{
alert("Error!");
}
}// End try block
catch(err)
{
alert("Error creating task: " + err.toString());
}

 

 

trigger Base_TR_ConvertLead on Lead (after insert, after update)
{
//create a string of ids to be converted
String records = '';
//get all records with status Lead Status= Qualified
for(Lead lead : Trigger.New)
{
if(lead.Status == 'Qualified')
{
if(records == '')
    records = lead.Id;
else
    records = records + ',' + lead.Id;
    }
}
//call the single click lead convert method to convert the lead
if(records != '')
{
MassConvert.MassLeadConvert.ConvertRecords(records, true, true, '','',true, 'Auto Convert');
}
}

 

I need help writing the test code for this trigger, I am new to Apex and not very sure of myself. Can some one give me a test example?

 

Help with auto call logger

I created this script to auto log calls based on the current disposition field...it also handles creation of follow up tasks. Basically elminates the need for the standars call log process. I have it working on the Account SO but cannot get it working on the leads SO.... not sure what the deal is. Here is a copy of the script for the leads object:

 

 

{!requireScript("/soap/ajax/13.0/connection.js")}

try
{
var account = new sforce.SObject("Lead");
var task = new sforce.SObject("Task");
var followUp = new sforce.SObject("Task");

account.id = "{!Account.Id}";
account.IsDirty__c = true;

// set task ‘assigned to’ field to the current user
task.OwnerId = "{!Lead.OwnerId}";
task.Subject = "{!Lead.Current_Disposition__c}";
task.WhatId = "{!Lead.Id}";
task.Description = "{!Lead.Notes__c}";

// set status to closed
task.Priority = "Normal";
task.Status = "Completed";

// if follow up required, then create the follow up task
if ({!Lead.Follow_Up_Required__c})
{
followUp.OwnerId = "{!Lead.OwnerId}";
followUp.Subject = "{!Lead.Current_Disposition__c}";
followUp.WhatId = "{!Lead.Id}";
followUp.Description = "{!Lead.Notes__c}";

// set status to closed
followUp.Priority = "Normal";
followUp.Status = "Not Started";
followUp.IsReminderSet = true;
followUp.ActivityDate = Date.valueOf({!Lead.Follow_Up_Date__c});
}

var result = sforce.connection.update([lead]);
var resultT = sforce.connection.create([task]);
var resultF = resultT;

if (followUp != null)
{
resultF = sforce.connection.create([followUp]);
}

if (result[0].getBoolean("success") && resultT[0].getBoolean("success") && resultF[0].getBoolean("success"))
{
{!Lead.IsDirty__c} = false;
{!Lead.Follow_Up_Required__c} = false;
{!Lead.Follow_Up_Date__c} = null;
{!Lead.Current_Disposition__c} = null;
{!Lead.Notes__c} = null;

result = sforce.connection.update([lead]);

if (result[0].getBoolean("success"))
{
window.location.reload();
}
}
else
{
alert("Error!");
}
}// End try block
catch(err)
{
alert("Error creating task: " + err.toString());
}

 

 

I am receiving a "missing ) after arguments list" error, not sure why...code is identical except for field names and variables.

 

Here is copy of working code on account object:

 

 

{!requireScript("/soap/ajax/13.0/connection.js")}

try
{
var account = new sforce.SObject("Account");
var task = new sforce.SObject("Task");
var followUp = new sforce.SObject("Task");

account.id = "{!Account.Id}";
account.IsDirty__c = true;

// set task ‘assigned to’ field to the current user
task.OwnerId = "{!Account.OwnerId}";
task.Subject = "{!Account.Current_Disposition__c}";
task.WhatId = "{!Account.Id}";
task.Description = "{!Account.Notes__c}";

// set status to closed
task.Priority = "Normal";
task.Status = "Completed";

// if follow up required, then create the follow up task
if ({!Account.Follow_Up_Required__c})
{
followUp.OwnerId = "{!Account.OwnerId}";
followUp.Subject = "{!Account.Current_Disposition__c}";
followUp.WhatId = "{!Account.Id}";
followUp.Description = "{!Account.Notes__c}";

// set status to closed
followUp.Priority = "Normal";
followUp.Status = "Not Started";
followUp.IsReminderSet = true;
followUp.ActivityDate = Date.valueOf({!Account.Follow_Up_Date__c});
}

var result = sforce.connection.update([account]);
var resultT = sforce.connection.create([task]);
var resultF = resultT;

if (followUp != null)
{
resultF = sforce.connection.create([followUp]);
}

if (result[0].getBoolean("success") && resultT[0].getBoolean("success") && resultF[0].getBoolean("success"))
{
account.IsDirty__c = false;
account.Follow_Up_Required__c = false;
account.Follow_Up_Date__c = null;
account.Current_Disposition__c = null;
account.Notes__c = null;

result = sforce.connection.update([account]);

if (result[0].getBoolean("success"))
{
window.location.reload();
}
}
else
{
alert("Error!");
}
}// End try block
catch(err)
{
alert("Error creating task: " + err.toString());
}

 

Any help would be appreciated

I created this script to auto log calls based on the current disposition field...it also handles creation of follow up tasks. Basically elminates the need for the standars call log process. I have it working on the Account SO but cannot get it working on the leads SO.... not sure what the deal is. Here is a copy of the script for the leads object:

 

 

{!requireScript("/soap/ajax/13.0/connection.js")}

try
{
var account = new sforce.SObject("Lead");
var task = new sforce.SObject("Task");
var followUp = new sforce.SObject("Task");

account.id = "{!Account.Id}";
account.IsDirty__c = true;

// set task ‘assigned to’ field to the current user
task.OwnerId = "{!Lead.OwnerId}";
task.Subject = "{!Lead.Current_Disposition__c}";
task.WhatId = "{!Lead.Id}";
task.Description = "{!Lead.Notes__c}";

// set status to closed
task.Priority = "Normal";
task.Status = "Completed";

// if follow up required, then create the follow up task
if ({!Lead.Follow_Up_Required__c})
{
followUp.OwnerId = "{!Lead.OwnerId}";
followUp.Subject = "{!Lead.Current_Disposition__c}";
followUp.WhatId = "{!Lead.Id}";
followUp.Description = "{!Lead.Notes__c}";

// set status to closed
followUp.Priority = "Normal";
followUp.Status = "Not Started";
followUp.IsReminderSet = true;
followUp.ActivityDate = Date.valueOf({!Lead.Follow_Up_Date__c});
}

var result = sforce.connection.update([lead]);
var resultT = sforce.connection.create([task]);
var resultF = resultT;

if (followUp != null)
{
resultF = sforce.connection.create([followUp]);
}

if (result[0].getBoolean("success") && resultT[0].getBoolean("success") && resultF[0].getBoolean("success"))
{
{!Lead.IsDirty__c} = false;
{!Lead.Follow_Up_Required__c} = false;
{!Lead.Follow_Up_Date__c} = null;
{!Lead.Current_Disposition__c} = null;
{!Lead.Notes__c} = null;

result = sforce.connection.update([lead]);

if (result[0].getBoolean("success"))
{
window.location.reload();
}
}
else
{
alert("Error!");
}
}// End try block
catch(err)
{
alert("Error creating task: " + err.toString());
}

 

 

I am receiving a "missing ) after arguments list" error, not sure why...code is identical except for field names and variables.

 

Here is copy of working code on account object:

 

 

{!requireScript("/soap/ajax/13.0/connection.js")}

try
{
var account = new sforce.SObject("Account");
var task = new sforce.SObject("Task");
var followUp = new sforce.SObject("Task");

account.id = "{!Account.Id}";
account.IsDirty__c = true;

// set task ‘assigned to’ field to the current user
task.OwnerId = "{!Account.OwnerId}";
task.Subject = "{!Account.Current_Disposition__c}";
task.WhatId = "{!Account.Id}";
task.Description = "{!Account.Notes__c}";

// set status to closed
task.Priority = "Normal";
task.Status = "Completed";

// if follow up required, then create the follow up task
if ({!Account.Follow_Up_Required__c})
{
followUp.OwnerId = "{!Account.OwnerId}";
followUp.Subject = "{!Account.Current_Disposition__c}";
followUp.WhatId = "{!Account.Id}";
followUp.Description = "{!Account.Notes__c}";

// set status to closed
followUp.Priority = "Normal";
followUp.Status = "Not Started";
followUp.IsReminderSet = true;
followUp.ActivityDate = Date.valueOf({!Account.Follow_Up_Date__c});
}

var result = sforce.connection.update([account]);
var resultT = sforce.connection.create([task]);
var resultF = resultT;

if (followUp != null)
{
resultF = sforce.connection.create([followUp]);
}

if (result[0].getBoolean("success") && resultT[0].getBoolean("success") && resultF[0].getBoolean("success"))
{
account.IsDirty__c = false;
account.Follow_Up_Required__c = false;
account.Follow_Up_Date__c = null;
account.Current_Disposition__c = null;
account.Notes__c = null;

result = sforce.connection.update([account]);

if (result[0].getBoolean("success"))
{
window.location.reload();
}
}
else
{
alert("Error!");
}
}// End try block
catch(err)
{
alert("Error creating task: " + err.toString());
}

 

Any help would be appreciated

 

{!requireScript("/soap/ajax/13.0/connection.js")}

try
{
var account = new sforce.SObject("Lead");
var task = new sforce.SObject("Task");
var followUp = new sforce.SObject("Task");

account.id = "{!Account.Id}";
account.IsDirty__c = true;

// set task ‘assigned to’ field to the current user
task.OwnerId = "{!Lead.OwnerId}";
task.Subject = "{!Lead.Current_Disposition__c}";
task.WhatId = "{!Lead.Id}";
task.Description = "{!Lead.Notes__c}";

// set status to closed
task.Priority = "Normal";
task.Status = "Completed";

// if follow up required, then create the follow up task
if ({!Lead.Follow_Up_Required__c})
{
followUp.OwnerId = "{!Lead.OwnerId}";
followUp.Subject = "{!Lead.Current_Disposition__c}";
followUp.WhatId = "{!Lead.Id}";
followUp.Description = "{!Lead.Notes__c}";

// set status to closed
followUp.Priority = "Normal";
followUp.Status = "Not Started";
followUp.IsReminderSet = true;
followUp.ActivityDate = Date.valueOf({!Lead.Follow_Up_Date__c});
}

var result = sforce.connection.update([lead]);
var resultT = sforce.connection.create([task]);
var resultF = resultT;

if (followUp != null)
{
resultF = sforce.connection.create([followUp]);
}

if (result[0].getBoolean("success") && resultT[0].getBoolean("success") && resultF[0].getBoolean("success"))
{
{!Lead.IsDirty__c} = false;
{!Lead.Follow_Up_Required__c} = false;
{!Lead.Follow_Up_Date__c} = null;
{!Lead.Current_Disposition__c} = null;
{!Lead.Notes__c} = null;

result = sforce.connection.update([lead]);

if (result[0].getBoolean("success"))
{
window.location.reload();
}
}
else
{
alert("Error!");
}
}// End try block
catch(err)
{
alert("Error creating task: " + err.toString());
}

I have a button which pulls the next lead from a queue and assigns to current user...I am trying to modify this to work with a custom object, how do i access the object?

 

 

  //Find an open lead that is assigned to one of those queues
            List<Lead> leads = [select l.Id,l.OwnerId from Lead l where 
                                                        l.IsConverted=false 
                                                        and l.OwnerId in :listGroupIds 
                                                        limit 1 
                                                        for update];

 

 

  //Find an open lead that is assigned to one of those queues

            List<Lead> leads = [select l.Id,l.OwnerId from Lead l where 

                                                        l.IsConverted=false 

                                                        and l.OwnerId in :listGroupIds 

                                                        limit 1 

                                                        for update];

 

 

Please help!

 

JB

Basically what we need is a dial button, I have been able to get it to work by simply having the button navigate to sip:{!Landing_Page_Lead__c.Dial__c}.... However then the user has to close the new window. What I would like to do is send an http request with java...I cannot seem to get it to work: Please help

 

{!requireScript("/soap/ajax/13.0/connection.js")}

{
URL sip = new URL("sip:{!Landing_Page_Lead__c.Dial__c}");
URLConnection yahooConnection = sip.openConnection();
sipConnection.connect();

} catch (MalformedURLException e) { // new URL() failed
. . .
} catch (IOException e) { // openConnection() failed
. . .
}

 

 

We have a softphone applet which outputs call dispositions to an XML file located on the server. It also outputs the account name, we need to have salesforce pull this XML file and update the disposition field based on the contents of the XML file. Any suggestions?

 

XML Example: (Wrapup Code = Call Disposition, Account Number = Account Name)

 

 <phoneCall>
     <agentId>18758</agentId>
     <teamId>99</teamId>
     <accountNumber>15617154128</accountNumber>
     <incidentNumber>4653</incidentNumber>
     <tamId>TMOne1</tamId>
     <wrapupCode>192</wrapupCode>
 </phoneCall>

 

I appreciate any help you can give

Ok what am i missing here? I have this page to redirect to different visualforce pages based on record type. However it always redirects to the 'else"option. If someone could please take a look and let me know whats up?

 

Class:

 

 

public class VFDispatch {
public VFDispatch(ApexPages.StandardController sc) {
}

public PageReference redirectToPage() {
    String selectedRecordType = ApexPages.currentPage().getParameters().get('RecordType');
    if (selectedRecordType == 'FLDEBT')
        return Page.General_Contract.setRedirect(true);
    else
        return Page.GC2.setRedirect(true);
    }
}

 Page:

 

<apex:page standardController="PNC__c" extensions="VFDispatch" action="{!redirectToPage}">
</apex:page>

 

 

Thank you in advance,

 

Jason Burns

 

I am trying to set the ActivityDate on a task via javascript executed by a button. I am able to set all other fields on the task, except for the date. Here is the code, I have been advised to use DueDate instead of ActivityDate, but that is contrary to the API documetation. I tried it anyway and it does not work. Niether attempt to update the ActivityDate is working. This is throwing off my reporting!

{!requireScript("/soap/ajax/13.0/connection.js")}

try
{
var account = new sforce.SObject("Account");
var task = new sforce.SObject("Task");
var followUp = new sforce.SObject("Task");

account.id = "{!Account.Id}";
account.IsDirty__c = true;

// set task 'assigned to' field to the current user
task.OwnerId = "{!Account.OwnerId}";
task.Subject = "{!Account.Current_Disposition__c}";
task.WhatId = "{!Account.Id}";
task.Description = "{!Account.Notes__c}";

// set status to closed
task.Priority = "Normal";
task.Status = "Completed";
task.ActivityDate=Date.valueOf({!Today()});

// if follow up required, then create the follow up task
if ({!Account.Follow_Up_Required__c})
{
followUp.OwnerId = "{!Account.OwnerId}";
followUp.Subject = "Follow Up Call";
followUp.WhatId = "{!Account.Id}";
followUp.Description = "{!Account.Notes__c}";

// set status to Open
followUp.Priority = "Normal";
followUp.Status = "Not Started";
followUp.IsReminderSet = true;
followUp.ActivityDate= Date.valueOf({!Account.Follow_Up_Date__c});
}

var result = sforce.connection.update([account]);
var resultT = sforce.connection.create([task]);
var resultF = resultT;

if (followUp != null)
{
resultF = sforce.connection.create([followUp]);
}

if (result[0].getBoolean("success") && resultT[0].getBoolean("success") && resultF[0].getBoolean("success"))
{
account.IsDirty__c = false;
account.Follow_Up_Required__c = false;
account.Follow_Up_Date__c = null;
account.Current_Disposition__c = null;
account.Notes__c = null;

result = sforce.connection.update([account]);

if (result[0].getBoolean("success"))
{
window.location.reload();
}
}
else
{
alert("Error!");
}
}// End try block
catch(err)
{
alert("Error creating task: " + err.toString());
}

 

 

 

Greetings all, 

 

I've been out of the SF development scene for ~6 months, and in the meantime, wonder if some any new GUI/WYSIWYG web-to-object form-builders have been released?

 

Specifically, I'm looking to avoid commercial (paid) products (we're a nonprofit) and need to find something that requires minimal APEX development (as end-users will need to create and embed the forms into code-happy environments such as Wordpress). 

 

Any suggestions or thoughts?

 

Many thanks!

--Dave

I have a button which pulls the next lead from a queue and assigns to current user...I am trying to modify this to work with a custom object, how do i access the object?

 

 

  //Find an open lead that is assigned to one of those queues
            List<Lead> leads = [select l.Id,l.OwnerId from Lead l where 
                                                        l.IsConverted=false 
                                                        and l.OwnerId in :listGroupIds 
                                                        limit 1 
                                                        for update];

 

 

  //Find an open lead that is assigned to one of those queues

            List<Lead> leads = [select l.Id,l.OwnerId from Lead l where 

                                                        l.IsConverted=false 

                                                        and l.OwnerId in :listGroupIds 

                                                        limit 1 

                                                        for update];

 

 

Please help!

 

JB

Basically what we need is a dial button, I have been able to get it to work by simply having the button navigate to sip:{!Landing_Page_Lead__c.Dial__c}.... However then the user has to close the new window. What I would like to do is send an http request with java...I cannot seem to get it to work: Please help

 

{!requireScript("/soap/ajax/13.0/connection.js")}

{
URL sip = new URL("sip:{!Landing_Page_Lead__c.Dial__c}");
URLConnection yahooConnection = sip.openConnection();
sipConnection.connect();

} catch (MalformedURLException e) { // new URL() failed
. . .
} catch (IOException e) { // openConnection() failed
. . .
}