You need to sign in to do that
Don't have an account?
Shawn Low 24
Receiving an URL error on a custom button.
I built a custom button in my Dev sandbox that is supposed to open a Task window and pre-populate several fields. The sales person then selects a due date and adds notyes and saves. Pretty simple. I am using Javascript and here is my code.
It is a "Detail Page Button" and the Behavior is "Execute Javascript". The Content Source is "OnClickJavascript"
{!REQUIRESCRIPT("/soap/ajax/41.0/connection.js")}
var taskToCreate = new sforce.SObject("Task");
taskToCreate.OwnerId = "{!$User.Id}";
taskToCreate.Task_Type__c = "Community Appointment from NHS";
taskToCreate.Subject = "Community Site Visit";
taskToCreate.Division__c = "Pardee Homes - Inland Empire";
taskToCreate.WhoId = "{!Lead.Id}";
taskToCreate.Priority = "Normal";
taskToCreate.Status = "Not Started";
var result = sforce.connection.create( [ taskToCreate ] );
window.parent.location.href = "/" + result[0].id + "/e";
In my Dev Sandbox, is works great. I pushed out to the Full Sandbox for testing and received this error...
Im not using a URL
I have been going a little crazy trying to figure this out.
Why is this not working in the Full Sandbox, but not in my Dev Sandbox?
It is a "Detail Page Button" and the Behavior is "Execute Javascript". The Content Source is "OnClickJavascript"
{!REQUIRESCRIPT("/soap/ajax/41.0/connection.js")}
var taskToCreate = new sforce.SObject("Task");
taskToCreate.OwnerId = "{!$User.Id}";
taskToCreate.Task_Type__c = "Community Appointment from NHS";
taskToCreate.Subject = "Community Site Visit";
taskToCreate.Division__c = "Pardee Homes - Inland Empire";
taskToCreate.WhoId = "{!Lead.Id}";
taskToCreate.Priority = "Normal";
taskToCreate.Status = "Not Started";
var result = sforce.connection.create( [ taskToCreate ] );
window.parent.location.href = "/" + result[0].id + "/e";
In my Dev Sandbox, is works great. I pushed out to the Full Sandbox for testing and received this error...
Im not using a URL
I have been going a little crazy trying to figure this out.
Why is this not working in the Full Sandbox, but not in my Dev Sandbox?
please add alter statement before code and see
Still getting an error, Looks like this...
The Validation Rule is requiring a value be selected for the field called "Community Site" (look up). But this is why I need the Task screen to open, so the sales person can select the Community of Interest.
If I turn this Validation rule off, and simply make the field a "Required" field, do you believe the button will work?
Thansk Raj,
What does that error message mean?
Ok, so I have been doing some back tracking and I think I have most of the issues figured out, except one.
I am hoping you can explain things for me.
This is a "Detail Page Button" and the "Behavior" is Javascript.
The button is not working and showing a error that says "URL No Longer Exists"
I am learning to write code, so I apologize for my ignorante questions, where is this code trying to reference a URL? Is it in the last two (2) lines of code? Most of the code behind the button are just opening up the task and pre-setting the values for several fields. The only lines that are not doing those things are the first 2 lines and the last two lines.One of those four (4) lines is referencing a URL, correct?
1. Which one(s)
2. Can you offer a suggestion to adjust to code so it references the right URL?
Thanks
Shawn