Skip to main content
PREETI BHARTI (Wipro) 님이 #Sales And Marketing에 질문했습니다
I have requirement for Create Opportunity button on Account Detail Page , one i will click on Create opportunity button opportunity will be creating for Same account .

 

Opportunity Name= Account Name , in same way we will take few fields.

 

I have tried  created OnClick JavaScript Button, Please help, how do i ractify code

 

{!REQUIRESCRIPT("/soap/ajax/43.0/connection.js")}

 

var opp = new sforce.SObject('Opportunity');

 

opp.Name= '{!Account.Name}';

 

opp.stageName='Prospecting';

 

opp.CloseDate="{!Account.SLAExpirationDate__c}";

 

opp.AccountId ="{!Account.Id}";

 

/// you can Map other fields here...

 

result = sforce.connection.create([opp ]);

 

var newurl = window.open.href;

 

if(result[0].getBoolean("success")){

 

window.location = "/" + result[0].id + "/e";

 

}else{

 

alert('Could not create record '+result);

 

}

 

Thanks in Advance...!!
답변 1개
  1. 2021년 5월 23일 오후 2:46
    Hello Preeti,

     

    I'm not sure of your full requirements here but you can use a Standard Quick Action and have certain fields pre-defined without the need for any code.

     

    Have you considered this option?

     

    Thanks, Tom
0/9000