• DharmaTeja K
  • NEWBIE
  • 10 Points
  • Member since 2017
  • TATA CONSULTANCY SERVICES LTD

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
Hello All,

Please help me to create a record on Custom Object using javascript button.

1. Whenever i click a button it should pick (accountid,ownerid,CloseDate) from Opportunity record
2. It should create a record with above fields on Custom Object.
===================================================
> The below code that i have written is throwing an error on chrome browser
(faultstring:'soapenv:Client',faultstring:''NaN-NaN-NaNTNaN:NaN:NaN:NaN-NaN:NaN' is not a valid value for the type xsd:date',)
> When i try this in IE it is giving me some other date in internet explorer
> I have tried so many things (parsing,format,toISOString,toLocaleDate..etc..,) but no luck.
===================================================
Code:
{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/33.0/apex.js")}

var opp = new sforce.SObject("Opportunity");
opp.Account = "{!Opportunity.AccountId}";
opp.OwnerId = "{!Opportunity.OwnerId}";
opp.CloseDate = "{!Opportunity.CloseDate}";
alert(opp.CloseDate);

var ord = new sforce.SObject("Order__c");
ord.Account_Name__c = opp.Account;
ord.Account_Director_Name__c = opp.OwnerId;
if(opp.CloseDate==null || opp.CloseDate == ''){
   ord.Customer_Signature_date__c = null;
} else {
   var temp = new Date(opp.CloseDate);
   ord.Customer_Signature_date__c = temp;
}

new_rec = sforce.connection.create([ord]);
 alert('Opportunity Converted successfully ID : '+new_rec[0].id);
======================================================

Please correct me what is the wrong with my code. Every field is populating except closeDate field.

Thanks in Advance,
Teja
Hello All,

I have created an email template in my org and i want to use that (Case-Auto-response / Case assignment Rule / Workflow rules). The problem is when i search for email template it is displaying only unified public email templates but not displaying what i created seperately. Can anyone help me how to make my personal email templates visible when i lookup for?

Thanks in Advance.
Hello All,

Please help me to create a record on Custom Object using javascript button.

1. Whenever i click a button it should pick (accountid,ownerid,CloseDate) from Opportunity record
2. It should create a record with above fields on Custom Object.
===================================================
> The below code that i have written is throwing an error on chrome browser
(faultstring:'soapenv:Client',faultstring:''NaN-NaN-NaNTNaN:NaN:NaN:NaN-NaN:NaN' is not a valid value for the type xsd:date',)
> When i try this in IE it is giving me some other date in internet explorer
> I have tried so many things (parsing,format,toISOString,toLocaleDate..etc..,) but no luck.
===================================================
Code:
{!REQUIRESCRIPT("/soap/ajax/33.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/33.0/apex.js")}

var opp = new sforce.SObject("Opportunity");
opp.Account = "{!Opportunity.AccountId}";
opp.OwnerId = "{!Opportunity.OwnerId}";
opp.CloseDate = "{!Opportunity.CloseDate}";
alert(opp.CloseDate);

var ord = new sforce.SObject("Order__c");
ord.Account_Name__c = opp.Account;
ord.Account_Director_Name__c = opp.OwnerId;
if(opp.CloseDate==null || opp.CloseDate == ''){
   ord.Customer_Signature_date__c = null;
} else {
   var temp = new Date(opp.CloseDate);
   ord.Customer_Signature_date__c = temp;
}

new_rec = sforce.connection.create([ord]);
 alert('Opportunity Converted successfully ID : '+new_rec[0].id);
======================================================

Please correct me what is the wrong with my code. Every field is populating except closeDate field.

Thanks in Advance,
Teja
Hello All,

I have created an email template in my org and i want to use that (Case-Auto-response / Case assignment Rule / Workflow rules). The problem is when i search for email template it is displaying only unified public email templates but not displaying what i created seperately. Can anyone help me how to make my personal email templates visible when i lookup for?

Thanks in Advance.