• Jag Singh
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 5
    Replies
Hi,

I've created a new button so that I can convert Leads when they have a Time Based workflow running. However, I'm getting an error when click the button:

"Unexpected Token ILLEGAL" 

The code for my OnClick JavaScript button is:

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
var newRecords = [];
var c = new sforce.SObject(“Lead”);
c.id =”{!Lead.Id}”;
c.Cancel_Time_Based_Workflow__c = “TRUE”;
newRecords.push(c);
result = sforce.connection.update(newRecords);

window.parent.location.href=”/lead/leadconvert.jsp?id={!Lead.Id}&RetURL=/{!Lead.Id}”;



This happens when I actually click on the Convert button.

Thanks,
Jag
Hi,

Just been playing around with a little bit of code and i'm trying to allow my Leads to convert even though they have activated a time based workflow.

1. I followed this blog: http://cloudskc.wordpress.com/2012/06/14/lead-javascript-convert-button/

2. I've created my check box but i'm getting an error in line 1 and more specifically - “/soap/ajax/20.0/connection.js”)}var


{!REQUIRESCRIPT(“/soap/ajax/20.0/connection.js”)}var newRecords = [];var c = new sforce.SObject(“Lead”);
c.id =”{!Lead.Id}”;
c.Cancel_Time_Based_Workflow__c = “TRUE”;
newRecords.push(c);
result = sforce.connection.update(newRecords);

window.parent.location.href=”/lead/leadconvert.jsp?id={!Lead.Id}&RetURL=/{!Lead.Id}”;

Error Message: Syntax Error


Please let me know if someone has any solutions to this?

Thanks,
Jag
Hi,

I was wondering if someone could kindly help with my code to convert a Lead when it has a time based workflow running against it.

1. Firslty, I worked from this blog in how to do it:

http://opfocus.com/blog/how-to-convert-a-lead-in-use-by-a-time-based-workflow-in-salesforce/

2. I'm not great with coding so wanted some guidance of why I'm getting the following error message when creating a VF page:

Invalid parameter for function URLFOR
Error is in expression '{!URLFOR($Action.Lead.Convert, lead.id, [retURL=$CurrentPage.parameters.retURL], true)}' in page leadconversion


3. Code is as follows:

<apex:page standardController="Lead" >
<apex:form >
  <div style="visibility:hidden;">
    <apex:inputField value="{!Lead.Cancel_Workflow__c}" id="cancelWorkflow" style="visibility:hidden; "/>
  </div>
  <apex:actionFunction name="quickSave" action="{!quickSave}" oncomplete="standardConvert();"/>
  <apex:actionFunction name="standardConvert"
    action="{!URLFOR($Action.Lead.Convert, lead.id, [retURL=$CurrentPage.parameters.retURL], true)}" />
  <script language="JavaScript">
    var previousOnload = window.onload;
    window.onload = function() {
      if (previousOnload) previousOnload();
      fixLead();
    }
    function fixLead() {
      var elemCancelWorkflow = document.getElementById('{!$Component.cancelWorkflow}');
      elemCancelWorkflow.checked = true;
      quickSave();
    }
  </script>
</apex:form>
</apex:page>


4. My VF page URL is: https://c.cs18.visual.force.com/apex/LeadConversion


Any kind of help here would be amazing as this would be very beneficial for our company.

Thanks in advance,
Jag
Hi,
 
I'm building a trigger for the Case object... whereby every time a Case is created I need the Entitlement Lookup field to automatically populate to 'Default Entitlement'. I've written this code below but comes up with an error message:

1. trigger CheckFieldValues on Case (before insert) {
2.    for (Case c : Trigger.new) {
3.        if (c.Status == 'New')
4.            c.Entitlement = 'Default Entitlement';          
5.        }
6.    }

ERROR MESSAGE: Error: Compile Error: Illegal assignment from String to SOBJECT:Entitlement at line 4 column 13

Not an expert on Triggers so any help would be good!

Thanks,
J
Hi,

I'm looking for a Trigger that would auto populate each case when created with the "Default Entitlement" (550110000000iWO) I created in the Entitlement Name Lookup field. 

I'm not the best with triggers so any kind of help would do!

Thanks,
Jag
Hi,

I've created a new button so that I can convert Leads when they have a Time Based workflow running. However, I'm getting an error when click the button:

"Unexpected Token ILLEGAL" 

The code for my OnClick JavaScript button is:

{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")}
var newRecords = [];
var c = new sforce.SObject(“Lead”);
c.id =”{!Lead.Id}”;
c.Cancel_Time_Based_Workflow__c = “TRUE”;
newRecords.push(c);
result = sforce.connection.update(newRecords);

window.parent.location.href=”/lead/leadconvert.jsp?id={!Lead.Id}&RetURL=/{!Lead.Id}”;



This happens when I actually click on the Convert button.

Thanks,
Jag
Hi,

I was wondering if someone could kindly help with my code to convert a Lead when it has a time based workflow running against it.

1. Firslty, I worked from this blog in how to do it:

http://opfocus.com/blog/how-to-convert-a-lead-in-use-by-a-time-based-workflow-in-salesforce/

2. I'm not great with coding so wanted some guidance of why I'm getting the following error message when creating a VF page:

Invalid parameter for function URLFOR
Error is in expression '{!URLFOR($Action.Lead.Convert, lead.id, [retURL=$CurrentPage.parameters.retURL], true)}' in page leadconversion


3. Code is as follows:

<apex:page standardController="Lead" >
<apex:form >
  <div style="visibility:hidden;">
    <apex:inputField value="{!Lead.Cancel_Workflow__c}" id="cancelWorkflow" style="visibility:hidden; "/>
  </div>
  <apex:actionFunction name="quickSave" action="{!quickSave}" oncomplete="standardConvert();"/>
  <apex:actionFunction name="standardConvert"
    action="{!URLFOR($Action.Lead.Convert, lead.id, [retURL=$CurrentPage.parameters.retURL], true)}" />
  <script language="JavaScript">
    var previousOnload = window.onload;
    window.onload = function() {
      if (previousOnload) previousOnload();
      fixLead();
    }
    function fixLead() {
      var elemCancelWorkflow = document.getElementById('{!$Component.cancelWorkflow}');
      elemCancelWorkflow.checked = true;
      quickSave();
    }
  </script>
</apex:form>
</apex:page>


4. My VF page URL is: https://c.cs18.visual.force.com/apex/LeadConversion


Any kind of help here would be amazing as this would be very beneficial for our company.

Thanks in advance,
Jag
Hi,
 
I'm building a trigger for the Case object... whereby every time a Case is created I need the Entitlement Lookup field to automatically populate to 'Default Entitlement'. I've written this code below but comes up with an error message:

1. trigger CheckFieldValues on Case (before insert) {
2.    for (Case c : Trigger.new) {
3.        if (c.Status == 'New')
4.            c.Entitlement = 'Default Entitlement';          
5.        }
6.    }

ERROR MESSAGE: Error: Compile Error: Illegal assignment from String to SOBJECT:Entitlement at line 4 column 13

Not an expert on Triggers so any help would be good!

Thanks,
J