• rachvill
  • NEWBIE
  • 0 Points
  • Member since 2006

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

Here's a sample code to diplay a picklist in an scontrol based on a record type. For the code below, I'm displaying the Task Type picklist for a particular record type.

    var result = sforce.connection.describeLayout("Task",[getRecordTypeId("Task",TASK_RECORD_TYPE)]);

    var recordTypeMappings = result.getArray("recordTypeMappings");

    var selType = document.getElementById("type_picklist");   

    for (var i = 0; i < recordTypeMappings.length; i++) {
        var picklistArr = recordTypeMappings[i].get("picklistsForRecordType");
        for (var j = 0; j < picklistArr.length; j++) {
            if (picklistArr[j].picklistName == "Type") {
                var pickListItems = picklistArr[j].picklistValues;
                for (var k = 0; k < pickListItems.length; k++) {
                    var pickListItem = pickListItems[k];
                    if (pickListItem.active) {
                        selType.options[k] = new Option(pickListItem.label, pickListItem.value);
                    }
                }//for k
            }           
        }//for j
    }//for i


Hi,
 
I'm trying to create a custom email scontrol. I use emailauthor.jsp to send the email. However, I am having a hard time figuring out how to send an email with file attachments. I looked at source code for the built-in email page, and it uses filepicker_fs.jsp when you click the Attach File button. There are a couple of parameters that are being passed in this jsp page. I'm not really sure what each parameter is for. I've been trying to figure it out. I also don't even know how to pass the files back to the email, before it actually get sent.  I think it uses emailattach.jsp. And again, I really have no idea how it works.
 
Has anybody been able to create an scontrol with similar requirement as mine? If so, I would really appreciate it if anybody can point me at the right direction.
 
Thank you.
 
Rachel
 

 

Hi,

I would like to develop an scontrol that will behave differently depending on what custom link is clicked.
To illustrate, I have two custom link - "Update SObject", "Delete SObject". If Update SObject is clicked, my scontrol will do an update. If Delete SObject is clicked, I would want the same scontrol to do a deletion instead.

I tried creating a custom link URL with my additional parameter (mode=Insert) and calling the scontrol from there, but it does not work the way I wanted it to work. When I clicked on the link, the whole saleforce window (inclunding headers and tabs) is displayed - so it displays the scontrol within salesforce within salesforce.

Does anybody have idea on how I can go about this? Any help will be very much appreciated.

Thanks.

Rachel
Hi,

fieldsToNull does not work in my code. I have a custom object, that has a custom field being set to null. I checked the definition and field that I'm trying to set to null is Nillable.

rec.fieldsToNull.push("Last_Name__c");
var saveResult = rec.save();
//alert(saveResult);
if (saveResult.className == "Fault") { //error
        alert("There was an error: " + saveResult.toString());
        return false;
}
return true;


Any help will be very much appreciated.


Rachel
Hi,

Here's a sample code to diplay a picklist in an scontrol based on a record type. For the code below, I'm displaying the Task Type picklist for a particular record type.

    var result = sforce.connection.describeLayout("Task",[getRecordTypeId("Task",TASK_RECORD_TYPE)]);

    var recordTypeMappings = result.getArray("recordTypeMappings");

    var selType = document.getElementById("type_picklist");   

    for (var i = 0; i < recordTypeMappings.length; i++) {
        var picklistArr = recordTypeMappings[i].get("picklistsForRecordType");
        for (var j = 0; j < picklistArr.length; j++) {
            if (picklistArr[j].picklistName == "Type") {
                var pickListItems = picklistArr[j].picklistValues;
                for (var k = 0; k < pickListItems.length; k++) {
                    var pickListItem = pickListItems[k];
                    if (pickListItem.active) {
                        selType.options[k] = new Option(pickListItem.label, pickListItem.value);
                    }
                }//for k
            }           
        }//for j
    }//for i


Hi,
 
I'm trying to create a custom email scontrol. I use emailauthor.jsp to send the email. However, I am having a hard time figuring out how to send an email with file attachments. I looked at source code for the built-in email page, and it uses filepicker_fs.jsp when you click the Attach File button. There are a couple of parameters that are being passed in this jsp page. I'm not really sure what each parameter is for. I've been trying to figure it out. I also don't even know how to pass the files back to the email, before it actually get sent.  I think it uses emailattach.jsp. And again, I really have no idea how it works.
 
Has anybody been able to create an scontrol with similar requirement as mine? If so, I would really appreciate it if anybody can point me at the right direction.
 
Thank you.
 
Rachel
 

 

Here i want to alert My Custom Object field Name:But it is not working :(

<html>
<head>




<script type="text/javascript" src="/soap/ajax/8.0/connection.js"></script>
<script src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script>

  <script>
    function initPage() {


var sfObject = sforceClient.describeSObject("Application__c");

for (var a = 0; a < sfObject.fields.length; a++)
{
alert(sfObject.fields[a].name);
 }

                                    }
 </script>
</head>
<body onload="initPage()">


<div id="outputcheck"></div>
</body>
</html>

Please Any one I want help
:smileyhappy:
Hi,

fieldsToNull does not work in my code. I have a custom object, that has a custom field being set to null. I checked the definition and field that I'm trying to set to null is Nillable.

rec.fieldsToNull.push("Last_Name__c");
var saveResult = rec.save();
//alert(saveResult);
if (saveResult.className == "Fault") { //error
        alert("There was an error: " + saveResult.toString());
        return false;
}
return true;


Any help will be very much appreciated.


Rachel